getThingShadow method
Gets the shadow for the specified thing.
Requires permission to access the GetThingShadow action.
For more information, see GetThingShadow in the IoT Developer Guide.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw MethodNotAllowedException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
May throw UnsupportedDocumentEncodingException.
Parameter thingName :
The name of the thing.
Parameter shadowName :
The name of the shadow.
Implementation
Future<GetThingShadowResponse> getThingShadow({
required String thingName,
String? shadowName,
}) async {
final $query = <String, List<String>>{
if (shadowName != null) 'name': [shadowName],
};
final response = await _protocol.sendRaw(
payload: null,
method: 'GET',
requestUri: '/things/${Uri.encodeComponent(thingName)}/shadow',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return GetThingShadowResponse(
payload: await response.stream.toBytes(),
);
}