Пример #1
0
        public static Uri BuildUri(Uri baseUri, Version requestedApiVersion, string path, IQueryString queryString)
        {
            if (baseUri == null)
            {
                throw new ArgumentNullException("baseUri");
            }

            UriBuilder builder = new UriBuilder(baseUri);

            if (requestedApiVersion != null)
            {
                builder.Path += string.Format(CultureInfo.InvariantCulture, "v{0}/", requestedApiVersion);
            }

            if (!string.IsNullOrEmpty(path))
            {
                builder.Path += path;
            }

            if (queryString != null)
            {
                builder.Query = queryString.GetQueryString();
            }

            return builder.Uri;
        }
Пример #2
0
        public static Uri BuildUri(Uri baseUri, Version requestedApiVersion, string path, IQueryString queryString)
        {
            if (baseUri == null)
            {
                throw new ArgumentNullException(nameof(baseUri));
            }

            var builder = new UriBuilder(baseUri);

            if (requestedApiVersion != null)
            {
                builder.Path += $"v{requestedApiVersion}/";
            }

            if (!string.IsNullOrEmpty(path))
            {
                builder.Path += path;
            }

            if (queryString != null)
            {
                builder.Query = queryString.GetQueryString();
            }

            return(builder.Uri);
        }
Пример #3
0
        public static Uri BuildUri(Uri baseUri, Version requestedApiVersion, string path, IQueryString queryString)
        {
            if (baseUri == null)
            {
                throw new ArgumentNullException(nameof(baseUri));
            }

            UriBuilder builder = new UriBuilder(baseUri);

            if (requestedApiVersion != null)
            {
                builder.Path += string.Format(CultureInfo.InvariantCulture, "v{0}/", requestedApiVersion);
            }

            if (!string.IsNullOrEmpty(path))
            {
                builder.Path += path;
            }

            if (queryString != null)
            {
                builder.Query = queryString.GetQueryString();
            }

            return(builder.Uri);
        }
        internal static Uri BuildUri(this Uri baseUri, string path, IQueryString queryString)
        {
            if (baseUri == null)
            {
                throw new ArgumentNullException(nameof(baseUri));
            }

            var builder = new UriBuilder(baseUri);

            if (!string.IsNullOrEmpty(path))
            {
                builder.Path += path;
            }

            if (queryString != null)
            {
                builder.Query = queryString.GetQueryString();
            }

            return(builder.Uri);
        }