Exemplo n.º 1
0
        public string GenerateUrl()
        {
            var builder = new UriBuilder(NormalizedRequestUrl);

            builder.Query = "";

            return(builder.Uri + "?" + UriUtility.FormatQueryString(QueryParameters));
        }
Exemplo n.º 2
0
        public Uri GenerateUri()
        {
            var builder = new UriBuilder(NormalizedRequestUrl);

            IEnumerable <QueryParameter> parameters = UriUtility.ToQueryParametersExcludingTokenSecret(QueryParameters);

            builder.Query = UriUtility.FormatQueryString(parameters);

            return(builder.Uri);
        }
Exemplo n.º 3
0
        public Uri GenerateUriWithoutOAuthParameters()
        {
            var builder = new UriBuilder(NormalizedRequestUrl);

            IEnumerable <QueryParameter> parameters = QueryParameters.ToQueryParameters()
                                                      .Where(q => !q.Key.StartsWith(Parameters.OAuthParameterPrefix));

            builder.Query = UriUtility.FormatQueryString(parameters);

            return(builder.Uri);
        }
Exemplo n.º 4
0
        public override string ToString()
        {
            if (string.IsNullOrEmpty(Problem))
            {
                throw Error.CantBuildProblemReportWhenProblemEmpty();
            }

            var response = new NameValueCollection();

            response[Parameters.OAuth_Problem] = Problem;

            if (!string.IsNullOrEmpty(ProblemAdvice))
            {
                response[Parameters.OAuth_Problem_Advice] = ProblemAdvice.Replace("\r\n", "\n").Replace("\r", "\n");
            }

            if (ParametersAbsent.Count > 0)
            {
                response[Parameters.OAuth_Parameters_Absent] = FormatParameterNames(ParametersAbsent);
            }

            if (ParametersRejected.Count > 0)
            {
                response[Parameters.OAuth_Parameters_Rejected] = FormatParameterNames(ParametersRejected);
            }

            if (AcceptableTimeStampsFrom.HasValue && AcceptableTimeStampsTo.HasValue)
            {
                response[Parameters.OAuth_Acceptable_Timestamps] = string.Format("{0}-{1}",
                                                                                 AcceptableTimeStampsFrom.Value.Epoch(),
                                                                                 AcceptableTimeStampsTo.Value.Epoch());
            }

            if (!(string.IsNullOrEmpty(AcceptableVersionFrom) || string.IsNullOrEmpty(AcceptableVersionTo)))
            {
                response[Parameters.OAuth_Acceptable_Versions] = string.Format("{0}-{1}", AcceptableVersionFrom,
                                                                               AcceptableVersionTo);
            }

            return(UriUtility.FormatQueryString(response));
        }