internal string GetEncodedPath(object requestKey) { string boundPath = BindPathKeys(); if (requestKey == null) { return(boundPath); } else { return(String.Format("{0}{1}{2}", boundPath, UrlConstants.kPathSep, UrlParamUtil.EncodeRequestKeyForPath(requestKey))); } }
private string BindPathKeys() { // baseUrlTemplate begins as "foo/{fooID}/bar/{barID}/baz" // with baz being the actual resource we're calling. string baseUrlTemplate = request.baseUrlTemplate; Dictionary <string, string> encodedPathKeys = UrlParamUtil.EncodePathKeysForUrl(request.pathKeys); string finalString = baseUrlTemplate; foreach (KeyValuePair <string, string> pair in encodedPathKeys) { string target = String.Format("{0}{1}{2}", UrlConstants.kPathKeyTargetBegin, pair.Key, UrlConstants.kPathKeyTargetEnd); finalString = finalString.Replace(target, pair.Value); } return(finalString); }
private string GetEncodedQueryParams(IReadOnlyDictionary <string, object> queryParams) { // Returns "{key1}={value1}&...&{keyN}={valueN}" return(UrlParamUtil.EncodeQueryParams(queryParams.ToDictionary(_ => _.Key, _ => _.Value))); }