public string BuildUrl(string apiPublicKey, string apiPrivateKey, string urlSuffix, int?limit = null, int?offset = null, ICriteria criteria = null) { var url = $"{UrlBase}{urlSuffix}"; var dictionary = criteria?.ToDictionary() ?? new Dictionary <string, string>(); var timestamp = _dateProvider.GetCurrentTime().ToString(ParameterTimeStampFormat); dictionary.Add(ParameterApiKey, apiPublicKey); dictionary.Add(ParameterTimeStamp, timestamp); dictionary.Add(ParameterHash, _hasher.Hash(timestamp + apiPrivateKey + apiPublicKey)); if (limit.HasValue) { dictionary.Add(ParameterLimit, limit.Value.ToString()); } if (offset.HasValue) { dictionary.Add(ParameterOffset, offset.Value.ToString()); } return(url + "?" + string.Join("&", dictionary.Select(p => $"{p.Key}={HttpUtility.UrlPathEncode(p.Value)}"))); }