Exemplo n.º 1
0
        public Stream DeleteEndpointStream(RestHost host, int version, string endpoint, bool enableImpersonation = true, RestDeleteOptions options = null)
        {
            if (options == null)
                options = new RestDeleteOptions();
            var processedEndpoint = ProcessDeleteEndpoint(endpoint, options);


            return _proxy.Post(host, MakeEndpointUrl(host, version, processedEndpoint), null,
                (req) => AdjustDeleteRequest(host, req, enableImpersonation, options));
        }
Exemplo n.º 2
0
        public XElement DeleteEndpointXml(RestHost host, int version, string endpoint, bool enableImpersonation = true, RestDeleteOptions options = null)
        {

            if (options == null)
                options = new RestDeleteOptions();
            var processedEndpoint = ProcessDeleteEndpoint(endpoint, options);


            return XElement.Parse(ReadResponseStream(_proxy.Post(host, MakeEndpointUrl(host, version, processedEndpoint), null, (request) => AdjustDeleteRequest(host, request, enableImpersonation, options))));
        }
Exemplo n.º 3
0
        public async Task<string> DeleteEndpointStringAsync(RestHost host, int version, string endpoint, bool enableImpersonation = true, RestDeleteOptions options = null)
        {
            if (options == null)
                options = new RestDeleteOptions();
            var processedEndpoint = ProcessDeleteEndpoint(endpoint, options);


            var stream = await _proxy.PostAsync(host, MakeEndpointUrl(host, version, processedEndpoint), null, (request) => AdjustDeleteRequest(host, request, enableImpersonation, options));
            return await ReadResponseStreamAsync(stream);
        }
Exemplo n.º 4
0
        private void AdjustDeleteRequest(RestHost host, HttpWebRequest request, bool enableImpersonation, RestDeleteOptions options)
        {
            AdjustRequestBase(host, request, enableImpersonation);

            if (options != null && options.AdditionalHeaders != null)
                SetAdditionalHeaders(request, options.AdditionalHeaders);

            request.Headers["Rest-Method"] = "DELETE";
        }
Exemplo n.º 5
0
        private string ProcessDeleteEndpoint(string endpoint, RestDeleteOptions options)
        {
            var processedEndpoint = endpoint;

            if (options.PathParameters.HasKeys())
                processedEndpoint = ReplaceTokens(endpoint, options.PathParameters);
            if (options.QueryStringParameters.HasKeys())
                processedEndpoint = BuildQueryString(processedEndpoint, options.QueryStringParameters);

            return processedEndpoint;
        }
Exemplo n.º 6
0
        /// <summary>
        /// REST DELETE Request (Async)
        /// </summary>
        /// <param name="version">The REST Api version</param>
        /// <param name="endpoint">The Url without aspi.ashx and ther version</param>
        /// <param name="enableImpersonation">Use the locally authenticated user versus the default</param>
        /// <param name="options">Additional options for this request type.</param>
        /// <returns>Stream</returns>
        public  Task<Stream> DeleteToStreamAsync(int version, string endpoint, bool enableImpersonation = true, RestDeleteOptions options = null)
        {
            return  Rest.DeleteEndpointStreamAsync(this, version, endpoint, enableImpersonation, options);

        }
Exemplo n.º 7
0
 /// <summary>
 /// REST DELETE Request for JSON
 /// </summary>
 /// <param name="version">The REST Api version</param>
 /// <param name="endpoint">The Url without aspi.ashx and ther version</param>
 /// <param name="enableImpersonation">Use the locally authenticated user versus the default</param>
 /// <param name="options">Additional options for this request type.</param>
 /// <returns>dynamic</returns>
 public dynamic DeleteToDynamic(int version, string endpoint, bool enableImpersonation = true, RestDeleteOptions options = null)
 {
     var json = Rest.DeleteEndpointString(this, version, endpoint, enableImpersonation, options);
     return json != null ? JsonConvert.Deserialize(json) : null;
 }
Exemplo n.º 8
0
 /// <summary>
 /// REST DELETE Request for Xml
 /// </summary>
 /// <param name="version">The REST Api version</param>
 /// <param name="endpoint">The Url without aspi.ashx and ther version</param>
 /// <param name="enableImpersonation">Use the locally authenticated user versus the default</param>
 /// <param name="options">Additional options for this request type.</param>
 /// <returns>XElement</returns>
 ///
 public XElement DeleteToXml(int version, string endpoint, bool enableImpersonation = true, RestDeleteOptions options = null)
 {
     return Rest.DeleteEndpointXml(this, version, endpoint, enableImpersonation, options);
 }