/// <summary>
        /// Allows the authenticating users to follow the user specified in the userName parameter.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="userName">The user name.</param>
        /// <param name="options">The options.</param>   
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The callback function.</param>        
        public static IAsyncResult Create(OAuthTokens tokens, string userName, CreateFriendshipOptions options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
        {
            Func<OAuthTokens, string, CreateFriendshipOptions, TwitterResponse<TwitterUser>> methodToCall = TwitterFriendship.Create;

            return methodToCall.BeginInvoke(
                tokens,
                userName,
                options,
                result => 
                {
                    result.AsyncWaitHandle.WaitOne(timeout);
                    try
                    {
                        function(methodToCall.EndInvoke(result).ToAsyncResponse());
                    }
                    catch (Exception ex)
                    {
                        function(new TwitterAsyncResponse<TwitterUser>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
                    }
                },
                null);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userName parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userName">The user name.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the followed user in the requested format when successful.
 /// </returns>
 public static TwitterResponse <TwitterUser> Create(OAuthTokens tokens, string userName, CreateFriendshipOptions options)
 {
     Commands.CreateFriendshipCommand command = new Commands.CreateFriendshipCommand(tokens, userName, options);
     return(CommandPerformer.PerformAction(command));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userName parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userName">The user name.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the followed user in the requested format when successful.
 /// </returns>
 public static TwitterResponse<TwitterUser> Create(OAuthTokens tokens, string userName, CreateFriendshipOptions options)
 {
     Commands.CreateFriendshipCommand command = new Commands.CreateFriendshipCommand(tokens, userName, options);
     return CommandPerformer.PerformAction(command);
 }
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userName parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userName">The user name.</param>
 /// <param name="options">The options.</param>   
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback function.</param>        
 public static IAsyncResult Create(OAuthTokens tokens, string userName, CreateFriendshipOptions options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, userName, options, timeout, TwitterFriendship.Create, function);
 }
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userName parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userName">The user name.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the followed user in the requested format when successful.
 /// </returns>
 public static async Task<TwitterResponse<User>> CreateAsync(string userName, OAuthTokens tokens, CreateFriendshipOptions options)
 {
     return await CommandPerformer.PerformAction(new Commands.CreateFriendshipCommand(tokens, userName, options));
 }
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userID parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userId">The user id.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the followed user in the requested format when successful.
 /// </returns>
 public static async Task<TwitterResponse<User>> CreateAsync(decimal userId, OAuthTokens tokens, CreateFriendshipOptions options = null)
 {
     return await CommandPerformer.PerformAction(new Commands.CreateFriendshipCommand(tokens, userId, options));
 }
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userName parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userName">The user name.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback function.</param>
 public static IAsyncResult Create(OAuthTokens tokens, string userName, CreateFriendshipOptions options, TimeSpan timeout, Action <TwitterAsyncResponse <TwitterUser> > function)
 {
     return(AsyncUtility.ExecuteAsyncMethod(tokens, userName, options, timeout, TwitterFriendship.Create, function));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userID parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userId">The user id.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the followed user in the requested format when successful.
 /// </returns>
 public static TwitterResponse<TwitterUser> Create(OAuthTokens tokens, decimal userId, CreateFriendshipOptions options)
 {
     Commands.CreateFriendshipCommand command = new Commands.CreateFriendshipCommand(tokens, userId, options);
     return CommandPerformer<TwitterUser>.PerformAction(command);
 }
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userName parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userName">The user name.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the followed user in the requested format when successful.
 /// </returns>
 public static async Task <TwitterResponse <User> > CreateAsync(string userName, OAuthTokens tokens, CreateFriendshipOptions options)
 {
     return(await CommandPerformer.PerformAction(new Commands.CreateFriendshipCommand(tokens, userName, options)));
 }
 /// <summary>
 /// Allows the authenticating users to follow the user specified in the userID parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userId">The user id.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the followed user in the requested format when successful.
 /// </returns>
 public static async Task <TwitterResponse <User> > CreateAsync(decimal userId, OAuthTokens tokens, CreateFriendshipOptions options = null)
 {
     return(await CommandPerformer.PerformAction(new Commands.CreateFriendshipCommand(tokens, userId, options)));
 }