Exemplo n.º 1
0
        private string BuildUrl()
        {
            var uriPath    = new UriTemplate(UriTemplate);
            var pathParams = GetUriPathParameters();

            foreach (var param in pathParams)
            {
                uriPath.AddParameterFromKeyValuePair(param.Key, param.Value);
            }

            if (ExtendedInfo != null && ExtendedInfo.HasAnySet)
            {
                uriPath.AddParameters(new { extended = ExtendedInfo.Resolve() });
            }

            if (Filter != null && Filter.HasValues)
            {
                uriPath.AddParametersFromDictionary(Filter.GetParameters());
            }

            if (SupportsPagination || SupportsPaginationParameters)
            {
                if (PaginationOptions.Page != null)
                {
                    uriPath.AddParameterFromKeyValuePair("page", PaginationOptions.Page.ToString());
                }

                if (PaginationOptions.Limit != null)
                {
                    uriPath.AddParameterFromKeyValuePair("limit", PaginationOptions.Limit.ToString());
                }
            }

            var uri = uriPath.Resolve();

            return($"{Client.Configuration.BaseUrl}{uri}");
        }