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

            var httpRequest = new HttpRequest(HttpMethod.Get, GenerateRelativeUrl(request))
                .SetRequestTypeHeader(request.GetType())
                .SetIfMatchHeader(request.DocRev);

            return httpRequest;
        }
        protected virtual string GenerateRelativeUrl(GetAttachmentRequest request)
        {
            var urlParams = new UrlParams();

            urlParams.AddIfNotNullOrWhiteSpace("rev", request.DocRev);

            return string.Format("/{0}/{1}{2}",
                new UrlSegment(request.DocId),
                new UrlSegment(request.Name),
                new QueryString(urlParams));
        }
Esempio n. 3
0
        public virtual async Task<AttachmentResponse> GetAsync(GetAttachmentRequest request)
        {
            Ensure.That(request, "request").IsNotNull();

            using (var httpRequest = CreateHttpRequest(request))
            {
                using (var res = await SendAsync(httpRequest).ForAwait())
                {
                    return ProcessAttachmentResponse(res);
                }
            }
        }
Esempio n. 4
0
 protected virtual HttpRequest CreateHttpRequest(GetAttachmentRequest request)
 {
     return GetAttachmentHttpRequestFactory.Create(request);
 }