DigitalTwinAsyncClient Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.service.digitaltwin.DigitalTwinAsyncClient

public class DigitalTwinAsyncClient

The Digital Twins Service Client contains asynchronous methods to retrieve and update digital twin information, and invoke commands on a digital twin device.

Constructor Summary

Constructor Description
DigitalTwinAsyncClient(String connectionString)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

DigitalTwinAsyncClient(String hostName, AzureSasCredential azureSasCredential)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

DigitalTwinAsyncClient(String hostName, AzureSasCredential azureSasCredential, DigitalTwinClientOptions options)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

DigitalTwinAsyncClient(String connectionString, DigitalTwinClientOptions options)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

DigitalTwinAsyncClient(String hostName, TokenCredential credential)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

DigitalTwinAsyncClient(String hostName, TokenCredential credential, DigitalTwinClientOptions options)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

Method Summary

Modifier and Type Method and Description
DigitalTwinAsyncClient createFromConnectionString(String connectionString)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

<T> Observable<T> getDigitalTwin(String digitalTwinId, Class<T> clazz)

Gets a digital twin.

<T> Observable<ServiceResponseWithHeaders<T, DigitalTwinGetHeaders>> getDigitalTwinWithResponse(String digitalTwinId, Class<T> clazz)

Gets a digital twin.

Observable<DigitalTwinCommandResponse> invokeCommand(String digitalTwinId, String commandName)

Invoke a command on a digital twin.

Observable<DigitalTwinCommandResponse> invokeCommand(String digitalTwinId, String commandName, String payload)

Invoke a command on a digital twin.

Observable<ServiceResponseWithHeaders<DigitalTwinCommandResponse, DigitalTwinInvokeCommandHeaders>> invokeCommandWithResponse(String digitalTwinId, String commandName, String payload, DigitalTwinInvokeCommandRequestOptions options)

Invoke a command on a digital twin.

Observable<DigitalTwinCommandResponse> invokeComponentCommand(String digitalTwinId, String componentName, String commandName)

Invoke a command on a digital twin component.

Observable<DigitalTwinCommandResponse> invokeComponentCommand(String digitalTwinId, String componentName, String commandName, String payload)

Invoke a command on a digital twin component.

Observable<ServiceResponseWithHeaders<DigitalTwinCommandResponse, DigitalTwinInvokeCommandHeaders>> invokeComponentCommandWithResponse(String digitalTwinId, String componentName, String commandName, String payload, DigitalTwinInvokeCommandRequestOptions options)

Invoke a command on a digital twin component.

Observable<Void> updateDigitalTwin(String digitalTwinId, List<Object> digitalTwinUpdateOperations)

Updates a digital twin.

Observable<ServiceResponseWithHeaders<Void, DigitalTwinUpdateHeaders>> updateDigitalTwinWithResponse(String digitalTwinId, List<Object> digitalTwinUpdateOperations)

Updates a digital twin.

Observable<ServiceResponseWithHeaders<Void, DigitalTwinUpdateHeaders>> updateDigitalTwinWithResponse(String digitalTwinId, List<Object> digitalTwinUpdateOperations, DigitalTwinUpdateRequestOptions options)

Updates a digital twin.

Constructor Details

DigitalTwinAsyncClient

public DigitalTwinAsyncClient(String connectionString)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

Parameters:

connectionString - The IoTHub connection string

DigitalTwinAsyncClient

public DigitalTwinAsyncClient(String hostName, AzureSasCredential azureSasCredential)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

Parameters:

hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")
azureSasCredential - The SAS token provider that will be used for authentication.

DigitalTwinAsyncClient

public DigitalTwinAsyncClient(String hostName, AzureSasCredential azureSasCredential, DigitalTwinClientOptions options)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

Parameters:

hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")
azureSasCredential - The SAS token provider that will be used for authentication.
options - The optional settings for this client. May not be null.

DigitalTwinAsyncClient

public DigitalTwinAsyncClient(String connectionString, DigitalTwinClientOptions options)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

Parameters:

connectionString - The IoTHub connection string
options - The optional settings for this client. May not be null.

DigitalTwinAsyncClient

public DigitalTwinAsyncClient(String hostName, TokenCredential credential)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

Parameters:

hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")
credential - The custom TokenCredential that will provide authentication tokens to this library when they are needed.

DigitalTwinAsyncClient

public DigitalTwinAsyncClient(String hostName, TokenCredential credential, DigitalTwinClientOptions options)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

Parameters:

hostName - The hostname of your IoT Hub instance (For instance, "your-iot-hub.azure-devices.net")
credential - The custom TokenCredential that will provide authentication tokens to this library when they are needed.
options - The optional settings for this client. May not be null.

Method Details

createFromConnectionString

public static DigitalTwinAsyncClient createFromConnectionString(String connectionString)

