Constructor and Description |
---|
SmartHomeApp() |
SmartHomeApp(com.google.auth.oauth2.GoogleCredentials credentials) |
SmartHomeApp(java.lang.String fileName) |
Modifier and Type | Method and Description |
---|---|
SmartHomeRequest |
createRequest(java.lang.String inputJson)
Builds a SmartHomeRequest object from a JSON-formatted string input.
|
com.google.auth.oauth2.GoogleCredentials |
getCredentials() |
java.util.concurrent.CompletableFuture<java.lang.String> |
handleRequest(java.lang.String inputJson,
java.util.Map<?,?> headers)
Processes the incoming JSON request and returns JSON as described in the
Actions on Google conversation protocol.
|
void |
onDisconnect(DisconnectRequest request,
java.util.Map<?,?> headers)
The intent handler for action.devices.DISCONNECT that is implemented in your smart home
Action. This intent does not expect a response.
|
ExecuteResponse |
onExecute(ExecuteRequest request,
java.util.Map<?,?> headers)
The intent handler for action.devices.EXECUTE that is implemented in your smart home Action
|
QueryResponse |
onQuery(QueryRequest request,
java.util.Map<?,?> headers)
The intent handler for action.devices.QUERY that is implemented in your smart home Action
|
SyncResponse |
onSync(SyncRequest request,
java.util.Map<?,?> headers)
The intent handler for action.devices.SYNC that is implemented in your smart home Action
|
NonExistentClass |
reportState(NonExistentClass request)
Sends a ReportState command to the Home Graph, which will store a device's current state.
This should be called after a device receives an EXECUTE request, or if the device has
changed state through a means outside of your smart home Action.
|
NonExistentClass |
requestSync(java.lang.String agentUserId)
Sends a RequestSync command to the Home Graph, which will cause a SYNC request to be sent
to the server to refresh the list of a user's current devices. This should be called when
a user adds a new device, removes a device, or the device parameters change.
|
void |
setCredentials(com.google.auth.oauth2.GoogleCredentials p) |
handleRequest
public SmartHomeApp()
public SmartHomeApp(com.google.auth.oauth2.GoogleCredentials credentials)
public SmartHomeApp(java.lang.String fileName)
public com.google.auth.oauth2.GoogleCredentials getCredentials()
public void setCredentials(com.google.auth.oauth2.GoogleCredentials p)
public SmartHomeRequest createRequest(java.lang.String inputJson)
Builds a SmartHomeRequest object from a JSON-formatted string input.
inputJson
- The request input as a string in a JSON formatpublic SyncResponse onSync(SyncRequest request, java.util.Map<?,?> headers)
The intent handler for action.devices.SYNC that is implemented in your smart home Action
request
- The request object containing relevant fieldsheaders
- Request parameterspublic QueryResponse onQuery(QueryRequest request, java.util.Map<?,?> headers)
The intent handler for action.devices.QUERY that is implemented in your smart home Action
request
- The request object containing relevant fieldsheaders
- Request parameterspublic ExecuteResponse onExecute(ExecuteRequest request, java.util.Map<?,?> headers)
The intent handler for action.devices.EXECUTE that is implemented in your smart home Action
request
- The request object containing relevant fieldsheaders
- Request parameterspublic void onDisconnect(DisconnectRequest request, java.util.Map<?,?> headers)
The intent handler for action.devices.DISCONNECT that is implemented in your smart home Action. This intent does not expect a response.
request
- The request object containing relevant fieldsheaders
- Request parameterspublic NonExistentClass requestSync(java.lang.String agentUserId)
Sends a RequestSync command to the Home Graph, which will cause a SYNC request to be sent to the server to refresh the list of a user's current devices. This should be called when a user adds a new device, removes a device, or the device parameters change.
agentUserId
- The user id for the given user on your servicepublic NonExistentClass reportState(NonExistentClass request)
Sends a ReportState command to the Home Graph, which will store a device's current state. This should be called after a device receives an EXECUTE request, or if the device has changed state through a means outside of your smart home Action.
request
- A payload containing a series of devices and their connected states