deleteThingShadow method

Future<DeleteThingShadowResponse> deleteThingShadow({
  1. required String thingName,
  2. String? shadowName,
})

Deletes the shadow for the specified thing.

For more information, see DeleteThingShadow in the AWS IoT Developer Guide.

May throw ResourceNotFoundException. May throw InvalidRequestException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException. May throw MethodNotAllowedException. May throw UnsupportedDocumentEncodingException.

Parameter thingName : The name of the thing.

Parameter shadowName : The name of the shadow.

Implementation

Future<DeleteThingShadowResponse> deleteThingShadow({
  required String thingName,
  String? shadowName,
}) async {
  ArgumentError.checkNotNull(thingName, 'thingName');
  _s.validateStringLength(
    'thingName',
    thingName,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'shadowName',
    shadowName,
    1,
    64,
  );
  final $query = <String, List<String>>{
    if (shadowName != null) 'name': [shadowName],
  };
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'DELETE',
    requestUri: '/things/${Uri.encodeComponent(thingName)}/shadow',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return DeleteThingShadowResponse(
    payload: await response.stream.toBytes(),
  );
}