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

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

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

            urlParams.AddRequired("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<DocumentHeaderResponse> DeleteAsync(DeleteAttachmentRequest request)
        {
            Ensure.That(request, "request").IsNotNull();

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