예제 #1
0
 /// <summary>
 /// Checks if the ClutterFeed user is following the target
 /// </summary>
 /// <param name="twitter">An authorized twitter service object</param>
 /// <param name="targetScreenName">@name of the target</param>
 /// <returns></returns>
 public static bool IsFollowing(string targetScreenName)
 {
     GetFriendshipInfoOptions friendOpts = new GetFriendshipInfoOptions();
     friendOpts.SourceScreenName = userScreenName;
     friendOpts.TargetScreenName = targetScreenName;
     TwitterFriendship friend = User.Account.GetFriendshipInfo(friendOpts);
     try
     {
         return friend.Relationship.Source.Following;
     }
     catch (NullReferenceException)
     {
         return false; /* If twitter doesn't give me anything, they're probably not friends */
     } /* Fingers crossed */
 }
		public virtual void GetFriendshipInfo(GetFriendshipInfoOptions options, Action<TwitterFriendship, TwitterResponse> action)
		{
			var source_id = options.SourceId;
			var source_screen_name = options.SourceScreenName;
			var target_id = options.TargetId;
			var target_screen_name = options.TargetScreenName;
			
			WithHammock(action, "friendships/show", FormatAsString, "?source_id=", source_id, "&source_screen_name=", source_screen_name, "&target_id=", target_id, "&target_screen_name=", target_screen_name);
		}
		public virtual IAsyncResult BeginGetFriendshipInfo(GetFriendshipInfoOptions options)
		{
			var source_id = options.SourceId;
			var source_screen_name = options.SourceScreenName;
			var target_id = options.TargetId;
			var target_screen_name = options.TargetScreenName;
				

			return BeginWithHammock<TwitterFriendship>(WebMethod.Get, "friendships/show", FormatAsString, "?source_id=", source_id, "&source_screen_name=", source_screen_name, "&target_id=", target_id, "&target_screen_name=", target_screen_name);
		}
		public virtual Task<TwitterResponse<TwitterFriendship>> GetFriendshipInfoAsync(GetFriendshipInfoOptions options)
		{
			var source_id = options.SourceId;
			var source_screen_name = options.SourceScreenName;
			var target_id = options.TargetId;
			var target_screen_name = options.TargetScreenName;
				
			
			return ExecuteRequest<TwitterFriendship>("friendships/show", FormatAsString, "?source_id=", source_id, "&source_screen_name=", source_screen_name, "&target_id=", target_id, "&target_screen_name=", target_screen_name);
		}
		public virtual Task<TwitterAsyncResult<TwitterFriendship>> GetFriendshipInfoAsync(GetFriendshipInfoOptions options)
		{
			var source_id = options.SourceId;
			var source_screen_name = options.SourceScreenName;
			var target_id = options.TargetId;
			var target_screen_name = options.TargetScreenName;
			
			return WithHammockTask<TwitterFriendship>(_client, "friendships/show", FormatAsString, "?source_id=", source_id, "&source_screen_name=", source_screen_name, "&target_id=", target_id, "&target_screen_name=", target_screen_name);
		}