1+ using System ;
2+ using System . Collections . Specialized ;
3+ using System . Threading . Tasks ;
4+ using Skybrud . Essentials . Http . Collections ;
5+
6+ namespace Skybrud . Essentials . Http . Client ;
7+
8+ public partial class HttpClient {
9+
10+ /// <summary>
11+ /// Makes a HTTP DELETE request to the specified <paramref name="url"/>.
12+ /// </summary>
13+ /// <param name="url">The URL of the request.</param>
14+ /// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
15+ public virtual async Task < IHttpResponse > DeleteAsync ( string url ) {
16+ if ( string . IsNullOrWhiteSpace ( url ) ) throw new ArgumentNullException ( nameof ( url ) ) ;
17+ return await GetResponseAsync ( HttpRequest . Delete ( url ) ) ;
18+ }
19+
20+ /// <summary>
21+ /// Makes a DELETE request to the specified <paramref name="url"/>.
22+ /// </summary>
23+ /// <param name="url">The URL of the request.</param>
24+ /// <param name="queryString">The query string of the request.</param>
25+ /// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
26+ public virtual async Task < IHttpResponse > DeleteAsync ( string url , IHttpQueryString ? queryString ) {
27+ if ( string . IsNullOrWhiteSpace ( url ) ) throw new ArgumentNullException ( nameof ( url ) ) ;
28+ return await GetResponseAsync ( HttpRequest . Delete ( url , queryString ) ) ;
29+ }
30+
31+ /// <summary>
32+ /// Makes a DELETE request to the specified <paramref name="url"/>.
33+ /// </summary>
34+ /// <param name="url">The URL of the request.</param>
35+ /// <param name="queryString">The query string of the request.</param>
36+ /// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
37+ public virtual async Task < IHttpResponse > DeleteAsync ( string url , NameValueCollection ? queryString ) {
38+ if ( string . IsNullOrWhiteSpace ( url ) ) throw new ArgumentNullException ( nameof ( url ) ) ;
39+ IHttpQueryString ? query = queryString == null ? null : new HttpQueryString ( queryString ) ;
40+ return await GetResponseAsync ( HttpRequest . Delete ( url , query ) ) ;
41+ }
42+
43+ }
0 commit comments