/// <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); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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); }
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); }
/// <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); }
/// <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); }
/// <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)); }
/// <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))); }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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)); }
/// <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); }
/// <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); }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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)); }
/// <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))); }
/// <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 })); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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)); }
/// <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)); }
/// <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> /// 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); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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)); }
/// <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)); }
/// <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); }