public virtual HttpRequest Create(GetDocumentRequest request)
        {
            Ensure.That(request, "request").IsNotNull();

            return new HttpRequest(HttpMethod.Get, GenerateRelativeUrl(request))
                .SetRequestTypeHeader(request.GetType())
                .SetIfMatchHeader(request.Rev);
        }
        protected virtual string GenerateRelativeUrl(GetDocumentRequest request)
        {
            var urlParams = new UrlParams();

            urlParams.AddIfNotNullOrWhiteSpace("rev", request.Rev);
            urlParams.AddIfTrue("conflicts", request.Conflicts);

            return string.Format("/{0}{1}", new UrlSegment(request.Id), new QueryString(urlParams));
        }
예제 #3
0
 protected virtual HttpRequest CreateHttpRequest(GetDocumentRequest request)
 {
     return GetDocumentHttpRequestFactory.Create(request);
 }
예제 #4
0
        public virtual async Task<DocumentResponse> GetAsync(GetDocumentRequest request)
        {
            Ensure.That(request, "request").IsNotNull();

            using (var httpRequest = CreateHttpRequest(request))
            {
                using (var res = await SendAsync(httpRequest).ForAwait())
                {
                    return ProcessDocumentResponse(res);
                }
            }
        }