/// <summary> /// Removes the uploaded profile banner for the authenticating user. Returns HTTP 20x upon success. /// </summary> /// <param name="fileName">file name for upload</param> /// <param name="imageContentStream">Stream of image content</param> /// <param name="bannerWidth">The width of the preferred section of the image being uploaded in pixels. Use with height, offset_left, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerHeight">The height of the preferred section of the image being uploaded in pixels. Use with width, offset_left, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerLeftOffset">The number of pixels by which to offset the uploaded image from the left. Use with height, width, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerTopOffset">The number of pixels by which to offset the uploaded image from the top. Use with height, width, and offset_left to select the desired region of the image to use.</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_banner </remarks> public static async Task <TwitterSuccess> ChangeProfileBanner(this IUserSession session, string fileName, Stream imageContentStream, int bannerWidth = 0, int bannerHeight = 0, int bannerLeftOffset = 0, int bannerTopOffset = 0) { var parameters = new TwitterParametersCollection(); if (bannerWidth != 0) { parameters.Add("width", bannerWidth.ToString()); } if (bannerHeight != 0) { parameters.Add("height", bannerWidth.ToString()); } if (bannerLeftOffset != 0) { parameters.Add("offset_left", bannerWidth.ToString()); } if (bannerTopOffset != 0) { parameters.Add("offset_top", bannerWidth.ToString()); } return(await session.PostFileAsync(TwitterApi.Resolve("/1.1/account/update_profile_banner.json"), parameters, fileName, "banner", srImage : imageContentStream) .ContinueWith(c => c.MapToTwitterSuccess())); }
/// <summary> /// Returns detailed information about the relationship between two arbitrary users. /// </summary> /// <param name="sourceScreenName">The user_id of the subject user.</param> /// <param name="sourceId">The screen_name of the subject user.</param> /// <param name="targetId">The user_id of the target user.</param> /// <param name="targetScreenName">The screen_name of the target user.</param> /// <returns></returns> /// <remarks> ref: https://api.twitter.com/1.1/friendships/show.json </remarks> public async static Task <UserStatus> GetFriendship(this ITwitterSession session, string sourceScreenName = "", string targetScreenName = "", int sourceId = 0, int targetId = 0) { var parameters = new TwitterParametersCollection(); if (!string.IsNullOrWhiteSpace(sourceScreenName)) { parameters.Add("source_screen_name", sourceScreenName); } if (sourceId != 0) { parameters.Add("source_id", sourceId.ToString()); } if (!string.IsNullOrWhiteSpace(targetScreenName)) { parameters.Add("target_screen_name", targetScreenName); } if (targetId != 0) { parameters.Add("target_id", targetId.ToString()); } return(await session.GetAsync(TwitterApi.Resolve("/1.1/friendships/show.json"), parameters) .ContinueWith(c => c.MapToSingle <UserStatus>())); }
/// <summary> /// Sets values that users are able to set under the "Account" tab of their settings page. Only the parameters specified will be updated. /// </summary> /// <param name="name">Full name associated with the profile. Maximum of 20 characters.</param> /// <param name="profileUrl">URL associated with the profile. Will be prepended with "http://" if not present. Maximum of 100 characters.</param> /// <param name="location">The city or country describing where the user of the account is located.</param> /// <param name="description">A description of the user owning the account. Maximum of 160 characters.</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile </remarks> public static async Task <User> ChangeAccountProfile(this IUserSession session, string name = "", string profileUrl = "", string location = "", string description = "") { var parameters = new TwitterParametersCollection(); parameters.Create(include_entities: true, skip_status: true); // first 20 chars if (!string.IsNullOrWhiteSpace(name)) { parameters.Add("name", name.TrimAndTruncate(20)); } // first 100 chars if (!string.IsNullOrWhiteSpace(profileUrl)) { parameters.Add("purl", profileUrl.TrimAndTruncate(100)); } // first 30 chars if (!string.IsNullOrWhiteSpace(location)) { parameters.Add("location", location.TrimAndTruncate(30)); } // first 160 chars if (!string.IsNullOrWhiteSpace(description)) { parameters.Add("description", description.TrimAndTruncate(160)); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/account/update_profile.json"), parameters) .ContinueWith(c => c.MapToSingle <User>())); }
/// <summary> /// Returns detailed information about the relationship between two arbitrary users. /// </summary> /// <param name="sourceScreenName">The user_id of the subject user.</param> /// <param name="sourceId">The screen_name of the subject user.</param> /// <param name="targetId">The user_id of the target user.</param> /// <param name="targetScreenName">The screen_name of the target user.</param> /// <returns></returns> /// <remarks> ref: https://api.twitter.com/1.1/friendships/show.json </remarks> public async static Task <UserStatus> GetFriendship(this IUserSession session, string sourceScreenName = "", string targetScreenName = "", int sourceId = 0, int targetId = 0) { var parameters = new TwitterParametersCollection(); if (!string.IsNullOrWhiteSpace(sourceScreenName)) { parameters.Add("source_screen_name", sourceScreenName); } if (sourceId != 0) { parameters.Add("source_id", sourceId.ToString()); } if (!string.IsNullOrWhiteSpace(targetScreenName)) { parameters.Add("target_screen_name", targetScreenName); } if (targetId != 0) { parameters.Add("target_id", targetId.ToString()); } if (parameters.EnsureAllArePresent(new [] { "source_screen_name", "source_id", "target_screen_name", "target_id" }).IsFalse()) { return(session.MapParameterError <UserStatus>( "source_screen_name, source_id, target_screen_name and target_id are all required")); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/friendships/show.json"), parameters) .ContinueWith(c => c.MapToSingle <UserStatus>())); }
public TwitterParametersCollection ChangeSearchParameters(string track = null, string follow = null, string locations = null, string filterlevel = "none", string language = "en") { var parameters = new TwitterParametersCollection(); parameters.Create(stall_warnings: false, delimited: false); if (track != null) { parameters.CreateCommaDelimitedList("track", new List <string> { track }); } if (follow != null) { parameters.CreateCommaDelimitedList("follow", new List <string> { follow }); } if (locations != null) { parameters.CreateCommaDelimitedList("locations", new List <string> { locations }); } parameters.Add("filter_level", filterlevel); parameters.Add("language", language); return(parameters); }
internal static void CreateCollection(this TwitterParametersCollection parameters, IEnumerable <string> screen_names = null, IEnumerable <long> user_ids = null, IEnumerable <long> tweetids = null) { var screenNameList = new StringBuilder(); if (screen_names != null) { if (screen_names.Any()) { foreach (var screenName in screen_names) { screenNameList.Append(screenName + ","); } parameters.Add("screen_name", screenNameList.ToString().TrimLastChar()); } } var userIDList = new StringBuilder(); if (user_ids == null) { return; } if (!user_ids.Any()) { return; } foreach (var userID in user_ids) { userIDList.Append(userID + ","); } parameters.Add("user_id", userIDList.ToString().TrimLastChar()); var tweetIDList = new StringBuilder(); if (tweetids == null) { return; } if (!tweetids.Any()) { return; } foreach (var tweetID in tweetids) { userIDList.Append(tweetID + ","); } parameters.Add("id", tweetIDList.ToString().TrimLastChar()); }
public TwitterParametersCollection ChangeSearchParameters(string track = null, string follow = null, string locations = null, string filterlevel = "none", string language = "en") { var parameters = new TwitterParametersCollection(); parameters.Create(stall_warnings: false, delimited: false); if (track != null) parameters.CreateCommaDelimitedList("track", new List<string> { track }); if (follow != null) parameters.CreateCommaDelimitedList("follow", new List<string> { follow }); if (locations != null) parameters.CreateCommaDelimitedList("locations", new List<string> { locations }); parameters.Add("filter_level", filterlevel); parameters.Add("language", language); return parameters; }
//https://dev.twitter.com/docs/streaming-apis/parameters public TwitterParametersCollection ChangeSearchParameters(StreamSearchRequest searchRequest) { var parameters = new TwitterParametersCollection(); parameters.Create(stall_warnings: false, delimited: false); if (searchRequest.Tracks.HasAny()) parameters.CreateCommaDelimitedList("track", searchRequest.Tracks); if (searchRequest.Follows.HasAny()) parameters.CreateCommaDelimitedList("follow", searchRequest.Follows); if (searchRequest.Locations.HasAny()) parameters.CreateCommaDelimitedList("locations", searchRequest.Locations); parameters.Add("filter_level", searchRequest.FilterLevel); parameters.Add("language", searchRequest.Language); return parameters; }
/// <summary> /// Sends a Tweet /// </summary> /// <param name="text">Text of tweet to send</param> /// <param name="latitude">Latitude of sender</param> /// <param name="longitude">Longotide of sender</param> /// <param name="placeId">A place in the world identified by a Twitter place ID. Place IDs can be retrieved from geo/reverse_geocode.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/statuses/update </remarks> public async static Task<Tweet> SendTweet(this IUserSession session, string text, double latitude = 0.0, double longitude = 0.0, string placeId="") { var parameters = new TwitterParametersCollection { { "status", text.TrimAndTruncate(1000)}, { "trim_user", true.ToString() }, }; parameters.Create(include_entities:true,place_id:placeId); if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0) { parameters.Add("lat", latitude.ToString()); parameters.Add("long", longitude.ToString()); } return await session.PostAsync(TwitterApi.Resolve("/1.1/statuses/update.json"), parameters) .ContinueWith(c => c.MapToSingle<Tweet>()); }
/// <summary> /// Sends a Tweet, with status text, with attached image /// </summary> /// <param name="text">Text of tweet to send</param> /// <param name="fileName">Name of the file, including extension</param> /// <param name="imageDataStream">Stream of the image</param> /// <param name="latitude">Latitude of the image</param> /// <param name="longitude">Longitude of the image</param> /// <param name="placeId">A place in the world identified by a Twitter place ID. Place IDs can be retrieved from geo/reverse_geocode.</param> /// <returns>Tweet sent</returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media </remarks> public async static Task <Tweet> SendTweetWithImage(this IUserSession session, string text, string fileName, Stream imageDataStream, double latitude = 0.0, double longitude = 0.0, string placeId = "") { var parameters = new TwitterParametersCollection { { "status", text }, }; parameters.Create(place_id: placeId); if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0) { parameters.Add("lat", latitude.ToString()); parameters.Add("long", longitude.ToString()); } return(await session.PostFileAsync(TwitterApi.Upload("/1.1/statuses/update_with_media.json"), parameters, fileName, "media[]", srImage : imageDataStream) .ContinueWith(c => c.MapToSingle <Tweet>())); }
/// <summary> /// Sends a Tweet in reply to another tweet /// </summary> /// <param name="tweet">Tweet replying to</param> /// <param name="text">Text of the reply</param> /// <param name="latitude">Latitude</param> /// <param name="longitude">Longitude</param> /// <param name="placeId">A place in the world identified by a Twitter place ID. Place IDs can be retrieved from geo/reverse_geocode.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/statuses/update </remarks> public async static Task<Tweet> ReplyToTweet(this IUserSession session, Tweet tweet, string text, double latitude=0.0, double longitude = 0.0, string placeId="") { var parameters = new TwitterParametersCollection { {"status", text }, {"in_reply_to_status_id", tweet.Id.ToString()} }; parameters.Create(place_id:placeId); if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0) { parameters.Add("lat", latitude.ToString()); parameters.Add("long", longitude.ToString()); } return await session.PostAsync(TwitterApi.Resolve("/1.1/statuses/update.json"), parameters) .ContinueWith(c => c.MapToSingle<Tweet>()); }
/// <summary> /// Returns the top 10 trending topics for a specific WOEID, if trending information is available for it. /// </summary> /// <param name="placeId">The Yahoo! Where On Earth ID of the location to return trending information for. Global information is available by using 1 as the WOEID.</param> /// <param name="exclude">If true will remove all hashtags from the trends list.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/trends/place </remarks> public static async Task<TwitterResponseCollection<TrendsForPlaceResponse>> GetTrendsForPlace(this ITwitterSession session, int placeId = 1, bool exclude = false) { var parameters = new TwitterParametersCollection {{"id",placeId.ToString()}}; if (exclude) parameters.Add("exclude","hashtags"); return await session.GetAsync(TwitterApi.Resolve("/1.1/trends/place.json"), parameters) .ContinueWith(c => c.MapToMany<TrendsForPlaceResponse>()); }
/// <summary> /// Search for places that can be attached to a statuses/update. Given a latitude and a longitude pair, an IP address, or a name, this request will return a list of all the valid places that can be used as the place_id when updating a status /// </summary> /// <param name="query">Free-form text to match against while executing a geo-based query, best suited for finding nearby locations by name. Remember to URL encode the query.</param> /// <param name="latitude">The latitude to search around.</param> /// <param name="longitude">The longitude to search around.</param> /// <param name="accuracy">A hint on the "region" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If this is not passed in, then it is assumed to be 0m.</param> /// <param name="containedWithin">This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.</param> /// <param name="granularity">This is the minimal granularity of place types to return and must be one of: poi, neighborhood, city, admin or country. If no granularity is provided for the request neighborhood is assumed.</param> /// <param name="maxResults">A hint as to the number of results to return.</param> /// <param name="ipAddress">An IP address. Used when attempting to fix geolocation based off of the user's IP address.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/geo/search </remarks> public static async Task<ReverseGeoCodePlaces> GetPlaceIDFromInfo(this IUserSession session, string query="", double latitude = 0.0, double longitude = 0.0, string accuracy = "10m", string containedWithin ="", string granularity = "neighborhood", int maxResults = 20, string ipAddress="") { var parameters = new TwitterParametersCollection { {"max_results", maxResults.ToString()} }; if (!string.IsNullOrWhiteSpace(query)) { parameters.Add("query", query); } if (!string.IsNullOrWhiteSpace(containedWithin)) { parameters.Add("contained_within", containedWithin); } if (!string.IsNullOrWhiteSpace(granularity)) { parameters.Add("granularity", granularity); } if (!string.IsNullOrWhiteSpace(ipAddress)) { parameters.Add("ip", ipAddress); } if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0) { parameters.Add("lat", latitude.ToString()); parameters.Add("long", longitude.ToString()); if (!string.IsNullOrWhiteSpace(accuracy)) // nested because I think this only matters when lat/long is set { parameters.Add("accuracy", accuracy); } } return await session.GetAsync(TwitterApi.Resolve("/1.1/geo/search.json"), parameters) .ContinueWith(c => c.MapToSingle<ReverseGeoCodePlaces>()); }
/// <summary> /// Sends a Tweet in reply to another tweet /// </summary> /// <param name="tweet">Tweet replying to</param> /// <param name="text">Text of the reply</param> /// <param name="latitude">Latitude</param> /// <param name="longitude">Longitude</param> /// <param name="placeId">A place in the world identified by a Twitter place ID. Place IDs can be retrieved from geo/reverse_geocode.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/statuses/update </remarks> public async static Task <Tweet> ReplyToTweet(this IUserSession session, Tweet tweet, string text, double latitude = 0.0, double longitude = 0.0, string placeId = "") { var parameters = new TwitterParametersCollection { { "status", text }, { "in_reply_to_status_id", tweet.Id.ToString() } }; parameters.Create(place_id: placeId); if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0) { parameters.Add("lat", latitude.ToString()); parameters.Add("long", longitude.ToString()); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/statuses/update.json"), parameters) .ContinueWith(c => c.MapToSingle <Tweet>())); }
/// <summary> /// Sends a Tweet /// </summary> /// <param name="text">Text of tweet to send</param> /// <param name="latitude">Latitude of sender</param> /// <param name="longitude">Longotide of sender</param> /// <param name="placeId">A place in the world identified by a Twitter place ID. Place IDs can be retrieved from geo/reverse_geocode.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/statuses/update </remarks> public async static Task <Tweet> SendTweet(this IUserSession session, string text, double latitude = 0.0, double longitude = 0.0, string placeId = "") { var parameters = new TwitterParametersCollection { { "status", text.TrimAndTruncate(1000) }, { "trim_user", true.ToString() }, }; parameters.Create(include_entities: true, place_id: placeId); if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0) { parameters.Add("lat", latitude.ToString()); parameters.Add("long", longitude.ToString()); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/statuses/update.json"), parameters) .ContinueWith(c => c.MapToSingle <Tweet>())); }
/// <summary> /// Geotagged dedicated API for running searches against the real-time index of recent Tweets. 6-9 days /// </summary> /// <param name="searchText">search query of 1,000 characters maximum, including operators. Queries may additionally be limited by complexity.</param> /// <param name="latitude">Returns tweets by users located within a given radius of the given latitude/longitude.</param> /// <param name="longitude">Returns tweets by users located within a given radius of the given latitude/longitude.</param> /// <param name="distance">Returns tweets by users located within a given radius of the given latitude/longitude.</param> /// <param name="distanceUnits">km (default) or mi</param> /// <param name="maxId"></param> /// <param name="sinceId"></param> /// <param name="untilDate">YYYY-MM-DD format</param> /// <param name="count">Tweets to return Default 20</param> /// <param name="searchResponseType">SearchResult.Mixed (default), SearchResult.Recent, SearchResult.Popular</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/search/tweets </remarks> public async static Task<SearchResponse> SearchFor(this ITwitterSession session, string searchText, SearchResultType searchResponseType, double latitude, double longitude, double distance, string distanceUnits="km", long maxId = 0, long sinceId = 0, string untilDate = "", int count = 20) { var parameters = new TwitterParametersCollection { {"q", searchText.TrimAndTruncate(1000).UrlEncode()}, {"result_type", SearchResultString(searchResponseType)}, }; parameters.Create(since_id: sinceId, max_id: maxId, count: count, include_entities: true); if (!string.IsNullOrWhiteSpace(untilDate)) { parameters.Add("until", untilDate); } parameters.Add("geocode",String.Format("{0},{1},{2}{3}",latitude,longitude,distance,distanceUnits)); return await session.GetAsync(TwitterApi.Resolve("/1.1/search/tweets.json"), parameters) .ContinueWith(c => c.MapToSingle<SearchResponse>()); }
/// <summary> /// Updates the specified list. The authenticated user must own the list to be able to update it. /// </summary> /// <param name="listId">The numerical id of the list.</param> /// <param name="slug">You can identify a list by its slug instead of its numerical id. If you decide to do so, note that you'll also have to specify the list owner using the owner_id or owner_screen_name parameters.</param> /// <param name="name">The name for the list.</param> /// <param name="mode">Whether your list is public or private. Values can be public or private. If no mode is specified the list will be public.</param> /// <param name="description">The description to give the list.</param> /// <param name="ownerId">The user ID of the user who owns the list being requested by a slug.</param> /// <param name="ownerScreenName">The screen name of the user who owns the list being requested by a slug.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/lists/update </remarks> public static async Task <TwitterSuccess> ChangeList(this IUserSession session, long listId, string slug, string name = "", string mode = "", string description = "", long ownerId = 0, string ownerScreenName = "") { var parameters = new TwitterParametersCollection(); parameters.Create(name: name, list_id: listId, slug: slug, owner_id: ownerId, owner_screen_name: ownerScreenName); if (!string.IsNullOrWhiteSpace(mode)) { parameters.Add("mode", mode); } if (!string.IsNullOrWhiteSpace(description)) { parameters.Add("description", description); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/lists/update.json"), parameters) .ContinueWith(c => c.MapToTwitterSuccess())); }
/// <summary> /// Geotagged dedicated API for running searches against the real-time index of recent Tweets. 6-9 days /// </summary> /// <param name="searchText">search query of 1,000 characters maximum, including operators. Queries may additionally be limited by complexity.</param> /// <param name="latitude">Returns tweets by users located within a given radius of the given latitude/longitude.</param> /// <param name="longitude">Returns tweets by users located within a given radius of the given latitude/longitude.</param> /// <param name="distance">Returns tweets by users located within a given radius of the given latitude/longitude.</param> /// <param name="distanceUnits">km (default) or mi</param> /// <param name="maxId"></param> /// <param name="sinceId"></param> /// <param name="untilDate">YYYY-MM-DD format</param> /// <param name="count">Tweets to return Default 20</param> /// <param name="searchResponseType">SearchResult.Mixed (default), SearchResult.Recent, SearchResult.Popular</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/search/tweets </remarks> public async static Task <SearchResponse> SearchFor(this ITwitterSession session, string searchText, SearchResultType searchResponseType, double latitude, double longitude, double distance, string distanceUnits = "km", long maxId = 0, long sinceId = 0, string untilDate = "", int count = 20) { var parameters = new TwitterParametersCollection { { "q", searchText.TrimAndTruncate(1000).UrlEncode() }, { "result_type", SearchResultString(searchResponseType) }, }; parameters.Create(since_id: sinceId, max_id: maxId, count: count, include_entities: true); if (!string.IsNullOrWhiteSpace(untilDate)) { parameters.Add("until", untilDate); } parameters.Add("geocode", String.Format("{0},{1},{2}{3}", latitude, longitude, distance, distanceUnits)); return(await session.GetAsync(TwitterApi.Resolve("/1.1/search/tweets.json"), parameters) .ContinueWith(c => c.MapToSingle <SearchResponse>())); }
/// <summary> /// Updates the authenticating user's settings. /// </summary> /// <param name="trendLocationWoeid">The Yahoo! Where On Earth ID to use as the user's default trend location.</param> /// <param name="sleepTimeEnabled">enable sleep time for the user. Sleep time is the time when push or SMS notifications should not be sent to the user.</param> /// <param name="startSleepTime">The hour that sleep time should begin if it is enabled. (00)</param> /// <param name="endSleepTime">The hour that sleep time should end if it is enabled. (23) </param> /// <param name="timeZone">The timezone dates and times should be displayed in for the user. http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html </param> /// <param name="language">The language which Twitter should render in for this user https://dev.twitter.com/docs/api/1/get/help/languages </param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/settings </remarks> public static async Task <AccountSettings> ChangeAccountSettings(this IUserSession session, string trendLocationWoeid = "1", bool sleepTimeEnabled = false, string startSleepTime = "", string endSleepTime = "", string timeZone = "", string language = "") { var parameters = new TwitterParametersCollection { { "sleep_time_enabled", sleepTimeEnabled.ToString() }, }; parameters.Create(include_entities: true); if (!string.IsNullOrWhiteSpace(trendLocationWoeid)) { parameters.Add("trend_location_woeid", trendLocationWoeid); } if (!string.IsNullOrWhiteSpace(startSleepTime)) { parameters.Add("start_sleep_time", startSleepTime); } if (!string.IsNullOrWhiteSpace(endSleepTime)) { parameters.Add("end_sleep_time", endSleepTime); } if (!string.IsNullOrWhiteSpace(timeZone)) { parameters.Add("time_zone", timeZone); } if (!string.IsNullOrWhiteSpace(language)) { parameters.Add("lang", language); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/account/settings.json"), parameters) .ContinueWith(c => c.MapToSingle <AccountSettings>())); }
/// <summary> /// Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com. Each parameter's value must be a valid hexidecimal value, and may be either three or six characters (ex: #fff or #ffffff). /// </summary> /// <param name="profileBackgroundColor">Example Values: 3D3D3D</param> /// <param name="profileLinkColor">Example Values: 3D3D3D</param> /// <param name="profileSidebarBorderColor">Example Values: 3D3D3D</param> /// <param name="profileSidebarFillColor">Example Values: 3D3D3D</param> /// <param name="profileTextColor">Example Values: 3D3D3D</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_colors </remarks> public static async Task <User> ChangeAccountColours(this IUserSession session, string profileBackgroundColor = "", string profileLinkColor = "", string profileSidebarBorderColor = "", string profileSidebarFillColor = "", string profileTextColor = "") { var parameters = new TwitterParametersCollection(); parameters.Create(include_entities: true, skip_status: true); if (!string.IsNullOrWhiteSpace(profileBackgroundColor)) { parameters.Add("profile_background_color", profileBackgroundColor); } if (!string.IsNullOrWhiteSpace(profileLinkColor)) { parameters.Add("profile_link_color", profileLinkColor); } if (!string.IsNullOrWhiteSpace(profileSidebarBorderColor)) { parameters.Add("profile_sidebar_border_color", profileSidebarBorderColor); } if (!string.IsNullOrWhiteSpace(profileSidebarFillColor)) { parameters.Add("profile_sidebar_fill_color", profileSidebarFillColor); } if (!string.IsNullOrWhiteSpace(profileTextColor)) { parameters.Add("profile_text_color", profileTextColor); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/account/update_profile_colors.json"), parameters) .ContinueWith(c => c.MapToSingle <User>())); }
/// <summary> /// Returns the top 10 trending topics for a specific WOEID, if trending information is available for it. /// </summary> /// <param name="placeId">The Yahoo! Where On Earth ID of the location to return trending information for. Global information is available by using 1 as the WOEID.</param> /// <param name="exclude">If true will remove all hashtags from the trends list.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/trends/place </remarks> public static async Task <TwitterResponseCollection <TrendsForPlaceResponse> > GetTrendsForPlace(this ITwitterSession session, int placeId = 1, bool exclude = false) { var parameters = new TwitterParametersCollection { { "id", placeId.ToString() } }; if (exclude) { parameters.Add("exclude", "hashtags"); } return(await session.GetAsync(TwitterApi.Resolve("/1.1/trends/place.json"), parameters) .ContinueWith(c => c.MapToMany <TrendsForPlaceResponse>())); }
//https://dev.twitter.com/docs/streaming-apis/parameters public TwitterParametersCollection ChangeSearchParameters(StreamSearchRequest searchRequest) { var parameters = new TwitterParametersCollection(); parameters.Create(stall_warnings: false, delimited: false); if (searchRequest.Tracks.HasAny()) { parameters.CreateCommaDelimitedList("track", searchRequest.Tracks); } if (searchRequest.Follows.HasAny()) { parameters.CreateCommaDelimitedList("follow", searchRequest.Follows); } if (searchRequest.Locations.HasAny()) { parameters.CreateCommaDelimitedList("locations", searchRequest.Locations); } parameters.Add("filter_level", searchRequest.FilterLevel); parameters.Add("language", searchRequest.Language); return(parameters); }
/// <summary> /// Creates a new list for the authenticated user. Note that you can't create more than 20 lists per account. /// </summary> /// <param name="name">The name for the list.</param> /// <param name="mode">Whether your list is public or private. Values can be public or private. If no mode is specified the list will be public.</param> /// <param name="description">The description to give the list.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/lists/update </remarks> public static async Task <TwitterList> CreateList(this IUserSession session, string name, string mode, string description = "", long ownerId = 0, string ownerScreenName = "") { var parameters = new TwitterParametersCollection { { "name", name }, { "mode", mode }, }; if (!string.IsNullOrWhiteSpace(description)) { parameters.Add("description", description); } return(await session.PostAsync(TwitterApi.Resolve("/1.1/lists/create.json"), parameters) .ContinueWith(c => c.MapToSingle <TwitterList>())); }
/// <summary> /// Locates places near the given coordinates which are similar in name. /// NOTE: The token contained in the response is the token needed to be able to create a new place. /// </summary> /// <param name="name">The name a place is known as.</param> /// <param name="latitude">The latitude to search around</param> /// <param name="longitude">The longitude to search around</param> /// <param name="containedWithin">This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/geo/similar_places </remarks> public static async Task <ReverseGeoCodePlaces> GetPlaceSimilarName(this IUserSession session, string name = "", double latitude = 0.0, double longitude = 0.0, string containedWithin = "") { var parameters = new TwitterParametersCollection { { "lat", latitude.ToString() }, { "long", longitude.ToString() }, { "name", name } }; if (!string.IsNullOrWhiteSpace(containedWithin)) { parameters.Add("contained_within", containedWithin); } return(await session.GetAsync(TwitterApi.Resolve("/1.1/geo/similar_places.json"), parameters) .ContinueWith(c => c.MapToSingle <ReverseGeoCodePlaces>())); }
internal static void CreateCommaDelimitedList(this TwitterParametersCollection parameters, string elementName, IEnumerable elements) { var elementstr = new StringBuilder(); if (elements == null) { return; } var elementcount = 0; foreach (var tr in elements) { elementstr.Append(tr + ","); elementcount++; } if (elementcount > 0) { parameters.Add(elementName, elementstr.ToString().TrimLastChar()); } }
/// <summary> /// Search for places that can be attached to a statuses/update. Given a latitude and a longitude pair, an IP address, or a name, this request will return a list of all the valid places that can be used as the place_id when updating a status /// </summary> /// <param name="query">Free-form text to match against while executing a geo-based query, best suited for finding nearby locations by name. Remember to URL encode the query.</param> /// <param name="latitude">The latitude to search around.</param> /// <param name="longitude">The longitude to search around.</param> /// <param name="accuracy">A hint on the "region" in which to search. If a number, then this is a radius in meters, but it can also take a string that is suffixed with ft to specify feet. If this is not passed in, then it is assumed to be 0m.</param> /// <param name="containedWithin">This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.</param> /// <param name="granularity">This is the minimal granularity of place types to return and must be one of: poi, neighborhood, city, admin or country. If no granularity is provided for the request neighborhood is assumed.</param> /// <param name="maxResults">A hint as to the number of results to return.</param> /// <param name="ipAddress">An IP address. Used when attempting to fix geolocation based off of the user's IP address.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/geo/search </remarks> public static async Task <ReverseGeoCodePlaces> GetPlaceIDFromInfo(this IUserSession session, string query = "", double latitude = 0.0, double longitude = 0.0, string accuracy = "10m", string containedWithin = "", string granularity = "neighborhood", int maxResults = 20, string ipAddress = "") { var parameters = new TwitterParametersCollection { { "max_results", maxResults.ToString() } }; if (!string.IsNullOrWhiteSpace(query)) { parameters.Add("query", query); } if (!string.IsNullOrWhiteSpace(containedWithin)) { parameters.Add("contained_within", containedWithin); } if (!string.IsNullOrWhiteSpace(granularity)) { parameters.Add("granularity", granularity); } if (!string.IsNullOrWhiteSpace(ipAddress)) { parameters.Add("ip", ipAddress); } if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0) { parameters.Add("lat", latitude.ToString()); parameters.Add("long", longitude.ToString()); if (!string.IsNullOrWhiteSpace(accuracy)) // nested because I think this only matters when lat/long is set { parameters.Add("accuracy", accuracy); } } return(await session.GetAsync(TwitterApi.Resolve("/1.1/geo/search.json"), parameters) .ContinueWith(c => c.MapToSingle <ReverseGeoCodePlaces>())); }
/// <summary> /// Updates the authenticating user's settings. /// </summary> /// <param name="trendLocationWoeid">The Yahoo! Where On Earth ID to use as the user's default trend location.</param> /// <param name="sleepTimeEnabled">enable sleep time for the user. Sleep time is the time when push or SMS notifications should not be sent to the user.</param> /// <param name="startSleepTime">The hour that sleep time should begin if it is enabled. (00)</param> /// <param name="endSleepTime">The hour that sleep time should end if it is enabled. (23) </param> /// <param name="timeZone">The timezone dates and times should be displayed in for the user. http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html </param> /// <param name="language">The language which Twitter should render in for this user https://dev.twitter.com/docs/api/1/get/help/languages </param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/settings </remarks> public static async Task<AccountSettings> ChangeAccountSettings(this IUserSession session, string trendLocationWoeid = "1", bool sleepTimeEnabled = false, string startSleepTime = "", string endSleepTime = "", string timeZone = "", string language = "") { var parameters = new TwitterParametersCollection { {"sleep_time_enabled", sleepTimeEnabled.ToString()}, }; parameters.Create(include_entities: true); if (!string.IsNullOrWhiteSpace(trendLocationWoeid)) { parameters.Add("trend_location_woeid", trendLocationWoeid); } if (!string.IsNullOrWhiteSpace(startSleepTime)) { parameters.Add("start_sleep_time", startSleepTime); } if (!string.IsNullOrWhiteSpace(endSleepTime)) { parameters.Add("end_sleep_time", endSleepTime); } if (!string.IsNullOrWhiteSpace(timeZone)) { parameters.Add("time_zone", timeZone); } if (!string.IsNullOrWhiteSpace(language)) { parameters.Add("lang", language); } return await session.PostAsync(TwitterApi.Resolve("/1.1/account/settings.json"), parameters) .ContinueWith(c => c.MapToSingle<AccountSettings>()); }
/// <summary> /// Locates places near the given coordinates which are similar in name. /// NOTE: The token contained in the response is the token needed to be able to create a new place. /// </summary> /// <param name="name">The name a place is known as.</param> /// <param name="latitude">The latitude to search around</param> /// <param name="longitude">The longitude to search around</param> /// <param name="containedWithin">This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/get/geo/similar_places </remarks> public static async Task<ReverseGeoCodePlaces> GetPlaceSimilarName(this IUserSession session, string name = "", double latitude = 0.0, double longitude = 0.0, string containedWithin = "") { var parameters = new TwitterParametersCollection { {"lat", latitude.ToString()}, {"long", longitude.ToString()}, {"name",name} }; if (!string.IsNullOrWhiteSpace(containedWithin)) { parameters.Add("contained_within", containedWithin); } return await session.GetAsync(TwitterApi.Resolve("/1.1/geo/similar_places.json"), parameters) .ContinueWith(c => c.MapToSingle<ReverseGeoCodePlaces>()); }
/// <summary> /// Returns detailed information about the relationship between two arbitrary users. /// </summary> /// <param name="sourceScreenName">The user_id of the subject user.</param> /// <param name="sourceId">The screen_name of the subject user.</param> /// <param name="targetId">The user_id of the target user.</param> /// <param name="targetScreenName">The screen_name of the target user.</param> /// <returns></returns> /// <remarks> ref: https://api.twitter.com/1.1/friendships/show.json </remarks> public async static Task<UserStatus> GetFriendship(this ITwitterSession session, string sourceScreenName = "", string targetScreenName = "", int sourceId = 0, int targetId = 0) { var parameters = new TwitterParametersCollection(); if (!string.IsNullOrWhiteSpace(sourceScreenName)) { parameters.Add("source_screen_name", sourceScreenName); } if (sourceId != 0) { parameters.Add("source_id", sourceId.ToString()); } if (!string.IsNullOrWhiteSpace(targetScreenName)) { parameters.Add("target_screen_name", targetScreenName); } if (targetId != 0) { parameters.Add("target_id", targetId.ToString()); } return await session.GetAsync(TwitterApi.Resolve("/1.1/friendships/show.json"), parameters) .ContinueWith(c => c.MapToSingle<UserStatus>()); }
/// <summary> /// Returns detailed information about the relationship between two arbitrary users. /// </summary> /// <param name="sourceScreenName">The user_id of the subject user.</param> /// <param name="sourceId">The screen_name of the subject user.</param> /// <param name="targetId">The user_id of the target user.</param> /// <param name="targetScreenName">The screen_name of the target user.</param> /// <returns></returns> /// <remarks> ref: https://api.twitter.com/1.1/friendships/show.json </remarks> public async static Task<UserStatus> GetFriendship(this IUserSession session, string sourceScreenName="",string targetScreenName="", int sourceId=0,int targetId=0) { var parameters = new TwitterParametersCollection(); if (!string.IsNullOrWhiteSpace(sourceScreenName)) { parameters.Add("source_screen_name", sourceScreenName); } if (sourceId != 0) { parameters.Add("source_id", sourceId.ToString()); } if (!string.IsNullOrWhiteSpace(targetScreenName)) { parameters.Add("target_screen_name", targetScreenName); } if (targetId != 0) { parameters.Add("target_id", targetId.ToString()); } if (parameters.EnsureAllArePresent(new [] { "source_screen_name", "source_id", "target_screen_name", "target_id" }).IsFalse()) { return session.MapParameterError<UserStatus>( "source_screen_name, source_id, target_screen_name and target_id are all required"); } return await session.PostAsync(TwitterApi.Resolve("/1.1/friendships/show.json"), parameters) .ContinueWith(c => c.MapToSingle<UserStatus>()); }
/// <summary> /// Creates a new list for the authenticated user. Note that you can't create more than 20 lists per account. /// </summary> /// <param name="name">The name for the list.</param> /// <param name="mode">Whether your list is public or private. Values can be public or private. If no mode is specified the list will be public.</param> /// <param name="description">The description to give the list.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/lists/update </remarks> public static async Task<TwitterList> CreateList(this IUserSession session, string name, string mode, string description = "", long ownerId = 0, string ownerScreenName = "") { var parameters = new TwitterParametersCollection { {"name", name}, {"mode", mode}, }; if (!string.IsNullOrWhiteSpace(description)) { parameters.Add("description", description); } return await session.PostAsync(TwitterApi.Resolve("/1.1/lists/create.json"), parameters) .ContinueWith(c => c.MapToSingle<TwitterList>()); }
/// <summary> /// Updates the specified list. The authenticated user must own the list to be able to update it. /// </summary> /// <param name="listId">The numerical id of the list.</param> /// <param name="slug">You can identify a list by its slug instead of its numerical id. If you decide to do so, note that you'll also have to specify the list owner using the owner_id or owner_screen_name parameters.</param> /// <param name="name">The name for the list.</param> /// <param name="mode">Whether your list is public or private. Values can be public or private. If no mode is specified the list will be public.</param> /// <param name="description">The description to give the list.</param> /// <param name="ownerId">The user ID of the user who owns the list being requested by a slug.</param> /// <param name="ownerScreenName">The screen name of the user who owns the list being requested by a slug.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/lists/update </remarks> public static async Task<TwitterSuccess> ChangeList(this IUserSession session, long listId, string slug, string name = "", string mode = "", string description = "", long ownerId = 0, string ownerScreenName = "") { var parameters = new TwitterParametersCollection(); parameters.Create(name:name, list_id: listId, slug: slug, owner_id: ownerId, owner_screen_name: ownerScreenName); if (!string.IsNullOrWhiteSpace(mode)) { parameters.Add("mode", mode); } if (!string.IsNullOrWhiteSpace(description)) { parameters.Add("description", description); } return await session.PostAsync(TwitterApi.Resolve("/1.1/lists/update.json"), parameters) .ContinueWith(c => c.MapToTwitterSuccess()); }
/// <summary> /// Removes the uploaded profile banner for the authenticating user. Returns HTTP 20x upon success. /// </summary> /// <param name="fileName">file name for upload</param> /// <param name="imageContentStream">Stream of image content</param> /// <param name="bannerWidth">The width of the preferred section of the image being uploaded in pixels. Use with height, offset_left, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerHeight">The height of the preferred section of the image being uploaded in pixels. Use with width, offset_left, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerLeftOffset">The number of pixels by which to offset the uploaded image from the left. Use with height, width, and offset_top to select the desired region of the image to use.</param> /// <param name="bannerTopOffset">The number of pixels by which to offset the uploaded image from the top. Use with height, width, and offset_left to select the desired region of the image to use.</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_banner </remarks> public static async Task<TwitterSuccess> ChangeProfileBanner(this IUserSession session, string fileName, Stream imageContentStream, int bannerWidth = 0, int bannerHeight = 0, int bannerLeftOffset = 0, int bannerTopOffset = 0) { var parameters = new TwitterParametersCollection(); if (bannerWidth != 0) { parameters.Add("width", bannerWidth.ToString()); } if (bannerHeight != 0) { parameters.Add("height", bannerWidth.ToString()); } if (bannerLeftOffset != 0) { parameters.Add("offset_left", bannerWidth.ToString()); } if (bannerTopOffset != 0) { parameters.Add("offset_top", bannerWidth.ToString()); } return await session.PostFileAsync(TwitterApi.Resolve("/1.1/account/update_profile_banner.json"), parameters, fileName, "banner", srImage: imageContentStream) .ContinueWith(c => c.MapToTwitterSuccess()); }
/// <summary> /// Sets one or more hex values that control the color scheme of the authenticating user's profile page on twitter.com. Each parameter's value must be a valid hexidecimal value, and may be either three or six characters (ex: #fff or #ffffff). /// </summary> /// <param name="profileBackgroundColor">Example Values: 3D3D3D</param> /// <param name="profileLinkColor">Example Values: 3D3D3D</param> /// <param name="profileSidebarBorderColor">Example Values: 3D3D3D</param> /// <param name="profileSidebarFillColor">Example Values: 3D3D3D</param> /// <param name="profileTextColor">Example Values: 3D3D3D</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile_colors </remarks> public static async Task<User> ChangeAccountColours(this IUserSession session, string profileBackgroundColor = "", string profileLinkColor = "", string profileSidebarBorderColor = "", string profileSidebarFillColor = "", string profileTextColor = "") { var parameters = new TwitterParametersCollection(); parameters.Create(include_entities: true, skip_status: true); if (!string.IsNullOrWhiteSpace(profileBackgroundColor)) { parameters.Add("profile_background_color", profileBackgroundColor); } if (!string.IsNullOrWhiteSpace(profileLinkColor)) { parameters.Add("profile_link_color", profileLinkColor); } if (!string.IsNullOrWhiteSpace(profileSidebarBorderColor)) { parameters.Add("profile_sidebar_border_color", profileSidebarBorderColor); } if (!string.IsNullOrWhiteSpace(profileSidebarFillColor)) { parameters.Add("profile_sidebar_fill_color", profileSidebarFillColor); } if (!string.IsNullOrWhiteSpace(profileTextColor)) { parameters.Add("profile_text_color", profileTextColor); } return await session.PostAsync(TwitterApi.Resolve("/1.1/account/update_profile_colors.json"), parameters) .ContinueWith(c => c.MapToSingle<User>()); }
/// <summary> /// Sets values that users are able to set under the "Account" tab of their settings page. Only the parameters specified will be updated. /// </summary> /// <param name="name">Full name associated with the profile. Maximum of 20 characters.</param> /// <param name="profileUrl">URL associated with the profile. Will be prepended with "http://" if not present. Maximum of 100 characters.</param> /// <param name="location">The city or country describing where the user of the account is located.</param> /// <param name="description">A description of the user owning the account. Maximum of 160 characters.</param> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/account/update_profile </remarks> public static async Task<User> ChangeAccountProfile(this IUserSession session, string name = "", string profileUrl = "", string location = "", string description = "") { var parameters = new TwitterParametersCollection(); parameters.Create(include_entities: true,skip_status:true); // first 20 chars if (!string.IsNullOrWhiteSpace(name)) { parameters.Add("name", name.TrimAndTruncate(20)); } // first 100 chars if (!string.IsNullOrWhiteSpace(profileUrl)) { parameters.Add("purl", profileUrl.TrimAndTruncate(100)); } // first 30 chars if (!string.IsNullOrWhiteSpace(location)) { parameters.Add("location", location.TrimAndTruncate(30)); } // first 160 chars if (!string.IsNullOrWhiteSpace(description)) { parameters.Add("description", description.TrimAndTruncate(160)); } return await session.PostAsync(TwitterApi.Resolve("/1.1/account/update_profile.json"), parameters) .ContinueWith(c => c.MapToSingle<User>()); }
/// <summary> /// Sends a Tweet in reply to another tweet /// </summary> /// <param name="tweet">Text to send</param> /// <param name="text">Text of tweet to send</param> /// <param name="fileName">Name of the file, including extension</param> /// <param name="imageDataStream">Stream containing the image</param> /// <param name="latitude">Latitude</param> /// <param name="longitude">Longitude</param> /// <param name="placeId">A place in the world identified by a Twitter place ID. Place IDs can be retrieved from geo/reverse_geocode.</param> /// <returns></returns> /// <remarks> ref: https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media </remarks> public async static Task<Tweet> ReplyToTweetWithImage(this IUserSession session, Tweet tweet, string text, string fileName, Stream imageDataStream, double latitude = 0.0, double longitude = 0.0, string placeId = "") { var parameters = new TwitterParametersCollection { {"status", text}, {"in_reply_to_status_id", tweet.Id.ToString()} }; parameters.Create(place_id: placeId); if (Math.Abs(latitude) > 0.0 && Math.Abs(longitude) > 0.0) { parameters.Add("lat", latitude.ToString()); parameters.Add("long", longitude.ToString()); } return await session.PostFileAsync(TwitterApi.Upload("/1.1/statuses/update_with_media.json"), parameters, fileName, "media[]", srImage: imageDataStream) .ContinueWith(c => c.MapToSingle<Tweet>()); }
internal static void Create(this TwitterParametersCollection parameters, bool?include_entities = null, long?since_id = null, long?max_id = null, int?count = null, long?user_id = null, string screen_name = null, long?id = null, long?cursor = null, string text = null, bool?follow = null, bool?device = null, bool?retweets = null, bool?skip_status = null, string slug = null, long?list_id = null, string owner_screen_name = null, long?owner_id = null, string name = null, bool?include_rts = null, string place_id = null, bool?stall_warnings = null, bool?delimited = null, bool?full_text = null ) { if (stall_warnings != null) { parameters.Add("stall_warnings", stall_warnings.ToString()); } if (delimited != null) { parameters.Add("delimited", delimited.ToString()); } if (cursor != null) { parameters.Add("cursor", cursor.ToString()); } if (id != null) { if (id != 0) { parameters.Add("id", id.ToString()); } } if (list_id != null) { if (list_id != 0) { parameters.Add("list_id", list_id.ToString()); } } if (since_id != null) { if (since_id != 0) { parameters.Add("since_id", since_id.ToString()); } } if (max_id != null) { if (max_id != 0) { parameters.Add("max_id", max_id.ToString()); } } if (count != null) { if (count != 0) { parameters.Add("count", count.ToString()); } } if (user_id != null) { if (user_id != 0) { parameters.Add("user_id", user_id.ToString()); } } if (owner_id != null) { if (owner_id != 0) { parameters.Add("owner_id", owner_id.ToString()); } } if (include_rts != null) { parameters.Add("include_rts", include_rts.ToString()); } if (include_entities != null) { parameters.Add("include_entities", include_entities.ToString()); } if (full_text != null) { parameters.Add("full_text", full_text.ToString()); } if (follow != null) { parameters.Add("follow", follow.ToString()); } if (skip_status != null) { parameters.Add("skip_status", skip_status.ToString()); } if (!string.IsNullOrWhiteSpace(screen_name)) { parameters.Add("screen_name", screen_name); } if (!string.IsNullOrWhiteSpace(place_id)) { parameters.Add("place_id", place_id); } if (!string.IsNullOrWhiteSpace(owner_screen_name)) { parameters.Add("owner_screen_name", owner_screen_name); } if (!string.IsNullOrWhiteSpace(name)) { parameters.Add("name", name); } if (!string.IsNullOrWhiteSpace(slug)) { parameters.Add("slug", slug); } if (!string.IsNullOrWhiteSpace(text)) { parameters.Add("text", text); } }