TwinClient Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. service. twin. TwinClient
- com.
public class TwinClient
Use the TwinClient class to manage the device twins in IoT hubs.
Constructor Summary
Constructor | Description |
---|---|
TwinClient(String connectionString) |
Constructor to create instance from connection string. |
TwinClient(String hostName, AzureSasCredential azureSasCredential) |
Create a new TwinClient instance. |
TwinClient(String hostName, AzureSasCredential azureSasCredential, TwinClientOptions options) |
Create a new TwinClient instance. |
TwinClient(String hostName, TokenCredential credential) |
Create a new TwinClient instance. |
TwinClient(String hostName, TokenCredential credential, TwinClientOptions options) |
Create a new TwinClient instance. |
TwinClient(String connectionString, TwinClientOptions options) |
Constructor to create instance from connection string. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Twin |
get(String deviceId)
This method retrieves device twin for the specified device. |
Twin |
get(String deviceId, String moduleId)
This method retrieves device twin for the specified device. |
Twin |
patch(Twin twin)
This method patches the twin for the specified device. See PATCH for more details. |
Twin |
patch(Twin twin, String ifMatch)
This method patches the twin for the specified device. See PATCH for more details. |
Twin |
query(String query)
Query from your IoT Hub's set of Twins. |
Twin |
query(String query, QueryPageOptions options)
Query from your IoT Hub's set of Twins. |
Twin |
replace(Twin twin)
Replace the full twin for a given device or module with the provided twin. |
Twin |
replace(Twin twin, String ifMatch)
Replace the full twin for a given device or module with the provided twin. |
Constructor Details
TwinClient
public TwinClient(String connectionString)
Constructor to create instance from connection string.
Parameters:
TwinClient
public TwinClient(String hostName, AzureSasCredential azureSasCredential)
Create a new TwinClient instance.
Parameters:
TwinClient
public TwinClient(String hostName, AzureSasCredential azureSasCredential, TwinClientOptions options)
Create a new TwinClient instance.
Parameters:
TwinClient
public TwinClient(String hostName, TokenCredential credential)
Create a new TwinClient instance.
Parameters:
TwinClient
public TwinClient(String hostName, TokenCredential credential, TwinClientOptions options)
Create a new TwinClient instance.
Parameters:
TwinClient
public TwinClient(String connectionString, TwinClientOptions options)
Constructor to create instance from connection string.
Parameters:
Method Details
get
public Twin get(String deviceId)
This method retrieves device twin for the specified device.
Parameters:
Returns:
Throws:
get
public Twin get(String deviceId, String moduleId)
This method retrieves device twin for the specified device.
Parameters:
Returns:
Throws:
patch
public Twin patch(Twin twin)
This method patches the twin for the specified device.
See PATCH for more details.
Parameters:
Throws:
patch
public Twin patch(Twin twin, String ifMatch)
This method patches the twin for the specified device.
See PATCH for more details.
Parameters:
Throws:
query
public TwinQueryResponse query(String query)
Query from your IoT Hub's set of Twins.
Parameters:
Returns:
Throws:
query
public TwinQueryResponse query(String query, QueryPageOptions options)
Query from your IoT Hub's set of Twins.
Parameters:
Returns:
Throws:
replace
public Twin replace(Twin twin)
Replace the full twin for a given device or module with the provided twin.
Parameters:
Returns:
Throws:
replace
public Twin replace(Twin twin, String ifMatch)
Replace the full twin for a given device or module with the provided twin.
Parameters:
Returns:
Throws:
Applies to
Azure SDK for Java