GetPullRequestCommand

Gets information about a pull request in a specified repository.

Example Syntax

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

import { CodeCommitClient, GetPullRequestCommand } from "@aws-sdk/client-codecommit"; // ES Modules import
// const { CodeCommitClient, GetPullRequestCommand } = require("@aws-sdk/client-codecommit"); // CommonJS import
const client = new CodeCommitClient(config);
const input = { // GetPullRequestInput
  pullRequestId: "STRING_VALUE", // required
};
const command = new GetPullRequestCommand(input);
const response = await client.send(command);
// { // GetPullRequestOutput
//   pullRequest: { // PullRequest
//     pullRequestId: "STRING_VALUE",
//     title: "STRING_VALUE",
//     description: "STRING_VALUE",
//     lastActivityDate: new Date("TIMESTAMP"),
//     creationDate: new Date("TIMESTAMP"),
//     pullRequestStatus: "OPEN" || "CLOSED",
//     authorArn: "STRING_VALUE",
//     pullRequestTargets: [ // PullRequestTargetList
//       { // PullRequestTarget
//         repositoryName: "STRING_VALUE",
//         sourceReference: "STRING_VALUE",
//         destinationReference: "STRING_VALUE",
//         destinationCommit: "STRING_VALUE",
//         sourceCommit: "STRING_VALUE",
//         mergeBase: "STRING_VALUE",
//         mergeMetadata: { // MergeMetadata
//           isMerged: true || false,
//           mergedBy: "STRING_VALUE",
//           mergeCommitId: "STRING_VALUE",
//           mergeOption: "FAST_FORWARD_MERGE" || "SQUASH_MERGE" || "THREE_WAY_MERGE",
//         },
//       },
//     ],
//     clientRequestToken: "STRING_VALUE",
//     revisionId: "STRING_VALUE",
//     approvalRules: [ // ApprovalRulesList
//       { // ApprovalRule
//         approvalRuleId: "STRING_VALUE",
//         approvalRuleName: "STRING_VALUE",
//         approvalRuleContent: "STRING_VALUE",
//         ruleContentSha256: "STRING_VALUE",
//         lastModifiedDate: new Date("TIMESTAMP"),
//         creationDate: new Date("TIMESTAMP"),
//         lastModifiedUser: "STRING_VALUE",
//         originApprovalRuleTemplate: { // OriginApprovalRuleTemplate
//           approvalRuleTemplateId: "STRING_VALUE",
//           approvalRuleTemplateName: "STRING_VALUE",
//         },
//       },
//     ],
//   },
// };

GetPullRequestCommand Input

See GetPullRequestCommandInput for more details

Parameter
Type
Description
pullRequestId
Required
string | undefined

The system-generated ID of the pull request. To get this ID, use ListPullRequests.

GetPullRequestCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
pullRequest
Required
PullRequest | undefined

Information about the specified pull request.

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.

InvalidPullRequestIdException
client

The pull request ID is not valid. Make sure that you have provided the full ID and that the pull request is in the specified repository, and then try again.

PullRequestDoesNotExistException
client

The pull request ID could not be found. Make sure that you have specified the correct repository name and pull request ID, and then try again.

PullRequestIdRequiredException
client

A pull request ID is required, but none was provided.

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