From 933af01d05d0e3407f98d0d0a01ad5fc68de1535 Mon Sep 17 00:00:00 2001 From: Vincent Jacques Date: Sun, 12 Feb 2012 21:11:37 +0100 Subject: [PATCH] User.get_followers and .get_following --- IntegrationTest.py | 2 ++ Reference.md | 8 ++++---- github/GithubObjects.py | 5 +++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/IntegrationTest.py b/IntegrationTest.py index 7d429d14..e78a4654 100644 --- a/IntegrationTest.py +++ b/IntegrationTest.py @@ -16,6 +16,8 @@ def dumpUser( u ): print print " Watched:", ", ".join( r.name for r in u.get_watched() ) print " Organizations:", ", ".join( o.login for o in u.get_orgs() ) + print " Following:", ", ".join( f.login for f in u.get_following() ) + print " Followers:", ", ".join( f.login for f in u.get_followers() ) print def dumpOrganization( o ): diff --git a/Reference.md b/Reference.md index 4e57e874..d09e405e 100644 --- a/Reference.md +++ b/Reference.md @@ -399,11 +399,11 @@ /user/followers =============== - - GET: `` (TODO) + - GET: `AuthenticatedUser.get_followers()` : list of `NamedUser` /user/following =============== - - GET: `` (TODO) + - GET: `AuthenticatedUser.get_following()` : list of `NamedUser` /user/following/:user ===================== @@ -459,11 +459,11 @@ /users/:user/followers ====================== - - GET: `` (TODO) + - GET: `NamedUser.get_followers()` : list of `NamedUser` /users/:user/following ====================== - - GET: `` (TODO) + - GET: `NamedUser.get_following()` : list of `NamedUser` /users/:user/gists ================== diff --git a/github/GithubObjects.py b/github/GithubObjects.py index eca97b08..21aca302 100644 --- a/github/GithubObjects.py +++ b/github/GithubObjects.py @@ -23,6 +23,11 @@ NamedUser = GithubObject( ), ) +AuthenticatedUser._addAttributePolicy( ExtendedListAttribute( "followers", NamedUser ) ) +NamedUser._addAttributePolicy( ExtendedListAttribute( "followers", NamedUser ) ) +AuthenticatedUser._addAttributePolicy( ExtendedListAttribute( "following", NamedUser ) ) +NamedUser._addAttributePolicy( ExtendedListAttribute( "following", NamedUser ) ) + Organization = GithubObject( "Organization", BaseUrl( lambda obj: "/orgs/" + obj.login ),