-
-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added missing /repos/{owner}/{repo}/pulls/... handlers (#546) #605
Conversation
…_number}/reviews/{review_id})
…s/{pull_number}/reviews/{review_id}/events
src/api/pulls.rs
Outdated
/// creates a builder for the `/repos/{owner}/{repo}/pulls/{pull_number}/......` endpoint | ||
/// working with particular pull request, e.g. | ||
/// * /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events | ||
/// * /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} | ||
/// * /repos/{owner}/{repo}/pulls/{pull_number}/commits | ||
/// * /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments | ||
/// * /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals | ||
/// * /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies | ||
/// | ||
pub fn pull_number(&self, pull_nr: u64) -> SpecificPullRequestBuilder { | ||
SpecificPullRequestBuilder::new(self, pull_nr) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of having a specific builder for this, we should instead mimic octokit here, and have each of these methods attached to the pulls
builder, and have the pull number as a required argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far it is looking like
octocrab.pulls("owner", "repo")
.pull_number(42)
.reviews()
.review(42).get()
octocrab.pulls("owner", "repo")
.pull_number(42)
.reviews()
.review(42).update("this is a new body")
octocrab.pulls("owner", "repo")
.pull_number(42)
.comment(CommentId(42))
.reply("new comment")
octocrab.pulls("owner", "repo")
.pull_number(42)
.reviews().review(42)
.list_comments()
.per_page(10)
.page(3u32)
.send()
How do you prefer it? Octokit does it like
[ManualRoute("GET", "/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments")]
public Task<IReadOnlyList<PullRequestReviewComment>> GetAllComments(string owner, string name, int number, long reviewId, ApiOptions options)
so we would have
-=1=-
octocrab.pulls("owner", "repo")
.get_all_comments(/*pr_nr*/ 42, /*review_nr*/ 42)
.per_page(10)
.page(3u32)
.send()
or even
-=2=-
octocrab.pulls("owner", "repo")
.get_all_comments(/*pr_nr*/ 42, /*review_nr*/ 42, /*pagination*/ PagingOptions{...})
?
IMHO, in absence of named arguments, the following options are more readable:
- Builder pattern;
- Struct parameter.
Anyways, I sense we go with -=1=- (to retain Octocrab pagination style)? TIA @XAMPPRocky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, 1, I just mean removing the pull_number
builder and having the pr number as the first argument in these calls. Keeping the other builders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@XAMPPRocky please check if it suits: 377342b
Thank you for your PR! |
/// /repos/{owner}/{repo}/pulls/{pull_number}/commits | ||
// pub fn pr_commits(&self, pull_nr: u64) -> SpecificPullRequestCommentBuilder<'octo, '_> { | ||
// SpecificPullRequestCommentBuilder::new(self, pull_nr, 0) | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please take a look at #680
solves #546