Skip to content

Add support for fetching statuses #565

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 7 commits into from
Apr 14, 2017
Merged

Conversation

slaughter550
Copy link
Contributor

No description provided.

@@ -58,6 +58,13 @@ public function files($username, $repository, $id)
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files');
}

public function status($username, $repository, $id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add method doc here? And also a link to the github documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I didn't see it for the ones above so I wasn't sure if you were requiring it or not

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do add it.

@@ -58,6 +58,13 @@ public function files($username, $repository, $id)
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files');
}

public function status($username, $repository, $id)
{
$link = $this->show($username, $repository, $id)['_links']['statuses']['href'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah. So this is just an helper method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it just to help get the status response for a PR since its URL is built from a SHA instead of the PR Number like all of the other URLs

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.

Im not sure we want something in the API client that is not an endpoint in the API server.
However, I understand that that this function helps DX. What does @cursedcoder coder think?


Before this PR can be merged we need a unit test that proves correctness.

@@ -58,6 +58,13 @@ public function files($username, $repository, $id)
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls/'.rawurlencode($id).'/files');
}

public function status($username, $repository, $id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do add it.

@cursedcoder
Copy link
Contributor

@Nyholm seems legit for me, if it doesn't influence the code too much and takes only few strings it makes sense

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 12, 2017

Good.

@slaughter550 could you address my comments and make sure the build is green?

@slaughter550
Copy link
Contributor Author

@Nyholm addressed feedback

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.

Pro tip: Try not to change style fixes in the existing code. This makes the PR harder to review.

*/
public function status($username, $repository, $id)
{
$link = $this->show($username, $repository, $id)['_links']['statuses']['href'];
Copy link
Collaborator

Choose a reason for hiding this comment

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

What would happen if $this->show() failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would throw an http error same as it would if you called that method directly. It either passes and returns the given response or it fails and the whole chain blows up. According the the GitHub api those array keys are guaranteed

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good

@slaughter550
Copy link
Contributor Author

I made the style changes because the StyleCI was complaining about a bunch of stuff and it was unclear what was a suggestion and what was making it fail.

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 14, 2017

Okey, I see. Thank you for this PR.

@Nyholm Nyholm merged commit 63325b7 into KnpLabs:master Apr 14, 2017
@GrahamCampbell
Copy link
Contributor

I made the style changes because the StyleCI was complaining about a bunch of stuff and it was unclear what was a suggestion and what was making it fail.

StyleCI never makes soft suggestions. If it ever suggests something, it can be applied, in fact, applied automatically. It is capable of PRing/committing the changes on its own.

@slaughter550
Copy link
Contributor Author

slaughter550 commented Apr 16, 2017

@GrahamCampbell thanks for the info! Still new to StyleCI

@Nyholm how often do you guys do version releases?

Also when I try to install the v2.x packages I get this

    - knplabs/github-api 2.2.0 requires php-http/client-implementation ^1.0 -> no matching package found.
    - knplabs/github-api 2.1.0 requires php-http/client-implementation ^1.0 -> no matching package found.
    - knplabs/github-api 2.0.1 requires php-http/client-implementation ^1.0 -> no matching package found.
    - knplabs/github-api 2.0.0 requires php-http/client-implementation ^1.0 -> no matching package found.

Is that expected?

@Nyholm
Copy link
Collaborator

Nyholm commented Apr 18, 2017

We have no outlined release plan. I was waiting to release 2.3 because it was some PR I really wanted to include. But I think we are all done now, I'll see to a release today.

About the installation errors. Have a look in our readme: https://github.com/KnpLabs/php-github-api#autoload and https://github.com/KnpLabs/php-github-api/blob/master/doc/customize.md

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.

5 participants