3
我正在使用RestSharp来使用REST样式服务。 这个库很新颖,希望能对如何使用RestSharp实现分页提供一些指导。如何使用RestSharp实现分页
有关如何实现此目的的任何现有示例?
RestSharp - http://restsharp.org/
感谢
我正在使用RestSharp来使用REST样式服务。 这个库很新颖,希望能对如何使用RestSharp实现分页提供一些指导。如何使用RestSharp实现分页
有关如何实现此目的的任何现有示例?
RestSharp - http://restsharp.org/
感谢
有没有分页固有RestSharp的概念。这只是HTTP调用的一个简单封装,所以这就是您调用的HTTP端点决定哪些功能可用,比如如何处理分页。
下面是支持分页的API,以及如何将与RestSharp把它的一个例子:
public CallResult ListCalls(CallListRequest options, int pageNumber, int count)
{
var request = new RestRequest();
request.Resource = "Accounts/{AccountSid}/Calls.json";
request.AddParameter("From", options.From);
request.AddParameter("To", options.To);
request.AddParameter("Url", options.Url);
// send paging parameters required by API
request.AddParameter("Page", pageNumber);
request.AddParameter("PageSize", count);
var client = new RestClient("http://example.com");
return client.Execute<CallResult>(request);
}
感谢这个解释和示例代码。谢谢! – 2012-02-06 23:16:28