public string GetSearchTweetsQuery(ISearchTweetsParameters searchTweetsParameters) { if (searchTweetsParameters == null) { throw new ArgumentNullException("Search parameters cannot be null"); } var searchQuery = GetQuery(searchTweetsParameters.SearchQuery, searchTweetsParameters.Filters); _searchQueryValidator.ThrowIfSearchParametersIsNotValid(searchTweetsParameters); var query = new StringBuilder(Resources.Search_SearchTweets); query.AddParameterToQuery("q", searchQuery); query.AddParameterToQuery("geocode", _searchQueryParameterGenerator.GenerateGeoCodeParameter(searchTweetsParameters.GeoCode)); query.Append(_searchQueryParameterGenerator.GenerateSearchTypeParameter(searchTweetsParameters.SearchType)); query.Append(_queryParameterGenerator.GenerateSinceIdParameter(searchTweetsParameters.SinceId)); query.Append(_queryParameterGenerator.GenerateMaxIdParameter(searchTweetsParameters.MaxId)); query.Append(_queryParameterGenerator.GenerateCountParameter(searchTweetsParameters.MaximumNumberOfResults)); query.Append(_searchQueryParameterGenerator.GenerateLangParameter(searchTweetsParameters.Lang)); query.Append(_searchQueryParameterGenerator.GenerateLocaleParameter(searchTweetsParameters.Locale)); query.Append(_searchQueryParameterGenerator.GenerateSinceParameter(searchTweetsParameters.Since)); query.Append(_searchQueryParameterGenerator.GenerateUntilParameter(searchTweetsParameters.Until)); query.AddFormattedParameterToQuery(_queryParameterGenerator.GenerateTweetModeParameter(_tweetinviSettingsAccessor.CurrentThreadSettings.TweetMode)); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(searchTweetsParameters.FormattedCustomQueryParameters)); return(query.ToString()); }
public string GetSearchTweetsQuery(ISearchTweetsParameters searchTweetsParameters) { if (searchTweetsParameters == null) { throw new ArgumentNullException("Search parameters cannot be null"); } var searchQuery = GetQuery(searchTweetsParameters.SearchQuery, searchTweetsParameters.Filters); _searchQueryValidator.ThrowIfSearchParametersIsNotValid(searchTweetsParameters); var query = new StringBuilder(Resources.Search_SearchTweets); query.AddParameterToQuery("q", searchQuery); query.AddParameterToQuery("geocode", _searchQueryParameterGenerator.GenerateGeoCodeParameter(searchTweetsParameters.GeoCode)); query.Append(_searchQueryParameterGenerator.GenerateSearchTypeParameter(searchTweetsParameters.SearchType)); query.Append(_queryParameterGenerator.GenerateSinceIdParameter(searchTweetsParameters.SinceId)); query.Append(_queryParameterGenerator.GenerateMaxIdParameter(searchTweetsParameters.MaxId)); query.Append(_queryParameterGenerator.GenerateCountParameter(searchTweetsParameters.MaximumNumberOfResults)); query.Append(_searchQueryParameterGenerator.GenerateLangParameter(searchTweetsParameters.Lang)); query.Append(_searchQueryParameterGenerator.GenerateLocaleParameter(searchTweetsParameters.Locale)); query.Append(_searchQueryParameterGenerator.GenerateSinceParameter(searchTweetsParameters.Since)); query.Append(_searchQueryParameterGenerator.GenerateUntilParameter(searchTweetsParameters.Until)); query.Append(_queryParameterGenerator.GenerateTweetModeParameter(_tweetinviSettingsAccessor.CurrentThreadSettings.TweetMode)); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(searchTweetsParameters.FormattedCustomQueryParameters)); return query.ToString(); }
public void AddTimelineParameters(StringBuilder query, ITimelineRequestParameters parameters, ComputedTweetMode tweetMode) { AddMinMaxQueryParameters(query, parameters); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("trim_user", parameters.TrimUser); query.AddParameterToQuery("tweet_mode", tweetMode); }
public void AddTimelineParameters(StringBuilder query, ITimelineRequestParameters parameters, TweetMode?requestTweetMode) { AddMinMaxQueryParameters(query, parameters); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("trim_user", parameters.TrimUser); AppendTweetModeParameter(query, parameters.TweetMode ?? requestTweetMode); }
// Parameters protected virtual void AddBaseParametersToQuery(StringBuilder queryBuilder) { if (_filteredLanguages.Any()) { var languages = string.Join(Uri.EscapeDataString(", "), _filteredLanguages.Select(x => x.ToLowerInvariant())); queryBuilder.AddParameterToQuery("language", languages); } if (StallWarnings) { queryBuilder.AddParameterToQuery("stall_warnings", "true"); } if (FilterLevel != StreamFilterLevel.None) { queryBuilder.AddParameterToQuery("filter_level", FilterLevel.ToString().ToLowerInvariant()); } if (!string.IsNullOrEmpty(_customRequestParameters.FormattedCustomQueryParameters)) { queryBuilder.Append(string.Format("&{0}", _customRequestParameters.FormattedCustomQueryParameters)); } if (TweetMode == TweetMode.Extended) { queryBuilder.AddParameterToQuery("tweet_mode", "extended"); } }
public string GetClosestTrendLocationsQuery(ICoordinates coordinates) { var query = new StringBuilder(Resources.Trends_GetClosestTrendsLocations); query.AddParameterToQuery("lat", coordinates.Latitude); query.AddParameterToQuery("long", coordinates.Longitude); return(query.ToString()); }
public string GetClosestTrendLocationsQuery(ICoordinates coordinates) { var query = new StringBuilder(Resources.Trends_GetClosestTrendsLocations); query.AddParameterToQuery("lat", coordinates.Latitude); query.AddParameterToQuery("long", coordinates.Longitude); return query.ToString(); }
public string GetUpdateProfileImageQuery(IUpdateProfileImageParameters parameters) { var query = new StringBuilder(Resources.Account_UpdateProfileImage); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetChunkedUploadFinalizeQuery(long mediaId, ICustomRequestParameters customRequestParameters) { var finalizeQuery = new StringBuilder(Resources.Upload_URL); finalizeQuery.AddParameterToQuery("command", "FINALIZE"); finalizeQuery.AddParameterToQuery("media_id", mediaId.ToString(CultureInfo.InvariantCulture)); finalizeQuery.AddFormattedParameterToQuery(customRequestParameters?.FormattedCustomQueryParameters); return(finalizeQuery.ToString()); }
public string GetUnfavoriteTweetQuery(IUnfavoriteTweetParameters parameters) { var query = new StringBuilder(Resources.Tweet_Favorite_Destroy); query.AddParameterToQuery("id", GetTweetId(parameters.Tweet)); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetDestroyTweetQuery(IDestroyTweetParameters parameters, ComputedTweetMode tweetMode) { var query = new StringBuilder(string.Format(Resources.Tweet_Destroy, _queryParameterGenerator.GenerateTweetIdentifier(parameters.Tweet))); query.AddParameterToQuery("trim_user", parameters.TrimUser); query.AddParameterToQuery("tweet_mode", tweetMode); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetBlockedUsersQuery(IGetBlockedUsersParameters parameters) { var query = new StringBuilder(Resources.User_Block_List); _queryParameterGenerator.AppendCursorParameters(query, parameters); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetUserQuery(IGetUserParameters parameters) { var query = new StringBuilder(Resources.User_GetUser); query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User)); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetUpdateRelationshipQuery(IUpdateRelationshipParameters parameters) { var query = new StringBuilder(Resources.Friendship_Update); query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User)); query.AddParameterToQuery("device", parameters.EnableDeviceNotifications); query.AddParameterToQuery("retweets", parameters.EnableRetweets); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetAuthenticatedUserQuery(IGetAuthenticatedUserParameters parameters) { var query = new StringBuilder(Resources.User_GetCurrentUser); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("include_email", parameters.IncludeEmail); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
private string GenerateUpdateAdditionalParameters(ITwitterListUpdateParameters parameters) { var privacyModeParameter = string.Format(Resources.List_PrivacyModeParameter, parameters.PrivacyMode.ToString().ToLower()); var queryParameterBuilder = new StringBuilder(privacyModeParameter); queryParameterBuilder.AddParameterToQuery("description", parameters.Description); queryParameterBuilder.AddParameterToQuery("name", parameters.Name); return(queryParameterBuilder.ToString()); }
public string GetRetweeterIdsQuery(ITweetIdentifier tweetIdentifier, int maxRetweetersToRetrieve = 100) { _tweetQueryValidator.ThrowIfTweetCannotBeUsed(tweetIdentifier); var query = new StringBuilder(string.Format(Resources.Tweet_GetRetweeters, tweetIdentifier.Id)); query.AddParameterToQuery("id", tweetIdentifier.Id); query.AddParameterToQuery("count", maxRetweetersToRetrieve); return(query.ToString()); }
public string GetTrendsLocationCloseToQuery(IGetTrendsLocationCloseToParameters parameters) { var coordinates = parameters.Coordinates; var query = new StringBuilder(Resources.Trends_GetTrendsLocationCloseTo); query.AddParameterToQuery("lat", coordinates.Latitude); query.AddParameterToQuery("long", coordinates.Longitude); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetDestroyRetweetQuery(IDestroyRetweetParameters parameters, ComputedTweetMode tweetMode) { var tweetId = GetTweetId(parameters.Tweet); var query = new StringBuilder(string.Format(Resources.Tweet_DestroyRetweet, tweetId)); query.AddParameterToQuery("trim_user", parameters.TrimUser); query.AddParameterToQuery("tweet_mode", tweetMode); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetUsersQuery(IGetUsersParameters parameters) { var userIdsParameter = _userQueryParameterGenerator.GenerateListOfUserIdentifiersParameter(parameters.Users); var query = new StringBuilder(Resources.User_GetUsers); query.AddFormattedParameterToQuery(userIdsParameter); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetAuthenticatedUserQuery(IGetAuthenticatedUserParameters parameters) { var query = new StringBuilder(Resources.User_GetCurrentUser); parameters = parameters ?? new GetAuthenticatedUserParameters(); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("include_email", parameters.IncludeEmail); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(parameters.FormattedCustomQueryParameters)); return query.ToString(); }
// Publish Tweet public string GetPublishTweetQuery(IPublishTweetParameters queryParameters) { _tweetQueryValidator.ThrowIfTweetCannotBePublished(queryParameters); var text = queryParameters.Text; if (queryParameters.QuotedTweet != null) { var quotedTweet = queryParameters.QuotedTweet; if (quotedTweet.CreatedBy != null) { text = text.TrimEnd(); text += string.Format(" https://twitter.com/{0}/status/{1}", quotedTweet.CreatedBy.ScreenName, quotedTweet.Id.ToString(CultureInfo.InvariantCulture)); } } var query = new StringBuilder(string.Format(Resources.Tweet_Publish, CleanupString(text))); if (queryParameters.Parameters != null) { if (queryParameters.InReplyToTweet != null) { query.AddParameterToQuery("in_reply_to_status_id", queryParameters.InReplyToTweet.Id); } query.AddParameterToQuery("possibly_sensitive", queryParameters.PossiblySensitive); if (queryParameters.Coordinates != null) { query.AddParameterToQuery("lat", queryParameters.Coordinates.Latitude.ToString(CultureInfo.InvariantCulture)); query.AddParameterToQuery("long", queryParameters.Coordinates.Longitude.ToString(CultureInfo.InvariantCulture)); } query.AddParameterToQuery("place_id", queryParameters.PlaceId); query.AddParameterToQuery("display_coordinates", queryParameters.DisplayExactCoordinates); query.AddParameterToQuery("trim_user", queryParameters.TrimUser); query.AddParameterToQuery("auto_populate_reply_metadata", queryParameters.AutoPopulateReplyMetadata); query.AddParameterToQuery("tweet_mode", _tweetinviSettingsAccessor.CurrentThreadSettings.TweetMode?.ToString().ToLowerInvariant()); if (queryParameters.MediaIds.Count > 0) { var mediaIdsParameter = string.Join("%2C", queryParameters.MediaIds.Select(x => x.ToString(CultureInfo.InvariantCulture))); query.AddParameterToQuery("media_ids", mediaIdsParameter); } query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(queryParameters.FormattedCustomQueryParameters)); } return(query.ToString()); }
public string GetRetweetsQuery(IGetRetweetsParameters parameters, TweetMode?requestTweetMode) { var tweetId = GetTweetId(parameters.Tweet); var query = new StringBuilder(string.Format(Resources.Tweet_Retweet_GetRetweets, tweetId)); query.AddParameterToQuery("count", parameters.PageSize); query.AddParameterToQuery("trim_user", parameters.TrimUser); _queryParameterGenerator.AppendTweetModeParameter(query, parameters.TweetMode ?? requestTweetMode); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetAuthenticatedUserQuery(IGetAuthenticatedUserParameters parameters) { var query = new StringBuilder(Resources.User_GetCurrentUser); parameters = parameters ?? new GetAuthenticatedUserParameters(); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("include_email", parameters.IncludeEmail); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(parameters.FormattedCustomQueryParameters)); return(query.ToString()); }
public string GetFavoriteTweetsQuery(IGetUserFavoriteTweetsParameters parameters, ComputedTweetMode tweetMode) { var userParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User); var query = new StringBuilder(Resources.User_GetFavorites + userParameter); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); _queryParameterGenerator.AddMinMaxQueryParameters(query, parameters); query.AddParameterToQuery("tweet_mode", tweetMode); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetSearchUsersQuery(ISearchUsersParameters parameters) { var query = new StringBuilder(Resources.Search_SearchUsers); query.AddParameterToQuery("q", parameters.Query); query.AddParameterToQuery("page", parameters.Page); query.AddParameterToQuery("count", parameters.PageSize); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetRetweetsQuery(IGetRetweetsParameters parameters, ComputedTweetMode tweetMode) { var tweetId = GetTweetId(parameters.Tweet); var query = new StringBuilder(string.Format(Resources.Tweet_Retweet_GetRetweets, tweetId)); query.AddParameterToQuery("count", parameters.PageSize); query.AddParameterToQuery("trim_user", parameters.TrimUser); query.AddParameterToQuery("tweet_mode", tweetMode); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetUpdateProfileBannerQuery(IAccountUpdateProfileBannerParameters parameters) { var query = new StringBuilder(Resources.Account_UpdateProfileBanner); query.AddParameterToQuery("width", parameters.Width); query.AddParameterToQuery("height", parameters.Height); query.AddParameterToQuery("offset_left", parameters.OffsetLeft); query.AddParameterToQuery("offset_top", parameters.OffsetTop); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
// User Timeline public string GetUserTimelineQuery(IGetUserTimelineParameters parameters, TweetMode?requestTweetMode) { var query = new StringBuilder(Resources.Timeline_GetUserTimeline); query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User)); _queryParameterGenerator.AddTimelineParameters(query, parameters, requestTweetMode); query.AddParameterToQuery("exclude_replies", parameters.ExcludeReplies); query.AddParameterToQuery("include_rts", parameters.IncludeRetweets); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetListSubscribersQuery(IGetListSubscribersParameters parameters) { var query = new StringBuilder(Resources.List_GetSubscribers); _twitterListQueryParameterGenerator.AppendListIdentifierParameter(query, parameters); _queryParameterGenerator.AppendCursorParameters(query, parameters); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetCheckIfUserIsSubscriberOfListQuery(ICheckIfUserIsSubscriberOfListParameters parameters) { var query = new StringBuilder(Resources.List_CheckSubscriber); _twitterListQueryParameterGenerator.AppendListIdentifierParameter(query, parameters); _userQueryParameterGenerator.AppendUser(query, parameters.User); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
public string GetTrendsAtQuery(IGetTrendsAtParameters parameters) { var query = new StringBuilder(Resources.Trends_GetTrendsFromWoeId); query.AddParameterToQuery("id", parameters.Woeid); if (parameters.Exclude != null && parameters.Exclude != GetTrendsExclude.Nothing) { query.AddParameterToQuery("exclude", parameters.Exclude.ToString().ToLowerInvariant()); } query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return(query.ToString()); }
// Publish Tweet public string GetPublishTweetQuery(IPublishTweetParameters queryParameters) { _tweetQueryValidator.ThrowIfTweetCannotBePublished(queryParameters); var text = queryParameters.Text; if (queryParameters.QuotedTweet != null) { var quotedTweet = queryParameters.QuotedTweet; if (quotedTweet.CreatedBy != null) { text += string.Format("https://twitter.com/{0}/status/{1}", quotedTweet.CreatedBy.ScreenName, quotedTweet.Id.ToString(CultureInfo.InvariantCulture)); } } var query = new StringBuilder(string.Format(Resources.Tweet_Publish, CleanupString(text))); if (queryParameters.Parameters != null) { if (queryParameters.InReplyToTweet != null) { query.AddParameterToQuery("in_reply_to_status_id", queryParameters.InReplyToTweet.Id); } query.AddParameterToQuery("possibly_sensitive", queryParameters.PossiblySensitive); if (queryParameters.Coordinates != null) { query.AddParameterToQuery("lat", queryParameters.Coordinates.Latitude.ToString(CultureInfo.InvariantCulture)); query.AddParameterToQuery("long", queryParameters.Coordinates.Longitude.ToString(CultureInfo.InvariantCulture)); } query.AddParameterToQuery("place_id", queryParameters.PlaceId); query.AddParameterToQuery("display_coordinates", queryParameters.DisplayExactCoordinates); query.AddParameterToQuery("trim_user", queryParameters.TrimUser); if (queryParameters.MediaIds.Count > 0) { var mediaIdsParameter = string.Join("%2C", queryParameters.MediaIds.Select(x => x.ToString(CultureInfo.InvariantCulture))); query.AddParameterToQuery("media_ids", mediaIdsParameter); } query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(queryParameters.FormattedCustomQueryParameters)); } return query.ToString(); }
public string GetUpdateLoggedUserAccountSettingsQuery(IAccountSettingsRequestParameters accountSettingsRequestParameters) { var baseQuery = new StringBuilder(Resources.Account_UpdateSettings); baseQuery.Append(GetLanguagesParameter(accountSettingsRequestParameters.Languages)); baseQuery.AddParameterToQuery("time_zone", accountSettingsRequestParameters.TimeZone); baseQuery.AddParameterToQuery("sleep_time_enabled", accountSettingsRequestParameters.SleepTimeEnabled); baseQuery.AddParameterToQuery("start_sleep_time", accountSettingsRequestParameters.StartSleepTime); baseQuery.AddParameterToQuery("end_sleep_time", accountSettingsRequestParameters.EndSleepTime); baseQuery.AddParameterToQuery("trend_location_woeid", accountSettingsRequestParameters.TrendLocationWoeid); baseQuery.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(accountSettingsRequestParameters.FormattedCustomQueryParameters)); return baseQuery.ToString(); }
public string GetUpdateAuthenticatedUserAccountSettingsQuery(IAccountSettingsRequestParameters accountSettingsRequestParameters) { var baseQuery = new StringBuilder(Resources.Account_UpdateSettings); baseQuery.Append(GetLanguagesParameter(accountSettingsRequestParameters.Languages)); baseQuery.AddParameterToQuery("time_zone", accountSettingsRequestParameters.TimeZone); baseQuery.AddParameterToQuery("sleep_time_enabled", accountSettingsRequestParameters.SleepTimeEnabled); baseQuery.AddParameterToQuery("start_sleep_time", accountSettingsRequestParameters.StartSleepTime); baseQuery.AddParameterToQuery("end_sleep_time", accountSettingsRequestParameters.EndSleepTime); baseQuery.AddParameterToQuery("trend_location_woeid", accountSettingsRequestParameters.TrendLocationWoeid); baseQuery.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(accountSettingsRequestParameters.FormattedCustomQueryParameters)); return(baseQuery.ToString()); }
public string GetSearchTweetsQuery(ITweetSearchParameters tweetSearchParameters) { if (!_searchQueryValidator.IsSearchParameterValid(tweetSearchParameters)) { return null; } var searchQuery = GetQuery(tweetSearchParameters.SearchQuery, tweetSearchParameters.Filters); if (!_searchQueryValidator.IsSearchTweetsQueryValid(searchQuery)) { return null; } var query = new StringBuilder(Resources.Search_SearchTweets); query.AddParameterToQuery("q", searchQuery); query.Append(_searchQueryParameterGenerator.GenerateSearchTypeParameter(tweetSearchParameters.SearchType)); query.Append(_queryParameterGenerator.GenerateSinceIdParameter(tweetSearchParameters.SinceId)); query.Append(_queryParameterGenerator.GenerateMaxIdParameter(tweetSearchParameters.MaxId)); query.Append(_queryParameterGenerator.GenerateCountParameter(tweetSearchParameters.MaximumNumberOfResults)); query.Append(_searchQueryParameterGenerator.GenerateGeoCodeParameter(tweetSearchParameters.GeoCode)); query.Append(_searchQueryParameterGenerator.GenerateLangParameter(tweetSearchParameters.Lang)); query.Append(_searchQueryParameterGenerator.GenerateLocaleParameter(tweetSearchParameters.Locale)); query.Append(_searchQueryParameterGenerator.GenerateSinceParameter(tweetSearchParameters.Since)); query.Append(_searchQueryParameterGenerator.GenerateUntilParameter(tweetSearchParameters.Until)); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(tweetSearchParameters.FormattedCustomQueryParameters)); return query.ToString(); }
public string GetSearchGeoQuery(IGeoSearchParameters parameters) { if (string.IsNullOrEmpty(parameters.Query) && string.IsNullOrEmpty(parameters.IP) && parameters.Coordinates == null && parameters.Attributes.IsNullOrEmpty()) { throw new ArgumentException("You must provide valid coordinates, IP address, query, or attributes."); } var query = new StringBuilder(Resources.Geo_SearchGeo); query.AddParameterToQuery("query", parameters.Query); query.AddParameterToQuery("ip", parameters.IP); if (parameters.Coordinates != null) { query.AddParameterToQuery("lat", parameters.Coordinates.Latitude); query.AddParameterToQuery("long", parameters.Coordinates.Longitude); } foreach (var attribute in parameters.Attributes) { query.AddParameterToQuery(string.Format("attribute:{0}", attribute.Key), attribute.Value); } if (parameters.Granularity != Granularity.Undefined) { query.AddParameterToQuery("granularity", parameters.Granularity.ToString().ToLowerInvariant()); } if (parameters.Accuracy != null) { var accuracyMeasure = parameters.AccuracyMeasure == AccuracyMeasure.Feets ? "ft" : "m"; query.AddParameterToQuery("accuracy", $"{parameters.Accuracy}{accuracyMeasure}"); } query.AddParameterToQuery("max_results", parameters.MaximumNumberOfResults); query.AddParameterToQuery("contained_within", parameters.ContainedWithin); query.AddParameterToQuery("callback", parameters.Callback); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return query.ToString(); }
public string GetLatestMessagesReceivedQuery(IMessagesReceivedParameters queryParameters) { var query = new StringBuilder(string.Format(Resources.Message_GetMessagesReceived, queryParameters.MaximumNumberOfMessagesToRetrieve)); query.Append(_queryParameterGenerator.GenerateMaxIdParameter(queryParameters.MaxId)); query.Append(_queryParameterGenerator.GenerateSinceIdParameter(queryParameters.SinceId)); query.Append(_queryParameterGenerator.GenerateIncludeEntitiesParameter(queryParameters.IncludeEntities)); query.Append(_queryParameterGenerator.GenerateSkipStatusParameter(queryParameters.SkipStatus)); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(queryParameters.FormattedCustomQueryParameters)); query.AddParameterToQuery("full_text", queryParameters.FullText); return query.ToString(); }
// Get Retweets public string GetRetweetsQuery(ITweetIdentifier tweetIdentifier, int maxRetweetsToRetrieve) { _tweetQueryValidator.ValidateTweetIdentifier(tweetIdentifier); var query = new StringBuilder(string.Format(Resources.Tweet_Retweet_GetRetweets, tweetIdentifier.Id)); query.AddParameterToQuery("count", maxRetweetsToRetrieve); return query.ToString(); }
public string GetSearchUsersQuery(IUserSearchParameters userSearchParameters) { var baseQuery = GetSearchUsersQuery(userSearchParameters.SearchQuery); if (string.IsNullOrEmpty(baseQuery)) { return null; } var queryBuilder = new StringBuilder(baseQuery); queryBuilder.AddParameterToQuery("page", userSearchParameters.Page); queryBuilder.Append(_queryParameterGenerator.GenerateCountParameter(userSearchParameters.MaximumNumberOfResults)); queryBuilder.Append(_queryParameterGenerator.GenerateIncludeEntitiesParameter(userSearchParameters.IncludeEntities)); return queryBuilder.ToString(); }
// Get Retweets public string GetRetweetsQuery(ITweetIdentifier tweetIdentifier, int maxRetweetsToRetrieve) { _tweetQueryValidator.ThrowIfTweetCannotBeUsed(tweetIdentifier); var query = new StringBuilder(string.Format(Resources.Tweet_Retweet_GetRetweets, tweetIdentifier.Id)); query.AddParameterToQuery("count", maxRetweetsToRetrieve); query.Append(_queryParameterGenerator.GenerateTweetModeParameter(_tweetinviSettingsAccessor.CurrentThreadSettings.TweetMode)); return query.ToString(); }
public string GetSearchGeoReverseQuery(IGeoSearchReverseParameters parameters) { if (parameters.Coordinates == null) { throw new ArgumentException("You must provide valid coordinates."); } var query = new StringBuilder(Resources.Geo_SearchGeoReverse); if (parameters.Coordinates != null) { query.AddParameterToQuery("lat", parameters.Coordinates.Latitude); query.AddParameterToQuery("long", parameters.Coordinates.Longitude); } if (parameters.Granularity != Granularity.Undefined) { query.AddParameterToQuery("granularity", parameters.Granularity.ToString().ToLowerInvariant()); } query.AddParameterToQuery("accuracy", parameters.Accuracy); query.AddParameterToQuery("max_results", parameters.MaximumNumberOfResults); query.AddParameterToQuery("callback", parameters.Callback); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return query.ToString(); }
// Parameters protected override void AddBaseParametersToQuery(StringBuilder queryBuilder) { base.AddBaseParametersToQuery(queryBuilder); if (_repliesFilterType == RepliesFilterType.AllReplies) { queryBuilder.AddParameterToQuery("replies", "all"); } switch (_withFilterType) { case WithFilterType.Followings: queryBuilder.AddParameterToQuery("with", "followings"); break; case WithFilterType.User: queryBuilder.AddParameterToQuery("with", "user"); break; } }
public string GetSearchUsersQuery(ISearchUsersParameters searchUsersParameters) { if (!_searchQueryValidator.IsSearchQueryValid(searchUsersParameters.SearchQuery)) { throw new ArgumentException("Search query is not valid."); } var queryBuilder = new StringBuilder(Resources.Search_SearchUsers); queryBuilder.AddParameterToQuery("q", _searchQueryParameterGenerator.GenerateSearchQueryParameter(searchUsersParameters.SearchQuery)); queryBuilder.AddParameterToQuery("page", searchUsersParameters.Page); queryBuilder.Append(_queryParameterGenerator.GenerateCountParameter(searchUsersParameters.MaximumNumberOfResults)); queryBuilder.Append(_queryParameterGenerator.GenerateIncludeEntitiesParameter(searchUsersParameters.IncludeEntities)); return queryBuilder.ToString(); }
// Favourites public string GetFavoriteTweetsQuery(IGetUserFavoritesQueryParameters favoriteParameters) { if (!_userQueryValidator.CanUserBeIdentified(favoriteParameters.UserIdentifier)) { return null; } var userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(favoriteParameters.UserIdentifier); var query = new StringBuilder(Resources.User_GetFavourites + userIdentifierParameter); var parameters = favoriteParameters.Parameters; query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("since_id", parameters.SinceId); query.AddParameterToQuery("max_id", parameters.MaxId); query.AddParameterToQuery("count", parameters.MaximumNumberOfTweetsToRetrieve); query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(parameters.FormattedCustomQueryParameters)); return query.ToString(); }
public string GetUpdateProfileBannerQuery(IAccountUpdateProfileBannerParameters parameters) { var query = new StringBuilder(Resources.Account_UpdateProfileBanner); query.AddParameterToQuery("width", parameters.Width); query.AddParameterToQuery("height", parameters.Height); query.AddParameterToQuery("offset_left", parameters.OffsetLeft); query.AddParameterToQuery("offset_top", parameters.OffsetTop); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return query.ToString(); }
public string GetSearchUsersQuery(IUserSearchParameters userSearchParameters) { if (!_searchQueryValidator.IsSearchTweetsQueryValid(userSearchParameters.SearchQuery)) { return null; } var queryBuilder = new StringBuilder(Resources.Search_SearchUsers); queryBuilder.AddParameterToQuery("q", _searchQueryParameterGenerator.GenerateSearchQueryParameter(userSearchParameters.SearchQuery)); queryBuilder.AddParameterToQuery("page", userSearchParameters.Page); queryBuilder.Append(_queryParameterGenerator.GenerateCountParameter(userSearchParameters.MaximumNumberOfResults)); queryBuilder.Append(_queryParameterGenerator.GenerateIncludeEntitiesParameter(userSearchParameters.IncludeEntities)); return queryBuilder.ToString(); }
// Parameters protected virtual void AddBaseParametersToQuery(StringBuilder queryBuilder) { if (_filteredLanguages.Any()) { queryBuilder.AddParameterToQuery("language", string.Join(Uri.EscapeDataString(", "), _filteredLanguages)); } if (StallWarnings) { queryBuilder.AddParameterToQuery("stall_warnings", "true"); } if (FilterLevel != StreamFilterLevel.None) { queryBuilder.AddParameterToQuery("filter_level", FilterLevel.ToString()); } if (!string.IsNullOrEmpty(_customRequestParameters.FormattedCustomQueryParameters)) { queryBuilder.Append(string.Format("&{0}", _customRequestParameters.FormattedCustomQueryParameters)); } }
public string GetUpdateProfilBackgroundImageQuery(IAccountUpdateProfileBackgroundImageParameters parameters) { var query = new StringBuilder(Resources.Account_UpdateProfileBackgroundImage); if (parameters.Binary == null) { query.AddParameterToQuery("media_id", parameters.MediaId); } query.AddParameterToQuery("tile", parameters.UseTileMode); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return query.ToString(); }
// Profile public string GetUpdateProfileParametersQuery(IAccountUpdateProfileParameters parameters) { var query = new StringBuilder(Resources.Account_UpdateProfile); query.AddParameterToQuery("name", parameters.Name); query.AddParameterToQuery("url", parameters.Url); query.AddParameterToQuery("location", parameters.Location); query.AddParameterToQuery("description", parameters.Description); query.AddParameterToQuery("profile_link_color", parameters.ProfileLinkColor); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return query.ToString(); }
public string GetUpdateProfileImageQuery(IAccountUpdateProfileImageParameters parameters) { var query = new StringBuilder(Resources.Account_UpdateProfileImage); query.AddParameterToQuery("include_entities", parameters.IncludeEntities); query.AddParameterToQuery("skip_status", parameters.SkipStatus); query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters); return query.ToString(); }
public string GetRetweeterIdsQuery(ITweetIdentifier tweetIdentifier, int maxRetweetersToRetrieve = 100) { _tweetQueryValidator.ThrowIfTweetCannotBeUsed(tweetIdentifier); var query = new StringBuilder(string.Format(Resources.Tweet_GetRetweeters, tweetIdentifier.Id)); query.AddParameterToQuery("id", tweetIdentifier.Id); query.AddParameterToQuery("count", maxRetweetersToRetrieve); return query.ToString(); }