createThingType method
Creates a new thing type. If this call is made multiple times using the
same thing type name and configuration, the call will succeed. If this
call is made with the same thing type name but different configuration a
ResourceAlreadyExistsException is thrown.
Requires permission to access the CreateThingType action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ResourceAlreadyExistsException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
Parameter thingTypeName :
The name of the thing type.
Parameter tags :
Metadata which can be used to manage the thing type.
Parameter thingTypeProperties :
The ThingTypeProperties for the thing type to create. It contains
information about the new thing type including a description, and a list
of searchable thing attribute names.
Implementation
Future<CreateThingTypeResponse> createThingType({
required String thingTypeName,
List<Tag>? tags,
ThingTypeProperties? thingTypeProperties,
}) async {
final $payload = <String, dynamic>{
if (tags != null) 'tags': tags,
if (thingTypeProperties != null)
'thingTypeProperties': thingTypeProperties,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/thing-types/${Uri.encodeComponent(thingTypeName)}',
exceptionFnMap: _exceptionFns,
);
return CreateThingTypeResponse.fromJson(response);
}