deleteThing method
Deletes the specified thing. Returns successfully with no error if the deletion is successful or you specify a thing that doesn't exist.
May throw ResourceNotFoundException. May throw VersionConflictException. May throw InvalidRequestException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException.
Parameter thingName
:
The name of the thing to delete.
Parameter expectedVersion
:
The expected version of the thing record in the registry. If the version
of the record in the registry does not match the expected version
specified in the request, the DeleteThing
request is rejected
with a VersionConflictException
.
Implementation
Future<void> deleteThing({
required String thingName,
int? expectedVersion,
}) async {
ArgumentError.checkNotNull(thingName, 'thingName');
_s.validateStringLength(
'thingName',
thingName,
1,
128,
isRequired: true,
);
final $query = <String, List<String>>{
if (expectedVersion != null)
'expectedVersion': [expectedVersion.toString()],
};
final response = await _protocol.send(
payload: null,
method: 'DELETE',
requestUri: '/things/${Uri.encodeComponent(thingName)}',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
}