Skip to content

Added 'user/repos' missing endpoint #472

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 3 commits into from
Dec 11, 2016
Merged

Conversation

seferov
Copy link
Contributor

@seferov seferov commented Nov 22, 2016

List repositories that are accessible to the authenticated user.

https://developer.github.com/v3/repos/#list-your-repositories

On the other hand, I think, repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc') method is outdated since affiliation and visibility options are not covered

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.

I like the idea but I'm not happy with the option parameter, especially since it's undocumented.

'type' => $type,
'sort' => $sort,
'direction' => $direction
));
}

/**
* @param null $username
* @param array $options
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should explain the valid array keys.

Copy link
Contributor

Choose a reason for hiding this comment

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

or better add in-code assert

*/
public function repos($username = null, array $options = array())
{
$url = $username ? '/users/'.rawurldecode($username).'/repos' : '/user/repos';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm. This seams like two functions mixed in one method. I'm not 100% convinced. It may be better to "repos()" and "myRepos()" (but with better naming)

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no other API endpoint that we are using an optional username. I recommend using two functions.

@seferov
Copy link
Contributor Author

seferov commented Nov 24, 2016

@Nyholm I don't agree with you about undocumented options since new options can be added as happened in this case, and the library has to be updated for each change. And also nearly all of the methods in the library can be considered as undocumented; see $params.

On the other hand, I think splitting repos into two methods idea is reasonable.

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.

Okey, fair. Do not document it.

This is the last issue before (I think) we can tag a release candidate.

@@ -145,6 +145,8 @@ public function subscriptions($username)
}

/**
* @deprecated use repos($username, $options) instead
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should remove this function. It is okey, we will soon release a new major version.

Please make sure to add this in the changelog.

*/
public function repos($username = null, array $options = array())
{
$url = $username ? '/users/'.rawurldecode($username).'/repos' : '/user/repos';
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no other API endpoint that we are using an optional username. I recommend using two functions.

@Nyholm Nyholm mentioned this pull request Dec 9, 2016
*
* @return array list of the user repositories
*/
public function repos($username = null, array $options = array())
Copy link
Contributor

Choose a reason for hiding this comment

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

you should use short array syntax []

@seferov
Copy link
Contributor Author

seferov commented Dec 10, 2016

@Nyholm @cursedcoder can you review it?

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.

I like it!

@cursedcoder cursedcoder merged commit 4dd10ea into KnpLabs:master Dec 11, 2016
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.

3 participants