15
15
namespace RestSharp ;
16
16
17
17
public static partial class RestRequestExtensions {
18
-
19
18
/// <summary>
20
19
/// Adds a URL segment parameter to the request. The resource URL must have a placeholder for the parameter for it to work.
21
20
/// For example, if you add a URL segment parameter with the name "id", the resource URL should contain {id} in its path.
22
21
/// </summary>
23
22
/// <param name="request">Request instance</param>
24
- /// <param name="name">Name of the parameter, must be matching a placeholder in the resource URL as {name}</param>
23
+ /// <param name="name">Name of the parameter; must be matching a placeholder in the resource URL as {name}</param>
25
24
/// <param name="value">Value of the parameter</param>
26
25
/// <param name="encode">Encode the value or not, default true</param>
27
26
/// <returns></returns>
28
- public static RestRequest AddUrlSegment ( this RestRequest request , string name , string value , bool encode = true )
27
+ public static RestRequest AddUrlSegment ( this RestRequest request , string name , string ? value , bool encode = true )
29
28
=> request . AddParameter ( new UrlSegmentParameter ( name , value , encode ) ) ;
30
29
31
30
/// <summary>
32
31
/// Adds a URL segment parameter to the request. The resource URL must have a placeholder for the parameter for it to work.
33
32
/// For example, if you add a URL segment parameter with the name "id", the resource URL should contain {id} in its path.
34
33
/// </summary>
35
34
/// <param name="request">Request instance</param>
36
- /// <param name="name">Name of the parameter, must be matching a placeholder in the resource URL as {name}</param>
35
+ /// <param name="name">Name of the parameter; must be matching a placeholder in the resource URL as {name}</param>
37
36
/// <param name="value">Value of the parameter</param>
38
37
/// <param name="encode">Encode the value or not, default true</param>
39
38
/// <returns></returns>
40
39
public static RestRequest AddUrlSegment < T > ( this RestRequest request , string name , T value , bool encode = true ) where T : struct
41
- => request . AddUrlSegment ( name , Ensure . NotNull ( value . ToString ( ) , nameof ( value ) ) , encode ) ;
40
+ => request . AddUrlSegment ( name , value . ToString ( ) , encode ) ;
42
41
}
0 commit comments