TryGetUserValueDictionary ( String sScreenName, RequestStatistics oRequestStatistics, Boolean bIgnoreWebAndJsonExceptions, out Dictionary <String, Object> oUserValueDictionary ) { Debug.Assert(!String.IsNullOrEmpty(sScreenName)); Debug.Assert(oRequestStatistics != null); AssertValid(); oUserValueDictionary = null; String sUrl = String.Format( "{0}users/show.json?screen_name={1}&{2}" , TwitterApiUrls.Rest, TwitterUtil.EncodeUrlParameter(sScreenName), TwitterApiUrlParameters.IncludeEntities ); ReportProgress(String.Format( "Getting information about \"{0}\"." , sScreenName )); try { oUserValueDictionary = (Dictionary <String, Object>) (new JavaScriptSerializer()).DeserializeObject( GetTwitterResponseAsString(sUrl, oRequestStatistics)); return(true); } catch (Exception oException) { if (!HttpSocialNetworkUtil.ExceptionIsWebOrJson(oException) || !bIgnoreWebAndJsonExceptions) { throw oException; } return(false); } }
EnumerateFriendOrFollowerIDs ( String sScreenName, Boolean bEnumerateFriendIDs, Int32 iMaximumPeoplePerRequest, RequestStatistics oRequestStatistics ) { Debug.Assert(!String.IsNullOrEmpty(sScreenName)); Debug.Assert(iMaximumPeoplePerRequest > 0); Debug.Assert(oRequestStatistics != null); AssertValid(); String sUrl = String.Format( "{0}{1}.json?screen_name={2}" , TwitterApiUrls.Rest, bEnumerateFriendIDs ? "friends/ids" : "followers/ids", TwitterUtil.EncodeUrlParameter(sScreenName) ); // The JSON looped through here has an "ids" name whose value is an // array of integer IDs. foreach (Object oUserIDAsObject in EnumerateJsonValues( sUrl, "ids", iMaximumPeoplePerRequest, true, oRequestStatistics)) { String sUserID; if (TwitterJsonUtil.TryConvertJsonValueToString( oUserIDAsObject, out sUserID)) { yield return(sUserID); } } }