/// <summary>
        /// Gets the rate limiting status status for the authenticated user.
        /// </summary>
        /// <param name="tokens">The OAuth tokens.</param>
        /// <param name="options">The options.</param>
        /// <returns>
        /// A <see cref="TwitterRateLimitStatus"/> instance.
        /// </returns>
        public static TwitterResponse<TwitterRateLimitStatus> GetStatus(OAuthTokens tokens, OptionalProperties options)
        {
            Commands.RateLimitStatusCommand command = new Twitterizer.Commands.RateLimitStatusCommand(tokens, options);
            TwitterResponse<TwitterRateLimitStatus> result = Core.CommandPerformer.PerformAction(command);

            return result;
        }
        /// <summary>
        /// Deletes this direct message.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="options">The options.</param>
        /// <returns>
        /// A <see cref="TwitterDirectMessage"/> instance.
        /// </returns>
        public TwitterResponse <TwitterDirectMessage> Delete(OAuthTokens tokens, OptionalProperties options)
        {
            Commands.DeleteDirectMessageCommand command = new Commands.DeleteDirectMessageCommand(tokens, this.Id, options);

            TwitterResponse <TwitterDirectMessage> result = Core.CommandPerformer.PerformAction(command);

            return(result);
        }
Esempio n. 3
0
 /// <summary>
 /// Unsubscribes the authenticated user from the specified list.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="listId">The list id.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public static IAsyncResult UnSubscribe(
     OAuthTokens tokens,
     decimal listId,
     OptionalProperties options,
     TimeSpan timeout,
     Action <TwitterAsyncResponse <TwitterList> > function)
 {
     return(AsyncUtility.ExecuteAsyncMethod(tokens, listId, options, timeout, TwitterList.UnSubscribe, function));
 }
Esempio n. 4
0
 /// <summary>
 /// Creates a new list for the authenticated user. Accounts are limited to 20 lists.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="name">The name.</param>
 /// <param name="isPublic">if set to <c>true</c> [is public].</param>
 /// <param name="description">The description.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult New(
     OAuthTokens tokens,
     string name,
     bool isPublic,
     string description,
     OptionalProperties options,
     TimeSpan timeout,
     Action <TwitterAsyncResponse <TwitterList> > function)
 {
     return(AsyncUtility.ExecuteAsyncMethod(tokens, name, isPublic, description, options, timeout, TwitterList.New, function));
 }
Esempio n. 5
0
 /// <summary>
 /// Removes the specified member from the list. The authenticated user must be the list's owner to remove members from the list.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="ownerUsername">The owner username.</param>
 /// <param name="listId">The list id.</param>
 /// <param name="userIdToAdd">The user id to add.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult RemoveMember(
     OAuthTokens tokens,
     string ownerUsername,
     string listId,
     decimal userIdToAdd,
     OptionalProperties options,
     TimeSpan timeout,
     Action <TwitterAsyncResponse <TwitterList> > function)
 {
     return(AsyncUtility.ExecuteAsyncMethod(tokens, ownerUsername, listId, userIdToAdd, options, timeout, TwitterList.AddMember, function));
 }
        /// <summary>
        /// Sends a new direct message to the specified user from the authenticating user.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="text">The text.</param>
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static IAsyncResult Send(OAuthTokens tokens, decimal userId, string text, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterDirectMessage>> function)
        {
            Func<OAuthTokens, decimal, string, OptionalProperties, TwitterResponse<TwitterDirectMessage>> methodToCall = TwitterDirectMessage.Send;

            return methodToCall.BeginInvoke(
                tokens,
                userId,
                text,
                options,
                result => AsyncUtility.ThreeParamsCallback(result, timeout, methodToCall, function),
                null);
        }
