|
17 | 17 | from . import gists
|
18 | 18 | from .issues import ShortIssue, Issue, issue_params
|
19 | 19 | from .models import GitHubCore
|
20 |
| -from .orgs import Membership, ShortOrganization, Organization, Team |
| 20 | +from .orgs import Membership, ShortOrganization, Organization |
21 | 21 | from .projects import Project, ProjectCard, ProjectColumn
|
22 | 22 | from .pulls import PullRequest
|
23 | 23 | from .repos import repo
|
24 | 24 | from .search import (CodeSearchResult, IssueSearchResult,
|
25 | 25 | RepositorySearchResult, UserSearchResult)
|
26 | 26 | from .structs import SearchIterator
|
| 27 | +from . import orgs |
27 | 28 | from . import users
|
28 | 29 | from .notifications import Thread
|
29 | 30 | from .licenses import License
|
@@ -828,9 +829,22 @@ def me(self):
|
828 | 829 |
|
829 | 830 | @requires_auth
|
830 | 831 | def membership_in(self, organization):
|
831 |
| - """Retrieve the user's membership in the specified organization.""" |
832 |
| - url = self._build_url('user', 'memberships', 'orgs', |
833 |
| - str(organization)) |
| 832 | + """Retrieve the user's membership in the specified organization. |
| 833 | +
|
| 834 | + :param organization: |
| 835 | + the organization or organization login to retrieve the authorized |
| 836 | + user's membership in |
| 837 | + :type organization: |
| 838 | + str |
| 839 | + :type organization: |
| 840 | + :class:`~github3.orgs.Organization` |
| 841 | + :returns: |
| 842 | + the user's membership |
| 843 | + :rtype: |
| 844 | + :class:`~github3.orgs.Membership` |
| 845 | + """ |
| 846 | + organization_name = getattr(organization, 'login', organization) |
| 847 | + url = self._build_url('user', 'memberships', 'orgs', organization_name) |
834 | 848 | json = self._json(self._get(url), 200)
|
835 | 849 | return self._instance_or_null(Membership, json)
|
836 | 850 |
|
@@ -1708,10 +1722,13 @@ def user_teams(self, number=-1, etag=None):
|
1708 | 1722 | authenticated user belongs. This method requires user or repo scope
|
1709 | 1723 | when authenticating via OAuth.
|
1710 | 1724 |
|
1711 |
| - :returns: generator of :class:`Team <github3.orgs.Team>` objects |
| 1725 | + :returns: |
| 1726 | + generator of teams |
| 1727 | + :rtype: |
| 1728 | + :class:`~github3.orgs.ShortTeam` |
1712 | 1729 | """
|
1713 | 1730 | url = self._build_url('user', 'teams')
|
1714 |
| - return self._iter(int(number), url, Team, etag=etag) |
| 1731 | + return self._iter(int(number), url, orgs.ShortTeam, etag=etag) |
1715 | 1732 |
|
1716 | 1733 | def user_with_id(self, number):
|
1717 | 1734 | """Get the user's information with id ``number``.
|
|
0 commit comments