Commits

Ian Cordasco committed b1ef671

Removed a few list_ methods

Comments (0)

Files changed (3)

   - repository now returns a tuple of the login and name of the repository it 
     belongs to
 
+- In github3.notifications.Thread
+
+  - is_unread() and unread are now the same
+
+- github3.orgs.Organization.iter_repos now accepts all types_
+
+- list_* methods on Organization objects that were missed are now deleted
+
 - Some objects now have ``__str__`` methods. You can now do things like:
 
   ::
   - github3.users.RepoTag (uses the tag name)
   - github3.users.Contents (uses the decoded content)
 
+.. _types: http://developer.github.com/v3/repos/#list-organization-repositories
+
 0.2: 2012-11-21
 ---------------
 

github3/notifications.py

         #: Subject of the Notification, e.g., which issue/pull/diff is this in
         #: relation to. This is a dictionary
         self.subject = notif.get('subject')
-        self._unread = notif.get('unread')
+        self.unread = notif.get('unread')
 
     def __repr__(self):
         return '<Thread [{0}]>'.format(self.subject.get('title'))
 
     def is_unread(self):
         """Tells you if the thread is unread or not."""
-        return self._unread
+        return self.unread
 
     def mark(self):
         """Mark the thread as read.
         url = self._build_url('members', base_url=self._api)
         return self._iter(int(number), url, User)
 
-    def list_members(self):
-        """List the members of this team.
-
-        :returns: list of :class:`User <github3.users.User>`\ s
-        """
-        url = self._build_url('members', base_url=self._api)
-        json = self._json(self._get(url), 200)
-        return [User(m, self) for m in json]
-
     def iter_repos(self, number=-1):
         """Iterate over the repositories this team has access to.
 
         url = self._build_url('repos', base_url=self._api)
         return self._iter(int(number), url, Repository)
 
-    def list_repos(self):
-        """List the repositories this team has access to.
-
-        :returns: list of :class:`Repository <github3.repos.Repository>`
-            objects
-        """
-        url = self._build_url('repos', base_url=self._api)
-        json = self._json(self._get(url), 200)
-        return [Repository(r, self) for r in json]
-
     @requires_auth
     def remove_member(self, login):
         """Remove ``login`` from this team.
     def __repr__(self):
         return '<Organization [{0}:{1}]>'.format(self.login, self.name)
 
-    def _list_members(self, tail):
-        """List members of this organization."""
-        url = self._api + tail
-        json = self._json(self._get(url), 200)
-        return [User(memb, self) for memb in json]
-
     @requires_auth
     def add_member(self, login, team):
         """Add ``login`` to ``team`` and thereby to this organization.
         :param str team: (required), team name
         :returns: bool
         """
-        teams = self.list_teams()
-        for t in teams:
+        for t in self.iter_teams():
             if team == t.name:
                 return t.add_member(login)
         return False
         :param str repo: (required), form: 'user/repo'
         :param str team: (required)
         """
-        teams = self.list_teams()
-        for t in teams:
+        for t in self.iter_teams():
             if team == t.name:
                 return t.add_repo(repo)
         return False
         url = self._build_url('events', base_url=self._api)
         return self._iter(int(number), url, Event)
 
-    def list_events(self):
-        """List events for this org.
-
-        :returns: list of :class:`Event <github3.events.Event>`\ s
-        """
-        url = self._build_url('events', base_url=self._api)
-        json = self._json(self._get(url), 200)
-        return [Event(e, self._session) for e in json]
-
     def iter_members(self, number=-1):
         """Iterate over members of this organization.
 
         url = self._build_url('members', base_url=self._api)
         return self._iter(int(number), url, User)
 
-    def list_members(self):
-        """List members of this organization.
-
-        :returns: list of :class:`User <github3.users.User>`\ s
-        """
-        return self._list_members('/members')
-
     def iter_public_members(self, number=-1):
         """Iterate over public members of this organization.
 
         url = self._build_url('public_members', base_url=self._api)
         return self._iter(int(number), url, User)
 
-    def list_public_members(self):
-        """List public members of this organization.
-
-        :returns: list of :class:`User <github3.users.User>`\ s
-        """
-        return self._list_members('/public_members')
-
     def iter_repos(self, type='', number=-1):
         """Iterate over repos for this organization.
 
         :param str type: (optional), accepted values:
-            ('all', 'public', 'member', 'private'), API default: 'all'
+            ('all', 'public', 'member', 'private', 'forks', 'sources'), API
+            default: 'all'
         :param int number: (optional), number of members to return. Default:
             -1 will return all available.
         :returns: generator of :class:`Repository <github3.repos.Repository>`
         """
         url = self._build_url('repos', base_url=self._api)
-        if type in ('all', 'public', 'member', 'private'):
-            url = '{0}?type={1}'.format(url, type)
-        return self._iter(int(number), url, Repository)
-
-    def list_repos(self, type=''):
-        """List repos for this organization.
-
-        :param str type: (optional), accepted values:
-            ('all', 'public', 'member', 'private'), API default: 'all'
-        :returns: list of :class:`Repository <github3.repos.Repository>`
-            objects
-        """
-        url = self._build_url('repos', base_url=self._api)
         params = {}
-        if type in ('all', 'public', 'member', 'private'):
+        if type in ('all', 'public', 'member', 'private', 'forks', 'sources'):
             params['type'] = type
-        json = self._json(self._get(url, params=params), 200)
-        return [Repository(r, self) for r in json]
+        return self._iter(int(number), url, Repository, params)
 
     @requires_auth
     def iter_teams(self, number=-1):
         return self._iter(int(number), url, Team)
 
     @requires_auth
-    def list_teams(self):
-        """List teams that are part of this organization.
-
-        :returns: list of :class:`Team <Team>`\ s
-        """
-        url = self._build_url('teams', base_url=self._api)
-        json = self._json(self._get(url), 200)
-        return [Team(team, self) for team in json]
-
-    @requires_auth
     def publicize_member(self, login):
         """Make ``login``'s membership in this organization public.
 
         :param str team: (required)
         :returns: bool
         """
-        teams = self.list_teams()
-        for t in teams:
+        for t in self.iter_teams():
             if team == t.name:
                 return t.remove_repo(repo)
         return False