getFolder method

Future<GetFolderOutput> getFolder({
  1. required String folderPath,
  2. required String repositoryName,
  3. String? commitSpecifier,
})

Returns the contents of a specified folder in a repository.

May throw RepositoryNameRequiredException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw InvalidCommitException. May throw CommitDoesNotExistException. May throw PathRequiredException. May throw InvalidPathException. May throw FolderDoesNotExistException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.

Parameter folderPath : The fully qualified path to the folder whose contents are returned, including the folder name. For example, /examples is a fully-qualified path to a folder named examples that was created off of the root directory (/) of a repository.

Parameter repositoryName : The name of the repository.

Parameter commitSpecifier : A fully qualified reference used to identify a commit that contains the version of the folder's content to return. A fully qualified reference can be a commit ID, branch name, tag, or reference such as HEAD. If no specifier is provided, the folder content is returned as it exists in the HEAD commit.

Implementation

Future<GetFolderOutput> getFolder({
  required String folderPath,
  required String repositoryName,
  String? commitSpecifier,
}) async {
  ArgumentError.checkNotNull(folderPath, 'folderPath');
  ArgumentError.checkNotNull(repositoryName, 'repositoryName');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    1,
    100,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeCommit_20150413.GetFolder'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'folderPath': folderPath,
      'repositoryName': repositoryName,
      if (commitSpecifier != null) 'commitSpecifier': commitSpecifier,
    },
  );

  return GetFolderOutput.fromJson(jsonResponse.body);
}