updateThingShadow method

Future<UpdateThingShadowResponse> updateThingShadow({
  1. required Uint8List payload,
  2. required String thingName,
  3. String? shadowName,
})

Updates the shadow for the specified thing.

Requires permission to access the UpdateThingShadow action.

For more information, see UpdateThingShadow in the IoT Developer Guide.

May throw ConflictException. May throw InternalFailureException. May throw InvalidRequestException. May throw MethodNotAllowedException. May throw RequestEntityTooLargeException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException. May throw UnsupportedDocumentEncodingException.

Parameter payload : The state information, in JSON format.

Parameter thingName : The name of the thing.

Parameter shadowName : The name of the shadow.

Implementation

Future<UpdateThingShadowResponse> updateThingShadow({
  required Uint8List payload,
  required String thingName,
  String? shadowName,
}) async {
  final $query = <String, List<String>>{
    if (shadowName != null) 'name': [shadowName],
  };
  final response = await _protocol.sendRaw(
    payload: payload,
    method: 'POST',
    requestUri: '/things/${Uri.encodeComponent(thingName)}/shadow',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return UpdateThingShadowResponse(
    payload: await response.stream.toBytes(),
  );
}