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

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

            urlParams.AddRequired("rev", request.Rev);

            return string.Format("/{0}{1}", new UrlSegment(request.Id), new QueryString(urlParams));
        }
Пример #3
0
 protected virtual HttpRequest CreateHttpRequest(DeleteDocumentRequest request)
 {
     return DeleteDocumentHttpRequestFactory.Create(request);
 }
Пример #4
0
        public virtual async Task<DocumentHeaderResponse> DeleteAsync(DeleteDocumentRequest request)
        {
            Ensure.That(request, "request").IsNotNull();

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