createLabels method

Future<void> createLabels({
  1. required List<String> labels,
  2. required String resourceId,
  3. String? authenticationToken,
})

Adds the specified list of labels to the given resource (a document or folder)

May throw EntityNotExistsException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException. May throw FailedDependencyException. May throw ServiceUnavailableException. May throw TooManyLabelsException.

Parameter labels : List of labels to add to the resource.

Parameter resourceId : The ID of the resource.

Parameter authenticationToken : Amazon WorkDocs authentication token. Not required when using AWS administrator credentials to access the API.

Implementation

Future<void> createLabels({
  required List<String> labels,
  required String resourceId,
  String? authenticationToken,
}) async {
  ArgumentError.checkNotNull(labels, 'labels');
  ArgumentError.checkNotNull(resourceId, 'resourceId');
  _s.validateStringLength(
    'resourceId',
    resourceId,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'authenticationToken',
    authenticationToken,
    1,
    8199,
  );
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $payload = <String, dynamic>{
    'Labels': labels,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/api/v1/resources/${Uri.encodeComponent(resourceId)}/labels',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
}