33// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44// </copyright>
55
6- using System ;
7-
86namespace SendGrid
97{
10- using System . Collections . Generic ;
11- using System . Net . Http ;
12- using System . Net . Http . Headers ;
13- using System . Threading ;
14- using System . Threading . Tasks ;
15- using Helpers . Mail ;
8+ using Helpers . Mail ;
9+ using System . Collections . Generic ;
10+ using System . Net . Http ;
11+ using System . Net . Http . Headers ;
12+ using System . Threading ;
13+ using System . Threading . Tasks ;
1614
17- /// <summary>
18- /// A HTTP client wrapper for interacting with SendGrid's API
19- /// </summary>
20- public interface ISendGridClient
21- {
22- /// <summary>
23- /// Gets or sets the path to the API resource.
24- /// </summary>
25- string UrlPath { get ; set ; }
15+ /// <summary>
16+ /// A HTTP client wrapper for interacting with SendGrid's API
17+ /// </summary>
18+ public interface ISendGridClient
19+ {
20+ /// <summary>
21+ /// Gets or sets the path to the API resource.
22+ /// </summary>
23+ string UrlPath { get ; set ; }
2624
27- /// <summary>
28- /// Gets or sets the API version.
29- /// </summary>
30- string Version { get ; set ; }
25+ /// <summary>
26+ /// Gets or sets the API version.
27+ /// </summary>
28+ string Version { get ; set ; }
3129
32- /// <summary>
33- /// Gets or sets the request media type.
34- /// </summary>
35- string MediaType { get ; set ; }
30+ /// <summary>
31+ /// Gets or sets the request media type.
32+ /// </summary>
33+ string MediaType { get ; set ; }
3634
37- /// <summary>
38- /// Add the authorization header, override to customize
39- /// </summary>
40- /// <param name="header">Authorization header</param>
41- /// <returns>Authorization value to add to the header</returns>
42- AuthenticationHeaderValue AddAuthorization ( KeyValuePair < string , string > header ) ;
35+ /// <summary>
36+ /// Add the authorization header, override to customize
37+ /// </summary>
38+ /// <param name="header">Authorization header</param>
39+ /// <returns>Authorization value to add to the header</returns>
40+ AuthenticationHeaderValue AddAuthorization ( KeyValuePair < string , string > header ) ;
4341
44- /// <summary>
45- /// Make the call to the API server, override for testing or customization
46- /// </summary>
47- /// <param name="request">The parameters for the API call</param>
48- /// <param name="cancellationToken">Cancel the asynchronous call</param>
49- /// <returns>Response object</returns>
50- Task < Response > MakeRequest ( HttpRequestMessage request , CancellationToken cancellationToken = default ( CancellationToken ) ) ;
42+ /// <summary>
43+ /// Make the call to the API server, override for testing or customization
44+ /// </summary>
45+ /// <param name="request">The parameters for the API call</param>
46+ /// <param name="cancellationToken">Cancel the asynchronous call</param>
47+ /// <returns>Response object</returns>
48+ Task < Response > MakeRequest ( HttpRequestMessage request , CancellationToken cancellationToken = default ( CancellationToken ) ) ;
5149
52- /// <summary>
53- /// Prepare for async call to the API server
54- /// </summary>
55- /// <param name="method">HTTP verb</param>
56- /// <param name="requestBody">JSON formatted string</param>
57- /// <param name="queryParams">JSON formatted query paramaters</param>
58- /// <param name="urlPath">The path to the API endpoint.</param>
59- /// <param name="cancellationToken">Cancel the asynchronous call.</param>
60- /// <returns>Response object</returns>
61- /// <exception cref="Exception" >The method will NOT catch and swallow exceptions generated by sending a request
62- /// through the internal http client. Any underlying exception will pass right through.
63- /// In particular, this means that you may expect
64- /// a TimeoutException if you are not connected to the internet.</exception>
65- Task < Response > RequestAsync ( SendGridClient . Method method , string requestBody = null , string queryParams = null , string urlPath = null , CancellationToken cancellationToken = default ( CancellationToken ) ) ;
50+ /// <summary>
51+ /// Prepare for async call to the API server
52+ /// </summary>
53+ /// <param name="method">HTTP verb</param>
54+ /// <param name="requestBody">JSON formatted string</param>
55+ /// <param name="queryParams">JSON formatted query paramaters</param>
56+ /// <param name="urlPath">The path to the API endpoint.</param>
57+ /// <param name="cancellationToken">Cancel the asynchronous call.</param>
58+ /// <returns>Response object</returns>
59+ /// <exception>The method will NOT catch and swallow exceptions generated by sending a request
60+ /// through the internal http client. Any underlying exception will pass right through.
61+ /// In particular, this means that you may expect
62+ /// a TimeoutException if you are not connected to the internet.</exception>
63+ Task < Response > RequestAsync ( SendGridClient . Method method , string requestBody = null , string queryParams = null , string urlPath = null , CancellationToken cancellationToken = default ( CancellationToken ) ) ;
6664
67- /// <summary>
68- /// Make a request to send an email through SendGrid asychronously.
69- /// </summary>
70- /// <param name="msg">A SendGridMessage object with the details for the request.</param>
71- /// <param name="cancellationToken">Cancel the asychronous call.</param>
72- /// <returns>A Response object.</returns>
73- Task < Response > SendEmailAsync ( SendGridMessage msg , CancellationToken cancellationToken = default ( CancellationToken ) ) ;
74- }
75- }
65+ /// <summary>
66+ /// Make a request to send an email through SendGrid asychronously.
67+ /// </summary>
68+ /// <param name="msg">A SendGridMessage object with the details for the request.</param>
69+ /// <param name="cancellationToken">Cancel the asychronous call.</param>
70+ /// <returns>A Response object.</returns>
71+ Task < Response > SendEmailAsync ( SendGridMessage msg , CancellationToken cancellationToken = default ( CancellationToken ) ) ;
72+ }
73+ }
0 commit comments