createSkillGroup method

Future<CreateSkillGroupResponse> createSkillGroup({
  1. required String skillGroupName,
  2. String? clientRequestToken,
  3. String? description,
  4. List<Tag>? tags,
})

Creates a skill group with a specified name and description.

May throw AlreadyExistsException. May throw LimitExceededException. May throw ConcurrentModificationException.

Parameter skillGroupName : The name for the skill group.

Parameter clientRequestToken : A unique, user-specified identifier for this request that ensures idempotency.

Parameter description : The description for the skill group.

Parameter tags : The tags for the skill group.

Implementation

Future<CreateSkillGroupResponse> createSkillGroup({
  required String skillGroupName,
  String? clientRequestToken,
  String? description,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(skillGroupName, 'skillGroupName');
  _s.validateStringLength(
    'skillGroupName',
    skillGroupName,
    1,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    10,
    150,
  );
  _s.validateStringLength(
    'description',
    description,
    1,
    200,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AlexaForBusiness.CreateSkillGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'SkillGroupName': skillGroupName,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateSkillGroupResponse.fromJson(jsonResponse.body);
}