createThingType method
Future<CreateThingTypeResponse>
createThingType({
- required String thingTypeName,
- List<
Tag> ? tags, - ThingTypeProperties? thingTypeProperties,
Creates a new thing type.
May throw InvalidRequestException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException. May throw ResourceAlreadyExistsException.
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 {
ArgumentError.checkNotNull(thingTypeName, 'thingTypeName');
_s.validateStringLength(
'thingTypeName',
thingTypeName,
1,
128,
isRequired: true,
);
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);
}