Represents parameters for the UNLOCK WebDAV method.
Beispiel #1
0
        /// <summary>
        /// Removes the lock identified by the lock token from the resource identified by the request URI.
        /// </summary>
        /// <param name="requestUri">The <see cref="Uri"/> to request.</param>
        /// <param name="parameters">Parameters of the UNLOCK operation.</param>
        /// <returns>An instance of <see cref="WebDavResponse" />.</returns>
        public async Task <WebDavResponse> Unlock(Uri requestUri, UnlockParameters parameters)
        {
            Guard.NotNull(requestUri, "requestUri");

            var headers = new HeaderBuilder()
                          .Add(WebDavHeaders.LockToken, $"<{parameters.LockToken}>")
                          .AddWithOverwrite(parameters.Headers)
                          .Build();

            var requestParams = new RequestParameters {
                Headers = headers
            };
            var response = await _dispatcher.Send(requestUri, WebDavMethod.Unlock, requestParams, parameters.CancellationToken).ConfigureAwait(false);

            return(new WebDavResponse((int)response.StatusCode, response.ReasonPhrase));
        }
Beispiel #2
0
        /// <summary>
        /// Removes the lock identified by the lock token from the resource identified by the request URI.
        /// </summary>
        /// <param name="requestUri">The <see cref="System.Uri"/> to request.</param>
        /// <param name="parameters">Parameters of the UNLOCK operation.</param>
        /// <returns>An instance of <see cref="WebDavResponse" /></returns>
        public async Task <WebDavResponse> Unlock(Uri requestUri, UnlockParameters parameters)
        {
            Guard.NotNull(requestUri, "requestUri");

            var headers = new RequestHeaders
            {
                new KeyValuePair <string, string>("Lock-Token", $"<{parameters.LockToken}>")
            };

            var requestParams = new RequestParameters {
                Headers = headers
            };
            var response = await _dispatcher.Send(requestUri, WebDavMethod.Unlock, requestParams, parameters.CancellationToken);

            return(new WebDavResponse(response.StatusCode, response.Description));
        }
        /// <summary>
        /// Removes the lock identified by the lock token from the resource identified by the request URI.
        /// </summary>
        /// <param name="requestUri">The <see cref="Uri"/> to request.</param>
        /// <param name="parameters">Parameters of the UNLOCK operation.</param>
        /// <returns>An instance of <see cref="WebDavResponse" />.</returns>
        public WebDavResponse Unlock(Uri requestUri, UnlockParameters parameters)
        {
            Guard.NotNull(requestUri, "requestUri");

            var headers = new HeaderBuilder()
                          .Add(WebDavHeaders.LockToken, $"<{parameters.LockToken}>")
                          .AddWithOverwrite(parameters.Headers)
                          .Build();

            var requestParams = new RequestParameters {
                Headers = headers
            };

            using (var response = _dispatcher.Send(requestUri, WebDavMethod.Unlock, requestParams))
            {
                return(new WebDavResponse((int)response.StatusCode, response.StatusDescription));
            }
        }
 /// <summary>
 /// Removes the lock identified by the lock token from the resource identified by the request URI.
 /// </summary>
 /// <param name="requestUri">A string that represents the request URI.</param>
 /// <param name="parameters">Parameters of the UNLOCK operation.</param>
 /// <returns>An instance of <see cref="WebDavResponse" />.</returns>
 public WebDavResponse Unlock(string requestUri, UnlockParameters parameters)
 {
     return(Unlock(CreateUri(requestUri), parameters));
 }