ListBranchesCommand

Gets information about one or more branches in a repository.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CodeCommitClient, ListBranchesCommand } from "@aws-sdk/client-codecommit"; // ES Modules import
// const { CodeCommitClient, ListBranchesCommand } = require("@aws-sdk/client-codecommit"); // CommonJS import
const client = new CodeCommitClient(config);
const input = { // ListBranchesInput
  repositoryName: "STRING_VALUE", // required
  nextToken: "STRING_VALUE",
};
const command = new ListBranchesCommand(input);
const response = await client.send(command);
// { // ListBranchesOutput
//   branches: [ // BranchNameList
//     "STRING_VALUE",
//   ],
//   nextToken: "STRING_VALUE",
// };

ListBranchesCommand Input

See ListBranchesCommandInput for more details

Parameter
Type
Description
repositoryName
Required
string | undefined

The name of the repository that contains the branches.

nextToken
string | undefined

An enumeration token that allows the operation to batch the results.

ListBranchesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
branches
string[] | undefined

The list of branch names.

nextToken
string | undefined

An enumeration token that returns the batch of the results.

Throws

Name
Fault
Details
EncryptionIntegrityChecksFailedException
server

An encryption integrity check failed.

EncryptionKeyAccessDeniedException
client

An encryption key could not be accessed.

EncryptionKeyDisabledException
client

The encryption key is disabled.

EncryptionKeyNotFoundException
client

No encryption key was found.

EncryptionKeyUnavailableException
client

The encryption key is not available.

InvalidContinuationTokenException
client

The specified continuation token is not valid.

InvalidRepositoryNameException
client

A specified repository name is not valid.

This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.

RepositoryDoesNotExistException
client

The specified repository does not exist.

RepositoryNameRequiredException
client

A repository name is required, but was not specified.

CodeCommitServiceException
Base exception class for all service exceptions from CodeCommit service.