Amazon CodeGuru Reviewer

2020/04/22 - Amazon CodeGuru Reviewer - 6 new api methods

Changes  Add support for code review and recommendation feedback APIs.

PutRecommendationFeedback (new) Link ¶

Stores customer feedback for a CodeGuru-Reviewer recommendation. When this API is called again with different reactions the previous feedback is overwritten.

See also: AWS API Documentation

Request Syntax

client.put_recommendation_feedback(
    CodeReviewArn='string',
    RecommendationId='string',
    Reactions=[
        'ThumbsUp'|'ThumbsDown',
    ]
)
type CodeReviewArn

string

param CodeReviewArn

[REQUIRED]

The Amazon Resource Name (ARN) that identifies the code review.

type RecommendationId

string

param RecommendationId

[REQUIRED]

The recommendation ID that can be used to track the provided recommendations and then to collect the feedback.

type Reactions

list

param Reactions

[REQUIRED]

List for storing reactions. Reactions are utf-8 text code for emojis. If you send an empty list it clears all your feedback.

  • (string) --

rtype

dict

returns

Response Syntax

{}

Response Structure

  • (dict) --

DescribeRecommendationFeedback (new) Link ¶

Describes the customer feedback for a CodeGuru Reviewer recommendation.

See also: AWS API Documentation

Request Syntax

client.describe_recommendation_feedback(
    CodeReviewArn='string',
    RecommendationId='string',
    UserId='string'
)
type CodeReviewArn

string

param CodeReviewArn

[REQUIRED]

The Amazon Resource Name (ARN) that identifies the code review.

type RecommendationId

string

param RecommendationId

[REQUIRED]

The recommendation ID that can be used to track the provided recommendations and then to collect the feedback.

type UserId

string

param UserId

Optional parameter to describe the feedback for a given user. If this is not supplied, it defaults to the user making the request.

rtype

dict

returns

Response Syntax

