createFolder method

Future<CreateFolderResponse> createFolder({
  1. required String parentFolderId,
  2. String? authenticationToken,
  3. String? name,
})

Creates a folder with the specified name and parent folder.

May throw EntityNotExistsException. May throw EntityAlreadyExistsException. May throw ProhibitedStateException. May throw ConflictingOperationException. May throw LimitExceededException. May throw UnauthorizedOperationException. May throw UnauthorizedResourceAccessException. May throw FailedDependencyException. May throw ServiceUnavailableException.

Parameter parentFolderId : The ID of the parent folder.

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

Parameter name : The name of the new folder.

Implementation

Future<CreateFolderResponse> createFolder({
  required String parentFolderId,
  String? authenticationToken,
  String? name,
}) async {
  ArgumentError.checkNotNull(parentFolderId, 'parentFolderId');
  _s.validateStringLength(
    'parentFolderId',
    parentFolderId,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'authenticationToken',
    authenticationToken,
    1,
    8199,
  );
  _s.validateStringLength(
    'name',
    name,
    1,
    255,
  );
  final headers = <String, String>{
    if (authenticationToken != null)
      'Authentication': authenticationToken.toString(),
  };
  final $payload = <String, dynamic>{
    'ParentFolderId': parentFolderId,
    if (name != null) 'Name': name,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/api/v1/folders',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreateFolderResponse.fromJson(response);
}