10000 Support for Repository.collaborators with permissions and affiliation. · Issue #730 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content
8000

Support for Repository.collaborators with permissions and affiliation. #730

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

Closed
AndreasBackx opened this issue Sep 16, 2017 · 0 comments
Closed

Comments

@AndreasBackx
Copy link
Contributor
AndreasBackx commented Sep 16, 2017

Currently there is a Repository.collaborators method, but the User objects it returns do not use the added permissions key that the endpoint returns:

"permissions": {
  "pull": true,
  "push": true,
  "admin": false
}

What I would propose is to add repos/collaborator.py or remain to use users.py with a Collaborator class that inherits from _User and let _User use the permissions in _update_attributes:

self.permissions = self._get_attribute(user, 'permissions')

What I notice while writing this issue, is that _User does not user self._get_attribute. Maybe this can be added in the same commit, just for completeness sake so it's used everywhere as it was intended iirc.

We can also add the named parameter affiliation to Repository.collaborators(). It'll throw a ValueError when the value is not valid (not in ['outside', 'direct', 'all'], perhaps None as well based on the default value). Do we give affiliation the default value of None or the default value of 'all' like it is in the documentation? None would not pass anything and therefore if it were to get changed on GitHub's end, the result will be different. I'd go for 'all'.

I'm up for creating the PR once we agree on what needs to be changed.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

AndreasBackx added a commit to AndreasBackx/github3.py that referenced this issue Sep 18, 2017
…ion).

See sigmavirus24#730 for some background information. This still fails 1 test because the
cassette Repository_collaborators.json needs to be updated with the
permissions as it somehow does not contain that information. The GitHub API
does say that it should be there, but the recording is from 2014 so perhaps it
wasn't returned back then.

Note that I have currently put the named parameter `affiliation` at the front
of the arguments in `Repository.collaborators`. I did this to be in line with
the other similar iterators. This can be moved to the back, but I assume some
backwards-incompatible changes are fine for 1.0.0?

This uses separate classes for the specific User object uses as I understood
the idea was from sigmavirus24#670.
AndreasBackx added a commit to AndreasBackx/github3.py that referenced this issue Apr 8, 2018
…ion).

See sigmavirus24#730 for some background information. This still fails 1 test because the
cassette Repository_collaborators.json needs to be updated with the
permissions as it somehow does not contain that information. The GitHub API
does say that it should be there, but the recording is from 2014 so perhaps it
wasn't returned back then.

Note that I have currently put the named parameter `affiliation` at the front
of the arguments in `Repository.collaborators`. I did this to be in line with
the other similar iterators. This can be moved to the back, but I assume some
backwards-incompatible changes are fine for 1.0.0?

This uses separate classes for the specific User object uses as I understood
the idea was from sigmavirus24#670.
AndreasBackx added a commit to AndreasBackx/github3.py that referenced this issue Apr 8, 2018
…ion).

See sigmavirus24#730 for some background information.

Note that I have currently put the named parameter `affiliation` at the front
of the arguments in `Repository.collaborators`. I did this to be in line with
the other similar iterators. This can be moved to the back, but I assume some
backwards-incompatible changes are fine for 1.0.0?

This uses separate classes for the specific User object uses as I understood
the idea was from sigmavirus24#670.
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

No branches or pull requests

1 participant
0