GetCommentCommand

Returns the content of a comment made on a change, file, or commit in a repository.

Reaction counts might include numbers from user identities who were deleted after the reaction was made. For a count of reactions from active identities, use GetCommentReactions.

Example Syntax

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

import { CodeCommitClient, GetCommentCommand } from "@aws-sdk/client-codecommit"; // ES Modules import
// const { CodeCommitClient, GetCommentCommand } = require("@aws-sdk/client-codecommit"); // CommonJS import
const client = new CodeCommitClient(config);
const input = { // GetCommentInput
  commentId: "STRING_VALUE", // required
};
const command = new GetCommentCommand(input);
const response = await client.send(command);
// { // GetCommentOutput
//   comment: { // Comment
//     commentId: "STRING_VALUE",
//     content: "STRING_VALUE",
//     inReplyTo: "STRING_VALUE",
//     creationDate: new Date("TIMESTAMP"),
//     lastModifiedDate: new Date("TIMESTAMP"),
//     authorArn: "STRING_VALUE",
//     deleted: true || false,
//     clientRequestToken: "STRING_VALUE",
//     callerReactions: [ // CallerReactions
//       "STRING_VALUE",
//     ],
//     reactionCounts: { // ReactionCountsMap
//       "<keys>": Number("int"),
//     },
//   },
// };

GetCommentCommand Input

See GetCommentCommandInput for more details

Parameter
Type
Description
commentId
Required
string | undefined

The unique, system-generated ID of the comment. To get this ID, use GetCommentsForComparedCommit or GetCommentsForPullRequest.

GetCommentCommand Output

See GetCommentCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
comment
Comment | undefined

The contents of the comment.

Throws

Name
Fault
Details
CommentDeletedException
client

This comment has already been deleted. You cannot edit or delete a deleted comment.

CommentDoesNotExistException
client

No comment exists with the provided ID. Verify that you have used the correct ID, and then try again.

CommentIdRequiredException
client

The comment ID is missing or null. A comment ID is required.

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.

InvalidCommentIdException
client

The comment ID is not in a valid format. Make sure that you have provided the full comment ID.

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