internal SolidHttpRequest(SolidHttpClient client, HttpMethod method, Uri url, CancellationToken cancellationToken) { Client = client; BaseRequest = new HttpRequestMessage(method, url); CancellationToken = cancellationToken; }
/// <summary> /// Performs a POST request /// </summary> /// <param name="client">The SolidHttpClient</param> /// <param name="url">The url to be requested</param> /// <param name="cancellationToken">The cancellation token for the request</param> /// <returns>SolidHttpRequest</returns> public static SolidHttpRequest PostAsync(this SolidHttpClient client, string url, CancellationToken cancellationToken) { return(client.PostAsync(new Uri(url, UriKind.RelativeOrAbsolute), cancellationToken)); }
/// <summary> /// Performs a POST request /// </summary> /// <param name="client">The SolidHttpClient</param> /// <param name="url">The url to be requested</param> /// <returns>SolidHttpRequest</returns> public static SolidHttpRequest PostAsync(this SolidHttpClient client, Uri url) { return(client.PostAsync(url, CancellationToken.None)); }
/// <summary> /// Performs a POST request /// </summary> /// <param name="client">The SolidHttpClient</param> /// <param name="url">The url to be requested</param> /// <returns>SolidHttpRequest</returns> public static SolidHttpRequest PostAsync(this SolidHttpClient client, string url) { return(client.PostAsync(new Uri(url, UriKind.RelativeOrAbsolute))); }
/// <summary> /// Performs a GET request /// </summary> /// <param name="client">The SolidHttpClient</param> /// <param name="url">The url to be requested</param> /// <param name="cancellationToken">The cancellation token for the request</param> /// <returns>SolidHttpRequest</returns> public static SolidHttpRequest GetAsync(this SolidHttpClient client, Uri url, CancellationToken cancellationToken) { return(client.PerformRequestAsync(HttpMethod.Get, url, cancellationToken)); }
/// <summary> /// Performs a PATCH request /// </summary> /// <param name="client">The SolidHttpClient</param> /// <param name="url">The url to be requested</param> /// <param name="cancellationToken">The cancellation token for the request</param> /// <returns>SolidHttpRequest</returns> public static SolidHttpRequest PatchAsync(this SolidHttpClient client, Uri url, CancellationToken cancellationToken) { var patch = new HttpMethod("PATCH"); return(client.PerformRequestAsync(patch, url, cancellationToken)); }