20
20
21
21
package com .spotify .github .v3 .clients ;
22
22
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 ;
40
23
import static com .spotify .github .v3 .clients .GitHubClient .IGNORE_RESPONSE_CONSUMER ;
41
24
import static com .spotify .github .v3 .clients .GitHubClient .LIST_COMMIT_TYPE_REFERENCE ;
25
+ import static com .spotify .github .v3 .clients .GitHubClient .LIST_FILE_ITEMS ;
42
26
import static com .spotify .github .v3 .clients .GitHubClient .LIST_PR_TYPE_REFERENCE ;
43
27
import static com .spotify .github .v3 .clients .GitHubClient .LIST_REVIEW_REQUEST_TYPE_REFERENCE ;
44
28
import 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 ;
45
35
import com .spotify .github .v3 .prs .Comment ;
46
36
import com .spotify .github .v3 .prs .MergeParameters ;
47
37
import com .spotify .github .v3 .prs .PullRequest ;
54
44
import com .spotify .github .v3 .prs .requests .PullRequestParameters ;
55
45
import com .spotify .github .v3 .prs .requests .PullRequestUpdate ;
56
46
import 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 ;
57
57
58
58
/** Pull call API client */
59
59
public class PullRequestClient {
@@ -63,6 +63,7 @@ public class PullRequestClient {
63
63
private static final String PR_NUMBER_TEMPLATE = "/repos/%s/%s/pulls/%s" ;
64
64
private static final String PR_COMMITS_TEMPLATE = "/repos/%s/%s/pulls/%s/commits" ;
65
65
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" ;
66
67
private static final String PR_REVIEW_REQUESTS_TEMPLATE =
67
68
"/repos/%s/%s/pulls/%s/requested_reviewers" ;
68
69
private static final String PR_COMMENT_REPLIES_TEMPLATE =
@@ -449,6 +450,11 @@ public CompletableFuture<Reader> diff(final long prNumber) {
449
450
});
450
451
}
451
452
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
+
452
458
/**
453
459
* List pull requests using given parameters.
454
460
*
0 commit comments