2020
2121package com .spotify .github .v3 .clients ;
2222
23- import java .io .InputStreamReader ;
24- import java .io .Reader ;
25- import java .lang .invoke .MethodHandles ;
26- import java .util .Iterator ;
27- import java .util .List ;
28- import java .util .Map ;
29- import static java .util .Objects .isNull ;
30- import java .util .concurrent .CompletableFuture ;
31-
32- import javax .ws .rs .core .HttpHeaders ;
33-
34- import org .slf4j .Logger ;
35- import org .slf4j .LoggerFactory ;
36-
37- import com .google .common .base .Strings ;
38- import com .google .common .collect .ImmutableMap ;
39- import com .spotify .github .async .AsyncPage ;
4023import static com .spotify .github .v3 .clients .GitHubClient .IGNORE_RESPONSE_CONSUMER ;
4124import static com .spotify .github .v3 .clients .GitHubClient .LIST_COMMIT_TYPE_REFERENCE ;
25+ import static com .spotify .github .v3 .clients .GitHubClient .LIST_FILE_ITEMS ;
4226import static com .spotify .github .v3 .clients .GitHubClient .LIST_PR_TYPE_REFERENCE ;
4327import static com .spotify .github .v3 .clients .GitHubClient .LIST_REVIEW_REQUEST_TYPE_REFERENCE ;
4428import static com .spotify .github .v3 .clients .GitHubClient .LIST_REVIEW_TYPE_REFERENCE ;
29+ import static java .util .Objects .isNull ;
30+
31+ import com .google .common .base .Strings ;
32+ import com .google .common .collect .ImmutableMap ;
33+ import com .spotify .github .async .AsyncPage ;
34+ import com .spotify .github .v3 .git .FileItem ;
4535import com .spotify .github .v3 .prs .Comment ;
4636import com .spotify .github .v3 .prs .MergeParameters ;
4737import com .spotify .github .v3 .prs .PullRequest ;
5444import com .spotify .github .v3 .prs .requests .PullRequestParameters ;
5545import com .spotify .github .v3 .prs .requests .PullRequestUpdate ;
5646import com .spotify .github .v3 .repos .CommitItem ;
47+ import java .io .InputStreamReader ;
48+ import java .io .Reader ;
49+ import java .lang .invoke .MethodHandles ;
50+ import java .util .Iterator ;
51+ import java .util .List ;
52+ import java .util .Map ;
53+ import java .util .concurrent .CompletableFuture ;
54+ import javax .ws .rs .core .HttpHeaders ;
55+ import org .slf4j .Logger ;
56+ import org .slf4j .LoggerFactory ;
5757
5858/** Pull call API client */
5959public class PullRequestClient {
@@ -63,6 +63,7 @@ public class PullRequestClient {
6363 private static final String PR_NUMBER_TEMPLATE = "/repos/%s/%s/pulls/%s" ;
6464 private static final String PR_COMMITS_TEMPLATE = "/repos/%s/%s/pulls/%s/commits" ;
6565 private static final String PR_REVIEWS_TEMPLATE = "/repos/%s/%s/pulls/%s/reviews" ;
66+ private static final String PR_CHANGED_FILES_TEMPLATE = "/repos/%s/%s/pulls/%s/files" ;
6667 private static final String PR_REVIEW_REQUESTS_TEMPLATE =
6768 "/repos/%s/%s/pulls/%s/requested_reviewers" ;
6869 private static final String PR_COMMENT_REPLIES_TEMPLATE =
@@ -449,6 +450,11 @@ public CompletableFuture<Reader> diff(final long prNumber) {
449450 });
450451 }
451452
453+ public Iterator <AsyncPage <FileItem >> changedFiles (final long prNumber ) {
454+ final String path = String .format (PR_CHANGED_FILES_TEMPLATE , owner , repo , prNumber );
455+ return new GithubPageIterator <>(new GithubPage <>(github , path , LIST_FILE_ITEMS ));
456+ }
457+
452458 /**
453459 * List pull requests using given parameters.
454460 *
0 commit comments