Skip to content

add support for the pull request reviews API #517

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

Merged
merged 1 commit into from
Feb 7, 2017

Conversation

xabbuh
Copy link
Contributor

@xabbuh xabbuh commented Jan 31, 2017

No description provided.

@xabbuh xabbuh mentioned this pull request Jan 31, 2017
@@ -127,7 +127,7 @@ public function __construct(Builder $httpClientBuilder = null, $apiVersion = nul
)));

$this->apiVersion = $apiVersion ?: 'v3';
$builder->addHeaders(['Accept' => sprintf('application/vnd.github.%s+json', $this->apiVersion)]);
$builder->addHeaderValue('Accept', sprintf('application/vnd.github.%s+json', $this->apiVersion));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise we wouldn't be able to add the custom Accept header value without having to repeat Accept header values passed by this builder.

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 1, 2017

@m1guelpf Can you explain why this would break Laravel Github?

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 1, 2017

@m1guelpf I don't see why that should break. Which error message do you get?

@m1guelpf
Copy link
Contributor

m1guelpf commented Feb 1, 2017

@xabbuh Forget it, I reinstalled everything and now it works.

Copy link
Collaborator

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I think it all looks good. I just had some minor things.

Is there any reson why you left Get comments for single review for a future update?

return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($pullRequest).'/comments');
}

return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/comments');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not really a part of the PR, right?

Let's keep it anyways (for this time)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it's there to allow https://developer.github.com/v3/pulls/comments/#list-comments-in-a-repository which is not directly related to the reviews, but needed if you want to fully leverage the reviews API. But I can move it to its own PR nonetheless. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okey, I stand corrected.

Lets keep it.

/**
* Get a listing of a pull request's reviews by the username, repository and pull request number.
*
* @link http://developer.github.com/v3/pulls/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**
* Get a single pull request review by the username, repository, pull request number and the review id.
*
* @link http://developer.github.com/v3/pulls/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*
* @param string $username the username
* @param string $repository the repository
* @param array $pullRequest the pull request number
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be int.

*
* @param string $username the username
* @param string $repository the repository
* @param array $pullRequest the pull request number
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be int.

*
* @param string $username the username
* @param string $repository the repository
* @param array $pullRequest the pull request number
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int

/**
* Submit a pull request review by the username, repository, pull request number and the review id.
*
* @link http://developer.github.com/v3/pulls/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*
* @param string $username the username
* @param string $repository the repository
* @param array $pullRequest the pull request number
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int

/**
* Dismiss a pull request review by the username, repository, pull request number and the review id.
*
* @link http://developer.github.com/v3/pulls/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*
* @param string $username the username
* @param string $repository the repository
* @param array $pullRequest the pull request number
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 2, 2017

Is there any reson why you left Get comments for single review for a future update?

Oh no, that was not intended, but just an oversight. I'll look into it tonight.

@xabbuh
Copy link
Contributor Author

xabbuh commented Feb 3, 2017

I changed the comments() method to ask the API for the comments of a particular pull request review. Previously, it return an instance of the Comments API class. Though that's not really necessary and rather redundant as the PullRequest API already allows to access it through its comments() method.

@Nyholm
Copy link
Collaborator

Nyholm commented Feb 7, 2017

Thank you @xabbuh for this well tested PR.

Thanks @m1guelpf for the review.

@Nyholm Nyholm merged commit 20eb870 into KnpLabs:master Feb 7, 2017
@xabbuh xabbuh deleted the review-api branch February 7, 2017 10:08
@sstok
Copy link
Contributor

sstok commented Feb 11, 2017

There is still one bug (I think), changing the headers doesn't reset the HttpClient with $this->httpClientModified = true;

@Nyholm
Copy link
Collaborator

Nyholm commented Feb 23, 2017

Thank you @sstok. This is fixed in #529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants