Add the context-padding parameter to the comment context

This parameter allows padding the context lines with extra lines before
and after the comment range. This parameter works only if the
enable-context parameter is set to true.

This change is backward compatible: if the new parameter is not set or
set to zero, only the lines of the comment range are returned.

Change-Id: I2d44fb852c68ba484cbf94adff912b7ee522f9c5
This commit is contained in:
Youssef Elghareeb
2021-02-05 18:53:05 +01:00
parent abfec19e6d
commit 87b7450210
11 changed files with 159 additions and 18 deletions

View File

@@ -413,6 +413,7 @@ public interface ChangeApi {
abstract class CommentsRequest {
private boolean enableContext;
private int contextPadding;
/**
* Get all published comments on a change.
@@ -436,6 +437,11 @@ public interface ChangeApi {
return this;
}
public CommentsRequest contextPadding(int contextPadding) {
this.contextPadding = contextPadding;
return this;
}
public CommentsRequest withContext() {
this.enableContext = true;
return this;
@@ -444,6 +450,10 @@ public interface ChangeApi {
public boolean getContext() {
return enableContext;
}
public int getContextPadding() {
return contextPadding;
}
}
abstract class SuggestedReviewersRequest {