#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Device {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub traits: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(message, optional, tag = "4")]
pub name: ::core::option::Option<DeviceNames>,
#[prost(bool, tag = "5")]
pub will_report_state: bool,
#[prost(string, tag = "6")]
pub room_hint: ::prost::alloc::string::String,
#[prost(string, tag = "7")]
pub structure_hint: ::prost::alloc::string::String,
#[prost(message, optional, tag = "8")]
pub device_info: ::core::option::Option<DeviceInfo>,
#[prost(message, optional, tag = "9")]
pub attributes: ::core::option::Option<::prost_types::Struct>,
#[prost(message, optional, tag = "10")]
pub custom_data: ::core::option::Option<::prost_types::Struct>,
#[prost(message, repeated, tag = "11")]
pub other_device_ids: ::prost::alloc::vec::Vec<AgentOtherDeviceId>,
#[prost(bool, tag = "12")]
pub notification_supported_by_agent: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeviceNames {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub nicknames: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "3")]
pub default_names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeviceInfo {
#[prost(string, tag = "1")]
pub manufacturer: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub model: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub hw_version: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub sw_version: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AgentOtherDeviceId {
#[prost(string, tag = "1")]
pub agent_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub device_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestSyncDevicesRequest {
#[prost(string, tag = "1")]
pub agent_user_id: ::prost::alloc::string::String,
#[prost(bool, tag = "2")]
pub r#async: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestSyncDevicesResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReportStateAndNotificationRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub event_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub agent_user_id: ::prost::alloc::string::String,
#[deprecated]
#[prost(string, tag = "5")]
pub follow_up_token: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub payload: ::core::option::Option<StateAndNotificationPayload>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReportStateAndNotificationResponse {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StateAndNotificationPayload {
#[prost(message, optional, tag = "1")]
pub devices: ::core::option::Option<ReportStateAndNotificationDevice>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReportStateAndNotificationDevice {
#[prost(message, optional, tag = "1")]
pub states: ::core::option::Option<::prost_types::Struct>,
#[prost(message, optional, tag = "2")]
pub notifications: ::core::option::Option<::prost_types::Struct>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteAgentUserRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub agent_user_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub agent_user_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub inputs: ::prost::alloc::vec::Vec<QueryRequestInput>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryRequestInput {
#[prost(message, optional, tag = "1")]
pub payload: ::core::option::Option<QueryRequestPayload>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryRequestPayload {
#[prost(message, repeated, tag = "1")]
pub devices: ::prost::alloc::vec::Vec<AgentDeviceId>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AgentDeviceId {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryResponse {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub payload: ::core::option::Option<QueryResponsePayload>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueryResponsePayload {
#[prost(map = "string, message", tag = "1")]
pub devices: ::std::collections::HashMap<::prost::alloc::string::String, ::prost_types::Struct>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncRequest {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub agent_user_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncResponse {
#[prost(string, tag = "1")]
pub request_id: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub payload: ::core::option::Option<SyncResponsePayload>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncResponsePayload {
#[prost(string, tag = "1")]
pub agent_user_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub devices: ::prost::alloc::vec::Vec<Device>,
}
#[doc = r" Generated client implementations."]
pub mod home_graph_api_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Google Home Graph API service. The Home Graph service provides support for"]
#[doc = " accessing first-party and third-party devices stored in Google's Home Graph."]
#[doc = " The Home Graph database provides contextual data about the relationships"]
#[doc = " between devices and the home."]
#[doc = ""]
#[doc = " For more details, see the [Home Graph developer"]
#[doc = " guide](https://developers.google.com/assistant/smarthome/concepts/homegraph)."]
#[derive(Debug, Clone)]
pub struct HomeGraphApiServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> HomeGraphApiServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> HomeGraphApiServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
HomeGraphApiServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Requests Google to send an `action.devices.SYNC`"]
#[doc = " [intent](https://developers.google.com/assistant/smarthome/reference/intent/sync)"]
#[doc = " to your smart home Action to update device metadata for the given user."]
#[doc = ""]
#[doc = ""]
#[doc = " The third-party user's identity is passed via the `agent_user_id`"]
#[doc = " (see"]
#[doc = " [RequestSyncDevicesRequest][google.home.graph.v1.RequestSyncDevicesRequest])."]
#[doc = " This request must be authorized using service account credentials from your"]
#[doc = " Actions console project."]
pub async fn request_sync_devices(
&mut self,
request: impl tonic::IntoRequest<super::RequestSyncDevicesRequest>,
) -> Result<tonic::Response<super::RequestSyncDevicesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.home.graph.v1.HomeGraphApiService/RequestSyncDevices",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Reports device state and optionally sends device notifications."]
#[doc = " Called by your smart home Action when the state of a third-party device"]
#[doc = " changes or you need to send a notification about the device."]
#[doc = " See [Implement Report"]
#[doc = " State](https://developers.google.com/assistant/smarthome/develop/report-state)"]
#[doc = " for more information."]
#[doc = ""]
#[doc = " This method updates the device state according to its declared"]
#[doc = " [traits](https://developers.google.com/assistant/smarthome/concepts/devices-traits)."]
#[doc = " Publishing a new state value outside of these traits will result in an"]
#[doc = " `INVALID_ARGUMENT` error response."]
#[doc = ""]
#[doc = " The third-party user's identity is passed in via the `agent_user_id`"]
#[doc = " (see"]
#[doc = " [ReportStateAndNotificationRequest][google.home.graph.v1.ReportStateAndNotificationRequest])."]
#[doc = " This request must be authorized using service account credentials from your"]
#[doc = " Actions console project."]
pub async fn report_state_and_notification(
&mut self,
request: impl tonic::IntoRequest<super::ReportStateAndNotificationRequest>,
) -> Result<tonic::Response<super::ReportStateAndNotificationResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.home.graph.v1.HomeGraphApiService/ReportStateAndNotification",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Unlinks the given third-party user from your smart home Action."]
#[doc = " All data related to this user will be deleted."]
#[doc = ""]
#[doc = " For more details on how users link their accounts, see"]
#[doc = " [fulfillment and"]
#[doc = " authentication](https://developers.google.com/assistant/smarthome/concepts/fulfillment-authentication)."]
#[doc = ""]
#[doc = " The third-party user's identity is passed in via the `agent_user_id`"]
#[doc = " (see"]
#[doc = " [DeleteAgentUserRequest][google.home.graph.v1.DeleteAgentUserRequest])."]
#[doc = " This request must be authorized using service account credentials from your"]
#[doc = " Actions console project."]
pub async fn delete_agent_user(
&mut self,
request: impl tonic::IntoRequest<super::DeleteAgentUserRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.home.graph.v1.HomeGraphApiService/DeleteAgentUser",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets the current states in Home Graph for the given set of the third-party"]
#[doc = " user's devices."]
#[doc = ""]
#[doc = " The third-party user's identity is passed in via the `agent_user_id`"]
#[doc = " (see [QueryRequest][google.home.graph.v1.QueryRequest])."]
#[doc = " This request must be authorized using service account credentials from your"]
#[doc = " Actions console project."]
pub async fn query(
&mut self,
request: impl tonic::IntoRequest<super::QueryRequest>,
) -> Result<tonic::Response<super::QueryResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.home.graph.v1.HomeGraphApiService/Query",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Gets all the devices associated with the given third-party user."]
#[doc = ""]
#[doc = " The third-party user's identity is passed in via the `agent_user_id`"]
#[doc = " (see [SyncRequest][google.home.graph.v1.SyncRequest])."]
#[doc = " This request must be authorized using service account credentials from your"]
#[doc = " Actions console project."]
pub async fn sync(
&mut self,
request: impl tonic::IntoRequest<super::SyncRequest>,
) -> Result<tonic::Response<super::SyncResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.home.graph.v1.HomeGraphApiService/Sync",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}