本文整理汇总了C#中RestSharp.AddParameter方法的典型用法代码示例。如果您正苦于以下问题:C# RestSharp.AddParameter方法的具体用法?C# RestSharp.AddParameter怎么用?C# RestSharp.AddParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RestSharp
的用法示例。
在下文中一共展示了RestSharp.AddParameter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareRequest
public override void PrepareRequest(RestSharp.RestRequest req)
{
req.AddParameter("clientString", _clientString, ParameterType.GetOrPost);
req.AddParameter("client_id", _clientId, ParameterType.GetOrPost);
req.AddParameter("userLogin", _username, ParameterType.GetOrPost);
req.AddParameter("password", _password, ParameterType.GetOrPost);
}
示例2: Authenticate
/// <summary>
/// Adds the API token key to the REST request header
/// </summary>
public void Authenticate(RestSharp.IRestClient client, RestSharp.IRestRequest request)
{
if (!request.Parameters.Any(p => p.Name.Equals("X-TOKEN", StringComparison.OrdinalIgnoreCase)))
{
var token = string.Format("{0}", _apiToken);
request.AddParameter("X-TOKEN", token, ParameterType.HttpHeader);
}
}
示例3: AddAuthTokensAsNecessary
/// <summary>
/// Adds the authentication tokens to the request if the parameters don't include them
/// </summary>
/// <param name="request">The request object to be checked</param>
private RestSharp.IRestRequest AddAuthTokensAsNecessary(RestSharp.IRestRequest request)
{
if (string.IsNullOrEmpty(loginToken) == false && request.Parameters.Count(x => string.Equals(x.Name, clientConfig.TokenCookieName) == true) == 0)
{
request.AddParameter(clientConfig.TokenCookieName, loginToken);
}
if (string.IsNullOrEmpty(sessionToken) == false && request.Parameters.Count(x => string.Equals(x.Name, clientConfig.SessionCookieName) == true) == 0)
{
request.AddParameter(clientConfig.SessionCookieName, sessionToken);
}
return request;
}
示例4: DoBeforeFinishWrite
protected override void DoBeforeFinishWrite(RestSharp.RestRequest req)
{
for (int i = 0; i < this.TopicList.Count; ++i)
{
var topic = this.TopicList[i];
string index = (i + 1).ToString("D2");
req.AddParameter(_nameTag + index, topic.Name);
req.AddParameter(_regexTag + index, topic.Regexes.Cat());
req.AddParameter(_descTag + index, topic.Description);
}
}