2using System.Collections.Generic;
15 if (parameters !=
null)
23 [Obsolete(
"AddQueryParameter is now used to add a query (url) parameter. " +
24 "The old behaviour of adding a ParameterType.GetOrPost parameter by default let to " +
25 "unexpected behaviour at POST time. If you truly wish to use a GetOrPost parameter, " +
26 "you may do so by using one of the explicit AddParameter overloads.")]
38 return String.IsNullOrEmpty(value) ? this :
48 return AddParameter(name, value, ParameterType.HttpHeader);
56 if (parameter ==
null)
57 throw new NullReferenceException(nameof(parameter));
70 string contentType =
null)
72 Add(
new Parameter { Name = name, Value = value, Type = type, ContentType = contentType });
81 if (collection !=
null)
93 return String.Join(
"&", this.OrderBy(p => p.Name)
94 .Select(p => $
"{p.Name}={p.Value}"));
Helper class which makes it easier to build a set of request parameters.
string GetHashString()
Creates and returns a serialized list of all parameters currently in this list sorted by parameter na...
RequestParameters AddParameter(Parameter parameter)
Adds the specified parameter to this list and returns the list.
RequestParameters AddParameter(string name, object value, ParameterType type, string contentType=null)
Adds a new parameter with the specified properties to this list and returns the list.
RequestParameters AddHeader(string name, string value=null)
Adds the specified name/value pair as a HEADER.
RequestParameters AddQueryParameter(string name, string value)
Adds the specified name/value pair as a new request parameter with the type ParameterType....
RequestParameters AddGetParameter(string name, string value)
An obsolete alias for AddQueryParameter. Adds a new request parameter with the type ParameterType....
RequestParameters(IEnumerable< Parameter > parameters=null)
Build a set of request parameters.
RequestParameters AddParameters(IEnumerable< Parameter > collection)
Adds the specified parameters to this list and returns the list.