Creates an implementation instance of DigitalTwins that is used to invoke the Digital Twin features

Parameters:

connectionString - The IoTHub connection string

Returns:

The instantiated DigitalTwinAsyncClient.

getDigitalTwin

public Observable getDigitalTwin(String digitalTwinId, Class clazz)

Gets a digital twin.

Parameters:

digitalTwinId - The Id of the digital twin.
clazz - The class to deserialize the application/json into.

Returns:

The application/json of the digital twin.

getDigitalTwinWithResponse

public Observable> getDigitalTwinWithResponse(String digitalTwinId, Class clazz)

Gets a digital twin.

Parameters:

digitalTwinId - The Id of the digital twin.
clazz - The class to deserialize the application/json into.

Returns:

A ServiceResponseWithHeaders representing deserialized application/json of the digital twin with DigitalTwinGetHeaders.

invokeCommand

public Observable invokeCommand(String digitalTwinId, String commandName)

Invoke a command on a digital twin.

Parameters:

digitalTwinId - The Id of the digital twin.
commandName - The command to be invoked.

Returns:

A DigitalTwinCommandResponse which contains the application/json command invocation response.

invokeCommand

public Observable invokeCommand(String digitalTwinId, String commandName, String payload)

Invoke a command on a digital twin.

Parameters:

digitalTwinId - The Id of the digital twin.
commandName - The command to be invoked.
payload - The command payload.

Returns:

A DigitalTwinCommandResponse which contains the application/json command invocation response.

invokeCommandWithResponse

public Observable> invokeCommandWithResponse(String digitalTwinId, String commandName, String payload, DigitalTwinInvokeCommandRequestOptions options)

Invoke a command on a digital twin.

Parameters:

digitalTwinId - The Id of the digital twin.
commandName - The command to be invoked.
payload - The command payload.
options - The optional settings for this request.

Returns:

A ServiceResponseWithHeaders with DigitalTwinInvokeRootLevelCommandHeaders and DigitalTwinCommandResponse which contains the application/json command invocation response.

invokeComponentCommand

public Observable invokeComponentCommand(String digitalTwinId, String componentName, String commandName)

Invoke a command on a digital twin component.

Parameters:

digitalTwinId - The Id of the digital twin.
componentName - The component name under which the command is defined.
commandName - The command to be invoked.

Returns:

A DigitalTwinCommandResponse which contains the application/json command invocation response.

invokeComponentCommand

public Observable invokeComponentCommand(String digitalTwinId, String componentName, String commandName, String payload)

Invoke a command on a digital twin component.

Parameters:

digitalTwinId - The Id of the digital twin.
componentName - The component name under which the command is defined.
commandName - The command to be invoked.
payload - The command payload.

Returns:

A DigitalTwinCommandResponse which contains the application/json command invocation response.

invokeComponentCommandWithResponse

public Observable> invokeComponentCommandWithResponse(String digitalTwinId, String componentName, String commandName, String payload, DigitalTwinInvokeCommandRequestOptions options)

Invoke a command on a digital twin component.

Parameters:

digitalTwinId - The Id of the digital twin.
componentName - The component name under which the command is defined.
commandName - The command to be invoked.
payload - The command payload.
options - The optional settings for this request.

Returns:

A ServiceResponseWithHeaders with DigitalTwinInvokeRootLevelCommandHeaders and DigitalTwinCommandResponse which contains the application/json command invocation response.

updateDigitalTwin

public Observable updateDigitalTwin(String digitalTwinId, List digitalTwinUpdateOperations)

Updates a digital twin.

Parameters:

digitalTwinId - The Id of the digital twin.
digitalTwinUpdateOperations - The JSON patch to apply to the specified digital twin. This argument can be created using UpdateOperationUtility.

Returns:

void.

updateDigitalTwinWithResponse

public Observable> updateDigitalTwinWithResponse(String digitalTwinId, List digitalTwinUpdateOperations)

Updates a digital twin.

Parameters:

digitalTwinId - The Id of the digital twin.
digitalTwinUpdateOperations - The JSON patch to apply to the specified digital twin. This argument can be created using UpdateOperationUtility.

Returns:

A ServiceResponseWithHeaders with DigitalTwinUpdateHeaders.

updateDigitalTwinWithResponse

public Observable> updateDigitalTwinWithResponse(String digitalTwinId, List digitalTwinUpdateOperations, DigitalTwinUpdateRequestOptions options)

Updates a digital twin.

Parameters:

digitalTwinId - The Id of the digital twin.
digitalTwinUpdateOperations - The JSON patch to apply to the specified digital twin. This argument can be created using UpdateOperationUtility.
options - The optional settings for this request.

Returns:

A ServiceResponseWithHeaders with DigitalTwinUpdateHeaders.

Applies to