1717//----------------------------------------------------------------------
1818
1919
20+ using System ;
2021using RestSharp ;
2122using csharp_github_api . Models ;
2223using System . Collections . Generic ;
@@ -48,22 +49,6 @@ public UserApi(string baseUrl, IAuthenticator authenticator) : base(baseUrl, aut
4849 {
4950 }
5051
51- /// <summary>
52- /// If the user is authenticated, authenticated instance of the <see cref="UserApi"/> class.
53- /// If the user is not authenticated then an unauthenticated instance is returned.
54- /// </summary>
55- /// <returns>An authenticated instance of the <see cref="UserApi"/> class.</returns>
56- public UserApi Authenticated ( )
57- {
58- if ( Authenticator != null )
59- {
60- Client = GetRestClient ( ) ;
61- Client . Authenticator = Authenticator ;
62- }
63-
64- return this ;
65- }
66-
6752 /// <summary>
6853 /// Gets the specified user from GitHub.
6954 /// </summary>
@@ -82,6 +67,7 @@ public User GetUser(string username)
8267 var response = Client . Execute < User > ( request ) ;
8368
8469 var user = response . Data ;
70+ user . UserApi = this ;
8571
8672 return user ;
8773 }
@@ -127,12 +113,23 @@ public User FindUserByEmail(string email)
127113 return response . Data ;
128114 }
129115
116+ internal UserApi Authenticated ( )
117+ {
118+ if ( Authenticator != null )
119+ {
120+ Client = GetRestClient ( ) ;
121+ Client . Authenticator = Authenticator ;
122+ }
123+
124+ return this ;
125+ }
126+
130127 /// <summary>
131128 /// Gets a list of the users that the specified user is following.
132129 /// </summary>
133130 /// <param name="user">The <see cref="User"/> to get the following list for.</param>
134131 /// <returns>A list of the users (username only) that the specified user is following.</returns>
135- public IList < string > GetFollowing ( User user )
132+ internal IList < string > GetFollowing ( User user )
136133 {
137134 return GetFollowing ( user . Login ) ;
138135 }
@@ -142,7 +139,7 @@ public IList<string> GetFollowing(User user)
142139 /// </summary>
143140 /// <param name="username">The username to get the following list for.</param>
144141 /// <returns>A list of the users (username only) that the specified user is following.</returns>
145- public IList < string > GetFollowing ( string username )
142+ internal IList < string > GetFollowing ( string username )
146143 {
147144 if ( Client == null ) Client = GetRestClient ( ) ;
148145
@@ -162,7 +159,7 @@ public IList<string> GetFollowing(string username)
162159 /// </summary>
163160 /// <param name="user">The <see cref="User"/> to get the list of followers for.</param>
164161 /// <returns>A string list containing the (username only) list of users who are followers of the specified user.</returns>
165- public IList < string > GetFollowers ( User user )
162+ internal IList < string > GetFollowers ( User user )
166163 {
167164 return GetFollowers ( user . Login ) ;
168165 }
@@ -172,7 +169,7 @@ public IList<string> GetFollowers(User user)
172169 /// </summary>
173170 /// <param name="username">The user to get the list of followers for.</param>
174171 /// <returns>A string list containing the (username only) list of users who are followers of the specified user.</returns>
175- public IList < string > GetFollowers ( string username )
172+ internal IList < string > GetFollowers ( string username )
176173 {
177174 if ( Client == null ) Client = GetRestClient ( ) ;
178175
@@ -187,5 +184,10 @@ public IList<string> GetFollowers(string username)
187184
188185 return response . Data ;
189186 }
187+
188+ internal bool Follow ( string username )
189+ {
190+ throw new NotImplementedException ( ) ;
191+ }
190192 }
191193}
0 commit comments