pub struct DeviceMethods<'a, C>where
C: 'a,{ /* private fields */ }Expand description
A builder providing access to all methods supported on device resources.
It is not used directly, but through the HomeGraphService hub.
§Example
Instantiate a resource builder
extern crate hyper;
extern crate hyper_rustls;
extern crate google_homegraph1 as homegraph1;
use homegraph1::{HomeGraphService, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
let secret: yup_oauth2::ApplicationSecret = Default::default();
let connector = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.unwrap()
.https_only()
.enable_http2()
.build();
let executor = hyper_util::rt::TokioExecutor::new();
let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
secret,
yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
yup_oauth2::client::CustomHyperClientBuilder::from(
hyper_util::client::legacy::Client::builder(executor).build(connector),
),
).build().await.unwrap();
let client = hyper_util::client::legacy::Client::builder(
hyper_util::rt::TokioExecutor::new()
)
.build(
hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.unwrap()
.https_or_http()
.enable_http2()
.build()
);
let mut hub = HomeGraphService::new(client, auth);
// Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
// like `query(...)`, `report_state_and_notification(...)`, `request_sync(...)` and `sync(...)`
// to build up your call.
let rb = hub.devices();Implementations§
Source§impl<'a, C> DeviceMethods<'a, C>
impl<'a, C> DeviceMethods<'a, C>
Sourcepub fn query(&self, request: QueryRequest) -> DeviceQueryCall<'a, C>
pub fn query(&self, request: QueryRequest) -> DeviceQueryCall<'a, C>
Create a builder to help you perform the following task:
Gets the current states in Home Graph for the given set of the third-party user’s devices. The third-party user’s identity is passed in via the agent_user_id (see QueryRequest). This request must be authorized using service account credentials from your Actions console project.
§Arguments
request- No description provided.
Sourcepub fn report_state_and_notification(
&self,
request: ReportStateAndNotificationRequest,
) -> DeviceReportStateAndNotificationCall<'a, C>
pub fn report_state_and_notification( &self, request: ReportStateAndNotificationRequest, ) -> DeviceReportStateAndNotificationCall<'a, C>
Create a builder to help you perform the following task:
Reports device state and optionally sends device notifications. Called by your smart home Action when the state of a third-party device changes or you need to send a notification about the device. See Implement Report State for more information. This method updates the device state according to its declared traits. Publishing a new state value outside of these traits will result in an INVALID_ARGUMENT error response. The third-party user’s identity is passed in via the agent_user_id (see ReportStateAndNotificationRequest). This request must be authorized using service account credentials from your Actions console project.
§Arguments
request- No description provided.
Sourcepub fn request_sync(
&self,
request: RequestSyncDevicesRequest,
) -> DeviceRequestSyncCall<'a, C>
pub fn request_sync( &self, request: RequestSyncDevicesRequest, ) -> DeviceRequestSyncCall<'a, C>
Create a builder to help you perform the following task:
Requests Google to send an action.devices.SYNC intent to your smart home Action to update device metadata for the given user. The third-party user’s identity is passed via the agent_user_id (see RequestSyncDevicesRequest). This request must be authorized using service account credentials from your Actions console project.
§Arguments
request- No description provided.
Sourcepub fn sync(&self, request: SyncRequest) -> DeviceSyncCall<'a, C>
pub fn sync(&self, request: SyncRequest) -> DeviceSyncCall<'a, C>
Create a builder to help you perform the following task:
Gets all the devices associated with the given third-party user. The third-party user’s identity is passed in via the agent_user_id (see SyncRequest). This request must be authorized using service account credentials from your Actions console project.
§Arguments
request- No description provided.