// BLOCK
        public string GetBlockUserQuery(IBlockUserParameters parameters)
        {
            var query = new StringBuilder(Resources.User_Block_Create);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
        public string GetUnmuteUserQuery(IUnmuteUserParameters parameters)
        {
            var query = new StringBuilder(Resources.Account_Mute_Destroy);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
        public string GetRelationshipsWithQuery(IGetRelationshipsWithParameters parameters)
        {
            var query = new StringBuilder(Resources.Friendship_GetRelationships);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateListOfUserIdentifiersParameter(parameters.Users));
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
        public string GetFollowerIdsQuery(IGetFollowerIdsParameters parameters)
        {
            var query = new StringBuilder(Resources.User_GetFollowers);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));
            _queryParameterGenerator.AppendCursorParameters(query, parameters);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
        public string GetReportUserForSpamQuery(IReportUserForSpamParameters parameters)
        {
            var query = new StringBuilder(Resources.User_Report_Spam);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));
            query.AddParameterToQuery("perform_block", parameters.PerformBlock);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
        // FOLLOWERS
        public string GetFollowUserQuery(IFollowUserParameters parameters)
        {
            var query = new StringBuilder(Resources.Friendship_Create);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));
            query.AddParameterToQuery("follow", parameters.EnableNotifications);
            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());
        }
Example #9
0
        public string GetListsSubscribedByUserQuery(IGetListsSubscribedByUserParameters parameters)
        {
            var query = new StringBuilder(Resources.List_GetUserLists);

            query.AddFormattedParameterToQuery(_userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.User));
            query.AddParameterToQuery("reverse", parameters.Reverse);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
Example #10
0
        public string GetAddMultipleMembersToListQuery(ITwitterListIdentifier listIdentifier, IEnumerable <IUserIdentifier> userIdentifiers)
        {
            _listsQueryValidator.ThrowIfListIdentifierIsNotValid(listIdentifier);

            var userIdsAndScreenNameParameter = _userQueryParameterGenerator.GenerateListOfUserIdentifiersParameter(userIdentifiers);
            var query = new StringBuilder(Resources.List_CreateMembers);

            query.AddFormattedParameterToQuery(_twitterListQueryParameterGenerator.GenerateIdentifierParameter(listIdentifier));
            query.AddFormattedParameterToQuery(userIdsAndScreenNameParameter);

            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 GetRelationshipBetweenQuery(IGetRelationshipBetweenParameters parameters)
        {
            var sourceParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.SourceUser, "source_id", "source_screen_name");
            var targetParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(parameters.TargetUser, "target_id", "target_screen_name");

            var query = new StringBuilder(Resources.Friendship_GetRelationship);

            query.AddFormattedParameterToQuery(sourceParameter);
            query.AddFormattedParameterToQuery(targetParameter);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
Example #13
0
        // 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 GetAccountActivityWebhookEnvironmentsQuery(IGetAccountActivityWebhookEnvironmentsParameters parameters)
        {
            var query = new StringBuilder(Resources.Webhooks_AccountActivity_GetAllWebhooks);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #15
0
        public string GetInvalidateAccessTokenQuery(IInvalidateAccessTokenParameters parameters)
        {
            var query = new StringBuilder(Resources.Auth_InvalidateAccessToken);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
        public string GetAccountActivitySubscriptionsQuery(IGetAccountActivitySubscriptionsParameters parameters)
        {
            var query = new StringBuilder($"https://api.twitter.com/1.1/account_activity/all/{parameters.Environment}/subscriptions/list.json");

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
        public string GetTriggerAccountActivityWebhookCRCQuery(ITriggerAccountActivityWebhookCRCParameters parameters)
        {
            var query = new StringBuilder($"{Resources.Webhooks_AccountActivity_All}/{parameters.Environment}/webhooks/{parameters.WebhookId}.json?");

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #18
0
        public string GetTrendsLocationQuery(IGetTrendsLocationParameters parameters)
        {
            var query = new StringBuilder(Resources.Trends_GetAvailableTrendsLocations);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #19
0
        public string GetDeleteRulesFromFilteredStreamQuery(IDeleteRulesFromFilteredStreamV2Parameters parameters)
        {
            var query = new StringBuilder("https://api.twitter.com/2/tweets/search/stream/rules");

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
        // MUTE
        public string GetUserIdsWhoseRetweetsAreMutedQuery(IGetUserIdsWhoseRetweetsAreMutedParameters parameters)
        {
            var query = new StringBuilder(Resources.Friendship_FriendIdsWithNoRetweets);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
        public string GetAccountActivityEnvironmentWebhooksQuery(IGetAccountActivityEnvironmentWebhooksParameters parameters)
        {
            var query = new StringBuilder($"{Resources.Webhooks_AccountActivity_All}/{parameters.Environment}/webhooks.json");

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #22
0
        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());
        }
Example #23
0
        public string GetSupportedLanguagesQuery(IGetSupportedLanguagesParameters parameters)
        {
            var query = new StringBuilder(Resources.Help_GetSupportedLanguages);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #24
0
        public string GetPlaceQuery(IGetPlaceParameters parameters)
        {
            var query = new StringBuilder(string.Format(Resources.Geo_GetPlaceFromId, parameters.PlaceId));

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #25
0
        public string GetRateLimitsQuery(IGetRateLimitsParameters parameters)
        {
            var query = new StringBuilder(Resources.Help_GetRateLimit);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #26
0
        public string GetTwitterConfigurationQuery(IGetTwitterConfigurationParameters parameters)
        {
            var query = new StringBuilder(Resources.Help_GetTwitterConfiguration);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
        public string GetChangeTweetReplyVisibilityQuery(IChangeTweetReplyVisibilityV2Parameters parameters)
        {
            var query = new StringBuilder($"https://api.twitter.com/2/tweets/{parameters.Id}/hidden");

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #28
0
        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());
        }
        // Download Profile Image
        public string DownloadProfileImageURL(IGetProfileImageParameters parameters)
        {
            var query = new StringBuilder(parameters.ImageUrl.Replace("_normal", $"_{parameters.ImageSize.ToString().ToLowerInvariant()}"));

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);
            return(query.ToString());
        }
Example #30
0
        public string GetCheckIfUserIsAListSubscriberQuery(ITwitterListIdentifier listIdentifier, IUserIdentifier userIdentifier)
        {
            _listsQueryValidator.ThrowIfListIdentifierIsNotValid(listIdentifier);
            _userQueryValidator.ThrowIfUserCannotBeIdentified(userIdentifier);

            var listIdentifierParameter = _twitterListQueryParameterGenerator.GenerateIdentifierParameter(listIdentifier);
            var userIdentifierParameter = _userQueryParameterGenerator.GenerateIdOrScreenNameParameter(userIdentifier);

            var query = new StringBuilder(Resources.List_CheckSubscriber);

            query.AddFormattedParameterToQuery(listIdentifierParameter);
            query.AddFormattedParameterToQuery(userIdentifierParameter);
            query.AddParameterToQuery("skip_status", "true");

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

            query.AddParameterToQuery("accuracy", parameters.Accuracy);
            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 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 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();
        }
Example #35
0
        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();
        }
        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();
        }