当前位置: 首页>>代码示例>>C#>>正文


C# StringBuilder.AddParameterToQuery方法代码示例

本文整理汇总了C#中StringBuilder.AddParameterToQuery方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.AddParameterToQuery方法的具体用法?C# StringBuilder.AddParameterToQuery怎么用?C# StringBuilder.AddParameterToQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringBuilder的用法示例。


在下文中一共展示了StringBuilder.AddParameterToQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetClosestTrendLocationsQuery

        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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:9,代码来源:TrendsQueryGenerator.cs

示例2: GetAuthenticatedUserQuery

        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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:12,代码来源:UserQueryParameterGenerator.cs

示例3: GetPublishTweetQuery

        // 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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:50,代码来源:TweetQueryGenerator.cs

示例4: GetUpdateLoggedUserAccountSettingsQuery

        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();
        }
开发者ID:SowaLabs,项目名称:Tweetinvi-obsolete,代码行数:15,代码来源:AccountQueryGenerator.cs

示例5: GetSearchTweetsQuery

        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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:31,代码来源:SearchQueryGenerator.cs

示例6: GetLatestMessagesReceivedQuery

        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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:13,代码来源:MessageQueryGenerator.cs

示例7: GetUpdateProfilBackgroundImageQuery

        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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:17,代码来源:AccountQueryGenerator.cs

示例8: AddBaseParametersToQuery

        // 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));
            }
        }
开发者ID:jalbright10,项目名称:tweetinvi,代码行数:23,代码来源:TwitterStream.cs

示例9: GetUpdateProfileParametersQuery

        // 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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:17,代码来源:AccountQueryGenerator.cs

示例10: GetRetweetsQuery

        // 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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:11,代码来源:TweetQueryGenerator.cs

示例11: GetUpdateProfileBannerQuery

        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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:13,代码来源:AccountQueryGenerator.cs

示例12: GetFavoriteTweetsQuery

        // 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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:22,代码来源:UserQueryGenerator.cs

示例13: GetSearchUsersQuery

        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();
        }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:16,代码来源:SearchQueryGenerator.cs

示例14: GetSearchUsersQuery

        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();
        }
开发者ID:Murtaza-libs,项目名称:tweetinvi,代码行数:16,代码来源:SearchQueryGenerator.cs

示例15: AddBaseParametersToQuery

        // 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;
            }
        }
开发者ID:rudiv,项目名称:tweetinvi,代码行数:20,代码来源:UserStream.cs


注:本文中的StringBuilder.AddParameterToQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。