12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
+ using System ;
16
+ using JetBrains . Annotations ;
17
+
15
18
namespace RestSharp
16
19
{
17
20
/// <summary>
18
21
/// Representation of an HTTP parameter (QueryString or Form value)
19
22
/// </summary>
23
+ [ PublicAPI ]
20
24
public class HttpParameter
21
25
{
22
26
/// <summary>
23
- /// Name of the parameter
27
+ /// Creates a new instance of HttpParameter
28
+ /// </summary>
29
+ /// <param name="name">Header name</param>
30
+ /// <param name="value">Header value</param>
31
+ /// <param name="contentType">Parameter content type</param>
32
+ public HttpParameter ( string name , string value , string contentType = null )
33
+ {
34
+ Name = name ;
35
+ ContentType = contentType ;
36
+ Value = value ?? "" ;
37
+ }
38
+
39
+ /// <summary>
40
+ /// Creates a new instance of HttpParameter with value conversion
41
+ /// </summary>
42
+ /// <param name="name">Header name</param>
43
+ /// <param name="value">Header value, which has to implement ToString() properly</param>
44
+ /// <param name="contentType">Parameter content type</param>
45
+ public HttpParameter ( string name , object value , string contentType = null ) : this ( name , value ? . ToString ( ) , contentType ) { }
46
+
47
+ [ Obsolete ( "Use parameterized constructor" ) ]
48
+ public HttpParameter ( ) { }
49
+
50
+ /// <summary>
51
+ /// Name of the parameter
24
52
/// </summary>
25
53
public string Name { get ; set ; }
26
54
@@ -34,4 +62,4 @@ public class HttpParameter
34
62
/// </summary>
35
63
public string ContentType { get ; set ; }
36
64
}
37
- }
65
+ }
0 commit comments