getFile method
Returns the base-64 encoded contents of a specified file and its metadata.
May throw RepositoryNameRequiredException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw InvalidCommitException. May throw CommitDoesNotExistException. May throw PathRequiredException. May throw InvalidPathException. May throw FileDoesNotExistException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException. May throw FileTooLargeException.
Parameter filePath
:
The fully qualified path to the file, including the full name and
extension of the file. For example, /examples/file.md is the fully
qualified path to a file named file.md in a folder named examples.
Parameter repositoryName
:
The name of the repository that contains the file.
Parameter commitSpecifier
:
The fully quaified reference that identifies the commit that contains the
file. For example, you can specify a full commit ID, a tag, a branch name,
or a reference such as refs/heads/master. If none is provided, the head
commit is used.
Implementation
Future<GetFileOutput> getFile({
required String filePath,
required String repositoryName,
String? commitSpecifier,
}) async {
ArgumentError.checkNotNull(filePath, 'filePath');
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.GetFile'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'filePath': filePath,
'repositoryName': repositoryName,
if (commitSpecifier != null) 'commitSpecifier': commitSpecifier,
},
);
return GetFileOutput.fromJson(jsonResponse.body);
}