Пример #1
0
        public ApiUrlBuilder WithTagAndPeriod(string tag, string period)
        {
            MakeSure.ArgumentNotNull(tag, nameof(tag));
            MakeSure.ArgumentNotNull(period, nameof(period));

            _apiUrl = _apiUrl + $"{tag}/{period}";
            return(this);
        }
Пример #2
0
        public ApiUrlBuilder WithIds(List <string> ids, string route = "")
        {
            MakeSure.ArgumentNotNullOrEmptyEnumerable(ids, nameof(ids));
            var idsToEncode = string.Join(";", ids.ToArray());

            if (string.IsNullOrEmpty(route) || string.IsNullOrWhiteSpace(route))
            {
                _apiUrl = _apiUrl + $"{HttpUtility.UrlEncode(idsToEncode)}";
            }
            else
            {
                _apiUrl = _apiUrl + $"{HttpUtility.UrlEncode(idsToEncode)}/{route}";
            }
            return(this);
        }
Пример #3
0
        public ApiUrlBuilder WithFilter(Filter filter, string inName = "")
        {
            MakeSure.ArgumentNotNull(filter, nameof(filter));

            if (string.IsNullOrEmpty(inName) || string.IsNullOrWhiteSpace(inName))
            {
                _filter = filter.GetQueryParams();
            }
            else
            {
                _filter = $"{filter.GetQueryParams()}&inname={inName}";
            }

            return(this);
        }