Esempio n. 7
0
        /// <summary>
        /// Check if a user is a member of the specified list.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="ownerUsername">The owner username.</param>
        /// <param name="listId">The list id.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static IAsyncResult CheckMembership(OAuthTokens tokens, string ownerUsername, string listId, decimal userId, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
        {
            Func<OAuthTokens, string, string, decimal, OptionalProperties, TwitterResponse<TwitterUser>> methodToCall = TwitterList.CheckMembership;

            return methodToCall.BeginInvoke(
                tokens,
                ownerUsername,
                listId,
                userId,
                options,
                result => AsyncUtility.FourParamsCallback(result, timeout, methodToCall, function),
                null);
        }
Esempio n. 8
0
        public void RequestGetDirectMessageNew(string screen_name, string text, Action<TwitterDirectMessage> action)
        {
            OptionalProperties option = new OptionalProperties();
            option.APIBaseAddress = Whisper.Properties.Settings.Default.APIBaseAddress;

            TwitterResponse<TwitterUser> showUserResponse = TwitterUser.Show(_tokens, screen_name, option);
            if (showUserResponse.Result == RequestResult.Success)
            {
                TwitterResponse<TwitterDirectMessage> response = TwitterDirectMessage.Send(_tokens, showUserResponse.ResponseObject.Id, text, option);
                if (response.Result == RequestResult.Success)
                {
                    action(response.ResponseObject);
                }
            }
        }
        /// <summary>
        /// Gets the rate limiting status status for the authenticated user asynchronously.
        /// </summary>
        /// <param name="tokens">The OAuth tokens.</param>
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The callback or anonymous funtion.</param>
        /// <returns>
        /// A <see cref="TwitterRateLimitStatus"/> instance.
        /// </returns>
        public static IAsyncResult GetStatus(OAuthTokens tokens, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterRateLimitStatus>> function)
        {
            Func<OAuthTokens, OptionalProperties, TwitterResponse<TwitterRateLimitStatus>> methodToCall = TwitterRateLimitStatus.GetStatus;

            return methodToCall.BeginInvoke(
                tokens,
                options,
                result => 
                {
                    result.AsyncWaitHandle.WaitOne(timeout);
                    try
                    {
                        function(methodToCall.EndInvoke(result).ToAsyncResponse());
                    }
                    catch (Exception ex)
                    {
                        function(new TwitterAsyncResponse<TwitterRateLimitStatus>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
                    }
                },
                null);
        }
Esempio n. 10
0
                /// <summary>
        /// Blocks the user and reports them for spam/abuse.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="screenName">The users screenName.</param>
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static IAsyncResult ReportUser(OAuthTokens tokens, string screenName, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
        {
            Func<OAuthTokens, string, OptionalProperties, TwitterResponse<TwitterUser>> methodToCall = TwitterSpam.ReportUser;

            return methodToCall.BeginInvoke(
                tokens,
                screenName,
                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);
        }
        /// <summary>
        /// Deletes the saved search specified in the ID parameter as the authenticating user.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="statusId">The saved search id.</param>
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static IAsyncResult Delete(OAuthTokens tokens, decimal savedsearchId, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterSavedSearch>> function)
        {
            Func<OAuthTokens, decimal, OptionalProperties, TwitterResponse<TwitterSavedSearch>> methodToCall = TwitterSavedSearch.Delete;

            return methodToCall.BeginInvoke(
                tokens,
                savedsearchId,
                options,
                result =>
                {
                    result.AsyncWaitHandle.WaitOne(timeout);
                    try
                    {
                        function(methodToCall.EndInvoke(result).ToAsyncResponse());
                    }
                    catch (Exception ex)
                    {
                        function(new TwitterAsyncResponse<TwitterSavedSearch>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
                    }
                },
                null);
        }
Esempio n. 12
0
        /// <summary>
        /// Check if a user is a member of the specified list.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="ownerUsername">The owner username.</param>
        /// <param name="listId">The list id.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static IAsyncResult CheckMembership(OAuthTokens tokens, string ownerUsername, string listId, decimal userId, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
        {
            Func<OAuthTokens, string, string, decimal, OptionalProperties, TwitterResponse<TwitterUser>> methodToCall = TwitterList.CheckMembership;

            return methodToCall.BeginInvoke(
                tokens,
                ownerUsername,
                listId,
                userId,
                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);
        }
Esempio n. 13
0
 /// <summary>
 /// Allows the authenticating users to unfollow the user specified in the ID parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userName">The username.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the unfollowed user in the requested format when successful.
 /// </returns>
 public static TwitterResponse <TwitterUser> Delete(OAuthTokens tokens, string userName, OptionalProperties options)
 {
     Commands.DeleteFriendshipCommand command = new Commands.DeleteFriendshipCommand(tokens, 0, userName, options);
     return(Core.CommandPerformer.PerformAction(command));
 }
Esempio n. 14
0
 /// <summary>
 /// Unsubscribes the authenticated user from the specified list.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="listId">The list id.</param>
 /// <param name="optionalProperties">The optional properties.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public static async Task <TwitterResponse <TwitterList> > UnSubscribeAsync(decimal listId, OAuthTokens tokens, OptionalProperties optionalProperties = null)
 {
     return(await Core.CommandPerformer.PerformAction(new Commands.DestroyListSubscriber(tokens, listId, optionalProperties)));
 }
Esempio n. 15
0
 /// <summary>
 /// Returns the specified list. Private lists will only be shown if the authenticated user owns the specified list.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="listId">The list id.</param>
 /// <param name="options">The options. Leave null for defaults.</param>
 /// <returns>A <see cref="TwitterList"/> instance.</returns>
 public static async Task <TwitterResponse <TwitterList> > ShowAsync(decimal listId, OAuthTokens tokens, OptionalProperties options = null)
 {
     return(await Core.CommandPerformer.PerformAction(new Twitterizer.Commands.GetListCommand(tokens, string.Empty, listId, options)));
 }
        /// <summary>
        /// Updates the authenticating user's profile image.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="imageData">The image data.</param>
        /// <param name="options">The options.</param>
        /// <returns>
        /// The user, with updated data, as a <see cref="TwitterUser"/>
        /// </returns>
        public static TwitterResponse <TwitterUser> UpdateProfileImage(OAuthTokens tokens, byte[] imageData, OptionalProperties options = null)
        {
            Commands.UpdateProfileImageCommand command = new Twitterizer.Commands.UpdateProfileImageCommand(tokens, imageData, options);

            return(CommandPerformer.PerformAction(command));
        }
Esempio n. 17
0
 /// <summary>
 /// Returns a collection of IDs that the user does not want to see retweets from.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="options">The options.</param>
 /// <returns></returns>
 public static TwitterResponse<UserIdCollection> NoRetweetIDs(OAuthTokens tokens, OptionalProperties options)
 {
     Commands.NoRetweetIDsCommand command = new Commands.NoRetweetIDsCommand(tokens, options);
     return Core.CommandPerformer.PerformAction(command);
 }
Esempio n. 18
0
        /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="Common"]/*'/>
        /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="ByUsernameWithTokensAndOptions"]/*'/>
        public static TwitterResponse<TwitterUser> Show(OAuthTokens tokens, string username, OptionalProperties options)
        {
            Commands.ShowUserCommand command = new Commands.ShowUserCommand(tokens, 0, username, options);

            return Core.CommandPerformer.PerformAction(command);
        }
Esempio n. 19
0
 /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="Common"]/*'/>
 /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="ByUsernameWithTokensAndOptions"]/*'/>
 public static async Task<TwitterResponse<TwitterUser>> ShowAsync(string username, OAuthTokens tokens = null, OptionalProperties options = null)
 {
     return await Core.CommandPerformer.PerformAction(new Commands.ShowUserCommand(tokens, 0, username, options));
 }                
 /// <summary>
 /// Updates the authenticating user's profile image. Note that this method expects raw multipart data, not a URL to an image.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="imageLocation">The image location.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback or anonymous funtion.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public static IAsyncResult UpdateProfileImage(OAuthTokens tokens, string imageLocation, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function, OptionalProperties options = null)
 {
     return UpdateProfileImage(tokens, System.IO.File.ReadAllBytes(imageLocation), timeout, function, options);
 }
Esempio n. 21
0
        /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="Common"]/*'/>
        /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="ByIDWithTokensAndOptions"]/*'/>
        public static TwitterResponse<TwitterUser> Show(OAuthTokens tokens, decimal id, OptionalProperties options)
        {
            Commands.ShowUserCommand command = new Commands.ShowUserCommand(tokens, id, string.Empty, options);

            return Core.CommandPerformer.PerformAction(command);
        }
 /// <summary>
 /// Blocks the user specified as the authenticating user. Destroys a friendship to the blocked user if it exists.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="screenName">The user's screen name.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult Create(OAuthTokens tokens, string screenName, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, screenName, options, timeout, TwitterBlock.Create, function);
 }
 /// <summary>
 /// Returns an collection of user ids the authenticating user is blocking.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult BlockingIds(OAuthTokens tokens, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterIdCollection>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, options, timeout, TwitterBlock.BlockingIds, function);
 }
 /// <summary>
 /// Checks for a block against the the user specified as the authenticating user.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userId">The user id.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult Exists(OAuthTokens tokens, decimal userId, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, userId, options, timeout, TwitterBlock.Exists, function);
 }
Esempio n. 25
0
        /// <summary>
        /// Returns detailed information about the relationship between two users.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="sourceUseId">The source user id.</param>
        /// <param name="targetUserId">The target user id.</param>
        /// <param name="options">The options.</param>
        /// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
        public static TwitterResponse <TwitterRelationship> Show(OAuthTokens tokens, decimal sourceUseId, decimal targetUserId, OptionalProperties options)
        {
            Commands.ShowFriendshipCommand command = new Twitterizer.Commands.ShowFriendshipCommand(
                tokens,
                sourceUseId,
                string.Empty,
                targetUserId,
                string.Empty,
                options);

            return(Core.CommandPerformer.PerformAction(command));
        }
 /// <summary>
 /// Gets the rate limiting status status for the authenticated user.
 /// </summary>
 /// <param name="tokens">The OAuth tokens.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult GetStatus(OAuthTokens tokens, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterRateLimitStatus>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, options, timeout, TwitterRateLimitStatus.GetStatus, function);
 }
Esempio n. 27
0
        /// <summary>
        /// Returns detailed information about the relationship between two users.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="sourceUserName">The source user name.</param>
        /// <param name="targetUserName">The target user name.</param>
        /// <param name="options">The options.</param>
        /// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
        public static TwitterResponse <TwitterRelationship> Show(OAuthTokens tokens, string sourceUserName, string targetUserName, OptionalProperties options)
        {
            Commands.ShowFriendshipCommand command = new Twitterizer.Commands.ShowFriendshipCommand(tokens, 0, sourceUserName, 0, targetUserName, options);

            return(Core.CommandPerformer.PerformAction(command));
        }
Esempio n. 28
0
 /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="Common"]/*'/>
 /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="ByIDWithTokensAndOptions"]/*'/>
 public static async Task<TwitterResponse<User>> ShowAsync(decimal id, OAuthTokens tokens = null, OptionalProperties options = null)
 {
     return await Core.CommandPerformer.PerformAction(new Commands.ShowUserCommand(tokens, id, string.Empty, options));
 }        
 /// <summary>
 /// Updates the authenticating user's profile image. Note that this method expects raw multipart data, not a URL to an image.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="imageLocation">The image location.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback or anonymous funtion.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public static IAsyncResult UpdateProfileImage(OAuthTokens tokens, string imageLocation, TimeSpan timeout, Action <TwitterAsyncResponse <TwitterUser> > function, OptionalProperties options = null)
 {
     return(UpdateProfileImage(tokens, System.IO.File.ReadAllBytes(imageLocation), timeout, function, options));
 }
 /// <summary>
 /// Returns detailed information about the relationship between two users.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="targetUserName">The target 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 Show(OAuthTokens tokens, string targetUserName, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterRelationship>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, targetUserName, options, timeout, TwitterFriendship.Show, function);
 }
Esempio n. 31
0
        /// <summary>
        /// Returns detailed information about the relationship between two users.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="sourceUserName">The source user name.</param>
        /// <param name="targetUserName">The target user name.</param>
        /// <param name="options">The options.</param>
        /// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
        public static TwitterResponse<TwitterRelationship> Show(OAuthTokens tokens, string sourceUserName, string targetUserName, OptionalProperties options)
        {
            Commands.ShowFriendshipCommand command = new Twitterizer.Commands.ShowFriendshipCommand(tokens, 0, sourceUserName, 0, targetUserName, options);

            return Core.CommandPerformer.PerformAction(command);
        }
Esempio n. 32
0
 /// <summary>
 /// Deletes the specified list. Must be owned by the authenticated user.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="username">The username.</param>
 /// <param name="listIdOrSlug">The list id or slug.</param>
 /// <param name="options">The options. Leave null for defaults.</param>
 /// <returns>A <see cref="TwitterList"/> instance.</returns>
 public static async Task <TwitterResponse <TwitterList> > DeleteAsync(OAuthTokens tokens, string username, string listIdOrSlug, OptionalProperties options = null)
 {
     return(await Core.CommandPerformer.PerformAction(new Twitterizer.Commands.DeleteListCommand(tokens, username, listIdOrSlug, options)));
 }
 /// <summary>
 /// Updates the authenticating user's profile image. Note that this method expects raw multipart data, not a URL to an image.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="imageData">The image data.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback or anonymous funtion.</param>
 /// <param name="options">The options.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public static IAsyncResult UpdateProfileImage(OAuthTokens tokens, byte[] imageData, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function, OptionalProperties options = null)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, imageData, options, timeout, TwitterAccount.UpdateProfileImage, function);
 }
 /// <summary>
 /// Updates the authenticating user's profile image.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="imageLocation">The image location.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// The user, with updated data, as a <see cref="TwitterUser"/>
 /// </returns>
 public static TwitterResponse <TwitterUser> UpdateProfileImage(OAuthTokens tokens, string imageLocation, OptionalProperties options = null)
 {
     return(UpdateProfileImage(tokens, System.IO.File.ReadAllBytes(imageLocation), options));
 }
Esempio n. 35
0
 /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="Common"]/*'/>
 /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="ByIDWithOptions"]/*'/>
 public static TwitterResponse<TwitterUser> Show(decimal id, OptionalProperties options)
 {
     return Show(null, id, options);
 }
Esempio n. 36
0
 /// <summary>
 /// Returns the 20 most recent statuses, including retweets if they exist, from non-protected users. The public timeline is cached for 60 seconds.
 /// </summary>
 /// <param name="options">The properties.</param>
 /// <returns>
 /// A <see cref="TwitterStatusCollection"/>.
 /// </returns>
 public static TwitterResponse<TwitterStatusCollection> PublicTimeline(OptionalProperties options)
 {
     return PublicTimeline(null, options);
 }
Esempio n. 37
0
 /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="Common"]/*'/>
 /// <include file='TwitterUser.xml' path='TwitterUser/Show[@name="ByUsernameWithOptions"]/*'/>
 public static TwitterResponse<TwitterUser> Show(string username, OptionalProperties options)
 {
     return Show(null, username, options);
 }
Esempio n. 38
0
        /// <summary>
        /// Returns the 20 most recent statuses, including retweets if they exist, from non-protected users. The public timeline is cached for 60 seconds.
        /// </summary>
        /// <param name="tokens">The oauth tokens.</param>
        /// <param name="options">The options.</param>
        /// <returns>A <see cref="TwitterStatusCollection"/>.</returns>
        /// <remarks></remarks>
        public static TwitterResponse<TwitterStatusCollection> PublicTimeline(OAuthTokens tokens, OptionalProperties options)
        {
            Commands.PublicTimelineCommand command = new Commands.PublicTimelineCommand(tokens, options);
            TwitterResponse<TwitterStatusCollection> result = CommandPerformer.PerformAction(command);

            return result;
        }
 /// <summary>
 /// Gets the public timeline.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult PublicTimeline(OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterStatusCollection>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(null, options, timeout, TwitterTimeline.PublicTimeline, function);
 }
Esempio n. 40
0
 /// <summary>
 /// Returns a single status, with user information, specified by the id parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="statusId">The status id.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The function.</param>
 /// <returns></returns>
 public static IAsyncResult Show(OAuthTokens tokens, decimal statusId, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterStatus>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, statusId, options, timeout, TwitterStatus.Show, function);
 }
        /// <summary>
        /// Sends a new direct message to the specified user from the authenticating user.
        /// </summary>
        /// <param name="tokens">The OAuth tokens.</param>
        /// <param name="screenName">The user's screen name.</param>
        /// <param name="text">The message text.</param>
        /// <param name="options">The options.</param>
        /// <returns>A <see cref="TwitterDirectMessage"/> object of the created direct message.</returns>
        public static TwitterResponse <TwitterDirectMessage> Send(OAuthTokens tokens, string screenName, string text, OptionalProperties options)
        {
            Commands.SendDirectMessageCommand command = new Commands.SendDirectMessageCommand(tokens, text, screenName, options);

            TwitterResponse <TwitterDirectMessage> result = Core.CommandPerformer.PerformAction(command);

            return(result);
        }
        /// <summary>
        /// Sends a new direct message to the specified user from the authenticating user.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="userId">The user id.</param>
        /// <param name="text">The text.</param>
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The function.</param>
        /// <returns></returns>
        public static IAsyncResult Send(OAuthTokens tokens, decimal userId, string text, OptionalProperties options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterDirectMessage>> function)
        {
            Func<OAuthTokens, decimal, string, OptionalProperties, TwitterResponse<TwitterDirectMessage>> methodToCall = TwitterDirectMessage.Send;

            return methodToCall.BeginInvoke(
                tokens,
                userId,
                text,
                options,
                result =>
                {
                    result.AsyncWaitHandle.WaitOne(timeout);
                    try
                    {
                        function(methodToCall.EndInvoke(result).ToAsyncResponse());
                    }
                    catch (Exception ex)
                    {
                        function(new TwitterAsyncResponse<TwitterDirectMessage>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
                    }
                },
                null);
        }
        /// <summary>
        /// Returns a single direct message, specified by an id parameter. Like the /1/direct_messages.format request, this method will include the user objects of the sender and recipient.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="id">The id.</param>
        /// <param name="options">The options.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public static TwitterResponse <TwitterDirectMessage> Show(OAuthTokens tokens, decimal id, OptionalProperties options)
        {
            Commands.ShowDirectMessageCommand command = new Commands.ShowDirectMessageCommand(tokens, id, options);

            return(Core.CommandPerformer.PerformAction(command));
        }
Esempio n. 44
0
 /// <summary>
 /// Creates the saved search specified in the query parameter as the authenticating user.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="query">The query.</param>
 /// <param name="options">The options.</param>
 /// <returns>The saved search when successful.</returns>
 public static TwitterResponse <TwitterSavedSearch> Create(OAuthTokens tokens, string query, OptionalProperties options)
 {
     return(CommandPerformer.PerformAction(
                new Commands.CreateSavedSearchCommand(tokens, query, options)));
 }
Esempio n. 45
0
 /// <summary>
 /// Creates a new list for the authenticated user. Accounts are limited to 20 lists.
 /// </summary>
 /// <param name="tokens">The oauth tokens.</param>
 /// <param name="name">The list name.</param>
 /// <param name="isPublic">if set to <c>true</c> creates a public list.</param>
 /// <param name="description">The description.</param>
 /// <param name="options">The options. Leave null for defaults.</param>
 /// <returns>A <see cref="TwitterList"/> instance.</returns>
 public static async Task <TwitterResponse <TwitterList> > NewAsync(OAuthTokens tokens, string name, bool isPublic, string description, OptionalProperties options = null)
 {
     return(await Core.CommandPerformer.PerformAction(new Twitterizer.Commands.CreateListCommand(tokens, name, options)
     {
         IsPublic = isPublic,
         Description = description
     }));
 }
Esempio n. 46
0
 /// <summary>
 /// Deletes the saved search specified in the ID parameter as the authenticating user.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="savedsearchId">The saved search id.</param>
 /// <param name="options">The options.</param>
 /// <returns>The deleted saved search in the requested format when successful.</returns>
 public static TwitterResponse <TwitterSavedSearch> Delete(OAuthTokens tokens, decimal savedsearchId, OptionalProperties options)
 {
     return(CommandPerformer.PerformAction(
                new Commands.DeleteSavedSearchCommand(tokens, savedsearchId, options)));
 }
Esempio n. 47
0
 /// <summary>
 /// Removes the specified member from the list. The authenticated user must be the list's owner to remove members from the list.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="ownerUsername">The username of the list owner.</param>
 /// <param name="listId">The list id.</param>
 /// <param name="userIdToRemove">The user id to add.</param>
 /// <param name="options">The options. Leave null for defaults.</param>
 /// <returns>
 /// A <see cref="TwitterList"/> representing the list the user was added to, or <c>null</c>.
 /// </returns>
 public static async Task <TwitterResponse <TwitterList> > RemoveMemberAsync(string listId, string ownerUsername, decimal userIdToAdd, OAuthTokens tokens, OptionalProperties options = null)
 {
     return(await Core.CommandPerformer.PerformAction(new Twitterizer.Commands.RemoveListMemberCommand(tokens, ownerUsername, listId, userIdToAdd, options)));
 }
Esempio n. 48
0
 /// <summary>
 /// Returns the the authenticating user's saved search queries in the requested format.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="options">The options.</param>
 /// <returns>The saved searches</returns>
 public static TwitterResponse <TwitterSavedSearchCollection> SavedSearches(OAuthTokens tokens, OptionalProperties options)
 {
     return(CommandPerformer.PerformAction(
                new Commands.SavedSearchesCommand(tokens, options)));
 }
Esempio n. 49
0
 /// <summary>
 /// Allows the authenticating users to unfollow the user specified in the ID parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userId">The user id.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the unfollowed user in the requested format when successful.
 /// </returns>
 public static TwitterResponse <TwitterUser> Delete(OAuthTokens tokens, decimal userId, OptionalProperties options)
 {
     Commands.DeleteFriendshipCommand command = new Commands.DeleteFriendshipCommand(tokens, userId, string.Empty, options);
     return(CommandPerformer.PerformAction(command));
 }
Esempio n. 50
0
 /// <summary>
 /// Returns the the authenticating user's saved search queries in the requested format.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <returns>The saved searches</returns>
 public static TwitterResponse <TwitterSavedSearchCollection> SavedSearches(OptionalProperties options)
 {
     return(SavedSearches(null, options));
 }
Esempio n. 51
0
 /// <summary>
 /// Returns detailed information about the relationship between two users.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="targetUserId">The target user id.</param>
 /// <param name="options">The options.</param>
 /// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
 public static TwitterResponse <TwitterRelationship> Show(OAuthTokens tokens, decimal targetUserId, OptionalProperties options)
 {
     return(Show(tokens, 0, targetUserId, options));
 }
Esempio n. 52
0
 /// <summary>
 /// Allows the authenticating users to unfollow the user specified in the ID parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userId">The user id.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the unfollowed user in the requested format when successful.
 /// </returns>
 public static TwitterResponse<TwitterUser> Delete(OAuthTokens tokens, decimal userId, OptionalProperties options)
 {
     Commands.DeleteFriendshipCommand command = new Commands.DeleteFriendshipCommand(tokens, userId, string.Empty, options);
     return CommandPerformer.PerformAction(command);
 }
Esempio n. 53
0
 /// <summary>
 /// Returns detailed information about the relationship between two users.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="targetUserName">The target user name.</param>
 /// <param name="options">The options.</param>
 /// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
 public static TwitterResponse <TwitterRelationship> Show(OAuthTokens tokens, string targetUserName, OptionalProperties options)
 {
     return(Show(tokens, string.Empty, targetUserName, options));
 }
Esempio n. 54
0
 /// <summary>
 /// Allows the authenticating users to unfollow the user specified in the ID parameter.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="userName">The username.</param>
 /// <param name="options">The options.</param>
 /// <returns>
 /// Returns the unfollowed user in the requested format when successful.
 /// </returns>
 public static TwitterResponse<TwitterUser> Delete(OAuthTokens tokens, string userName, OptionalProperties options)
 {
     Commands.DeleteFriendshipCommand command = new Commands.DeleteFriendshipCommand(tokens, 0, userName, options);
     return Core.CommandPerformer.PerformAction(command);
 }
Esempio n. 55
0
 /// <summary>
 /// Returns a collection of IDs that the user does not want to see retweets from.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="options">The options.</param>
 /// <returns></returns>
 public static TwitterResponse <UserIdCollection> NoRetweetIDs(OAuthTokens tokens, OptionalProperties options)
 {
     Commands.NoRetweetIDsCommand command = new Commands.NoRetweetIDsCommand(tokens, options);
     return(Core.CommandPerformer.PerformAction(command));
 }
Esempio n. 56
0
 /// <summary>
 /// Returns detailed information about the relationship between two users.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="targetUserId">The target user id.</param>
 /// <param name="options">The options.</param>
 /// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
 public static TwitterResponse<TwitterRelationship> Show(OAuthTokens tokens, decimal targetUserId, OptionalProperties options)
 {
     return Show(tokens, 0, targetUserId, options);
 }
 /// <summary>
 /// Gets the rate limiting status status for the authenticated user asynchronously.
 /// </summary>
 /// <param name="tokens">The OAuth tokens.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback or anonymous funtion.</param>
 /// <returns>
 /// A <see cref="TwitterRateLimitStatus"/> instance.
 /// </returns>
 public static IAsyncResult GetStatus(OAuthTokens tokens, OptionalProperties options, TimeSpan timeout, Action <TwitterAsyncResponse <TwitterRateLimitStatus> > function)
 {
     return(AsyncUtility.ExecuteAsyncMethod(tokens, options, timeout, TwitterRateLimitStatus.GetStatus, function));
 }
Esempio n. 58
0
        /// <summary>
        /// Returns detailed information about the relationship between two users.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="sourceUseId">The source user id.</param>
        /// <param name="targetUserId">The target user id.</param>
        /// <param name="options">The options.</param>
        /// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
        public static TwitterResponse<TwitterRelationship> Show(OAuthTokens tokens, decimal sourceUseId, decimal targetUserId, OptionalProperties options)
        {
            Commands.ShowFriendshipCommand command = new Twitterizer.Commands.ShowFriendshipCommand(
                tokens, 
                sourceUseId, 
                string.Empty, 
                targetUserId, 
                string.Empty, 
                options);

            return Core.CommandPerformer.PerformAction(command);
        }
 /// <summary>
 /// Updates the authenticating user's profile image. Note that this method expects raw multipart data, not a URL to an image.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="imageData">The image data.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback or anonymous funtion.</param>
 /// <param name="options">The options.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public static IAsyncResult UpdateProfileImage(OAuthTokens tokens, byte[] imageData, TimeSpan timeout, Action <TwitterAsyncResponse <TwitterUser> > function, OptionalProperties options = null)
 {
     return(AsyncUtility.ExecuteAsyncMethod(tokens, imageData, options, timeout, TwitterAccount.UpdateProfileImage, function));
 }
Esempio n. 60
0
 /// <summary>
 /// Returns detailed information about the relationship between two users.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="targetUserName">The target user name.</param>
 /// <param name="options">The options.</param>
 /// <returns>A <see cref="TwitterRelationship"/> instance.</returns>
 public static TwitterResponse<TwitterRelationship> Show(OAuthTokens tokens, string targetUserName, OptionalProperties options)
 {
     return Show(tokens, string.Empty, targetUserName, options);
 }