私はRESTSharpを使用してRESTスタイルのサービスを利用しています。このライブラリはかなり新しく、RestSharpを使用してページングを実装する方法についてのガイダンスをいただければ幸いです。
これを達成する方法に関する既存の例はありますか?
RestSharp- http: //restsharp.org/
ありがとう
私はRESTSharpを使用してRESTスタイルのサービスを利用しています。このライブラリはかなり新しく、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);
}