{
    'RecommendationFeedback': {
        'CodeReviewArn': 'string',
        'RecommendationId': 'string',
        'Reactions': [
            'ThumbsUp'|'ThumbsDown',
        ],
        'UserId': 'string',
        'CreatedTimeStamp': datetime(2015, 1, 1),
        'LastUpdatedTimeStamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • RecommendationFeedback (dict) --

      The recommendation feedback given by the user.

      • CodeReviewArn (string) --

        The Amazon Resource Name (ARN) that identifies the code review.

      • RecommendationId (string) --

        The recommendation ID that can be used to track the provided recommendations. Later on it can be used to collect the feedback.

      • Reactions (list) --

        List for storing reactions. Reactions are utf-8 text code for emojis. You can send an empty list to clear off all your feedback.

        • (string) --

      • UserId (string) --

        The user principal that made the API call.

      • CreatedTimeStamp (datetime) --

        The time at which the feedback was created.

      • LastUpdatedTimeStamp (datetime) --

        The time at which the feedback was last updated.

ListRecommendations (new) Link ¶

Returns the list of all recommendations for a completed code review.

See also: AWS API Documentation

Request Syntax

client.list_recommendations(
    NextToken='string',
    MaxResults=123,
    CodeReviewArn='string'
)
type NextToken

string

param NextToken

Pagination token.

type MaxResults

integer

param MaxResults

The maximum number of results that are returned per call. The default is 100.

type CodeReviewArn

string

param CodeReviewArn

[REQUIRED]

The Amazon Resource Name (ARN) of the code review to describe.

rtype

dict

returns

Response Syntax

{
    'RecommendationSummaries': [
        {
            'FilePath': 'string',
            'RecommendationId': 'string',
            'StartLine': 123,
            'EndLine': 123,
            'Description': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • RecommendationSummaries (list) --

      List of recommendations for the requested code review.

      • (dict) --

        Information about recommendations.

        • FilePath (string) --

          Name of the file on which a recommendation is provided.

        • RecommendationId (string) --

          The recommendation ID that can be used to track the provided recommendations. Later on it can be used to collect the feedback.

        • StartLine (integer) --

          Start line from where the recommendation is applicable in the source commit or source branch.

        • EndLine (integer) --

          Last line where the recommendation is applicable in the source commit or source branch. For a single line comment the start line and end line values will be the same.

        • Description (string) --

          A description of the recommendation generated by CodeGuru Reviewer for the lines of code between the start line and the end line.

    • NextToken (string) --

      Pagination token.

DescribeCodeReview (new) Link ¶

Returns the metadaata associated with the code review along with its status.

See also: AWS API Documentation

Request Syntax

client.describe_code_review(
    CodeReviewArn='string'
)
type CodeReviewArn

string

param CodeReviewArn

[REQUIRED]

The Amazon Resource Name (ARN) of the code review to describe.

rtype

dict

returns

Response Syntax

{
    'CodeReview': {
        'Name': 'string',
        'CodeReviewArn': 'string',
        'RepositoryName': 'string',
        'Owner': 'string',
        'ProviderType': 'CodeCommit'|'GitHub',
        'State': 'Completed'|'Pending'|'Failed'|'Deleting',
        'StateReason': 'string',
        'CreatedTimeStamp': datetime(2015, 1, 1),
        'LastUpdatedTimeStamp': datetime(2015, 1, 1),
        'Type': 'PullRequest',
        'PullRequestId': 'string',
        'SourceCodeType': {
            'CommitDiff': {
                'SourceCommit': 'string',
                'DestinationCommit': 'string'
            }
        },
        'Metrics': {
            'MeteredLinesOfCodeCount': 123,
            'FindingsCount': 123
        }
    }
}

Response Structure

  • (dict) --

    • CodeReview (dict) --

      Information about the code review.

      • Name (string) --

        The name of the code review.

      • CodeReviewArn (string) --

        The Amazon Resource Name (ARN) of the code review to describe.

      • RepositoryName (string) --

        The name of the repository.

      • Owner (string) --

        The owner of the repository.

      • ProviderType (string) --

        The provider type of the repository association.

      • State (string) --

        The state of the code review.

      • StateReason (string) --

        The reason for the state of the code review.

      • CreatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the code review was created.

      • LastUpdatedTimeStamp (datetime) --

        The time, in milliseconds since the epoch, when the code review was last updated.

      • Type (string) --

        The type of code review.

      • PullRequestId (string) --

        The pull request ID for the code review.

      • SourceCodeType (dict) --

        The type of the source code for the code review.

        • CommitDiff (dict) --

          The commit diff for the pull request.

          • SourceCommit (string) --

            Source Commit SHA.

          • DestinationCommit (string) --

            Destination Commit SHA

      • Metrics (dict) --

        The statistics from the code review.

        • MeteredLinesOfCodeCount (integer) --

          Lines of code metered in the code review.

        • FindingsCount (integer) --

          Total number of recommendations found in the code review.

ListCodeReviews (new) Link ¶

Lists all the code reviews that the customer has created in the past 90 days.

See also: AWS API Documentation

Request Syntax

client.list_code_reviews(
    ProviderTypes=[
        'CodeCommit'|'GitHub',
    ],
    States=[
        'Completed'|'Pending'|'Failed'|'Deleting',
    ],
    RepositoryNames=[
        'string',
    ],
    Type='PullRequest',
    MaxResults=123,
    NextToken='string'
)
type ProviderTypes

list

param ProviderTypes

List of provider types for filtering that needs to be applied before displaying the result. For example, "providerTypes=[GitHub]" will list code reviews from GitHub.

  • (string) --

type States

list

param States

List of states for filtering that needs to be applied before displaying the result. For example, "states=[Pending]" will list code reviews in the Pending state.

  • (string) --

type RepositoryNames

list

param RepositoryNames

List of repository names for filtering that needs to be applied before displaying the result.

  • (string) --

type Type

string

param Type

[REQUIRED]

The type of code reviews to list in the response.

type MaxResults

integer

param MaxResults

The maximum number of results that are returned per call. The default is 100.

type NextToken

string

param NextToken

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.

rtype

dict

returns

Response Syntax

{
    'CodeReviewSummaries': [
        {
            'Name': 'string',
            'CodeReviewArn': 'string',
            'RepositoryName': 'string',
            'Owner': 'string',
            'ProviderType': 'CodeCommit'|'GitHub',
            'State': 'Completed'|'Pending'|'Failed'|'Deleting',
            'CreatedTimeStamp': datetime(2015, 1, 1),
            'LastUpdatedTimeStamp': datetime(2015, 1, 1),
            'Type': 'PullRequest',
            'PullRequestId': 'string',
            'MetricsSummary': {
                'MeteredLinesOfCodeCount': 123,
                'FindingsCount': 123
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • CodeReviewSummaries (list) --

      A list of code reviews that meet the criteria of the request.

      • (dict) --

        Information about the summary of the code review.

        • Name (string) --

          The name of the code review.

        • CodeReviewArn (string) --

          The Amazon Resource Name (ARN) of the code review to describe.

        • RepositoryName (string) --

          The name of the repository.

        • Owner (string) --

          The owner of the repository.

        • ProviderType (string) --

          The provider type of the repository association.

        • State (string) --

          The state of the code review.

        • CreatedTimeStamp (datetime) --

          The time, in milliseconds since the epoch, when the code review was created.

        • LastUpdatedTimeStamp (datetime) --

          The time, in milliseconds since the epoch, when the code review was last updated.

        • Type (string) --

          The type of the code review.

        • PullRequestId (string) --

          The pull request ID for the code review.

        • MetricsSummary (dict) --

          The statistics from the code review.

          • MeteredLinesOfCodeCount (integer) --

            Lines of code metered in the code review.

          • FindingsCount (integer) --

            Total number of recommendations found in the code review.

    • NextToken (string) --

      Pagination token.

ListRecommendationFeedback (new) Link ¶

Lists the customer feedback for a CodeGuru Reviewer recommendation for all users. This API will be used from the console to extract the previously given feedback by the user to pre-populate the feedback emojis for all recommendations.

See also: AWS API Documentation

Request Syntax

client.list_recommendation_feedback(
    NextToken='string',
    MaxResults=123,
    CodeReviewArn='string',
    UserIds=[
        'string',
    ],
    RecommendationIds=[
        'string',
    ]
)
type NextToken

string

param NextToken

If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.

type MaxResults

integer

param MaxResults

The maximum number of results that are returned per call. The default is 100.

type CodeReviewArn

string

param CodeReviewArn

[REQUIRED]

The Amazon Resource Name (ARN) that identifies the code review.

type UserIds

list

param UserIds

Filter on userIds that need to be applied before displaying the result. This can be used to query all the recommendation feedback for a code review from a given user.

  • (string) --

type RecommendationIds

list

param RecommendationIds

Filter on recommendationIds that need to be applied before displaying the result. This can be used to query all the recommendation feedback for a given recommendation.

  • (string) --

rtype

dict

returns

Response Syntax

{
    'RecommendationFeedbackSummaries': [
        {
            'RecommendationId': 'string',
            'Reactions': [
                'ThumbsUp'|'ThumbsDown',
            ],
            'UserId': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • RecommendationFeedbackSummaries (list) --

      Recommendation feedback summaries corresponding to the code reivew ARN.

      • (dict) --

        Information about recommendation feedback summaries.

        • RecommendationId (string) --

          The recommendation ID that can be used to track the provided recommendations. Later on it can be used to collect the feedback.

        • Reactions (list) --

          List for storing reactions. Reactions are utf-8 text code for emojis.

          • (string) --

        • UserId (string) --

          The identifier for the user that gave the feedback.

    • NextToken (string) --

      If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.