当前位置: 首页>>代码示例>>C#>>正文


C# UrlBuilder.QueryParam方法代码示例

本文整理汇总了C#中UrlBuilder.QueryParam方法的典型用法代码示例。如果您正苦于以下问题:C# UrlBuilder.QueryParam方法的具体用法?C# UrlBuilder.QueryParam怎么用?C# UrlBuilder.QueryParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UrlBuilder的用法示例。


在下文中一共展示了UrlBuilder.QueryParam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: History

 /// <summary>
 /// Fetches the history of transactions run for this user. The current balance (resulting values) needs to be queried
 /// via a different call (Balance).
 /// </summary>
 /// <returns>Promise resolved when the operation has completed. The result is paginated, for more information see
 ///     #CotcSdk.PagedList<DataType>.</returns>
 /// <param name="unit">If specified, retrieves only the transactions matching a given unit (e.g. "gold").</param>
 /// <param name="limit">For pagination, allows to set a greater or smaller page size than the default 30.</param>
 /// <param name="offset">For pagination, avoid using it explicitly.</param>
 public Promise<PagedList<Transaction>> History(string unit = null, int limit = 30, int offset = 0)
 {
     UrlBuilder url = new UrlBuilder("/v1/gamer/tx").Path(domain).QueryParam("skip", offset).QueryParam("limit", limit);
     if (unit != null) url.QueryParam("unit", unit);
     // Request for current results
     return Common.RunInTask<PagedList<Transaction>>(Gamer.MakeHttpRequest(url), (response, task) => {
         PagedList<Transaction> transactions = new PagedList<Transaction>(response.BodyJson, offset, response.BodyJson["count"]);
         foreach (Bundle b in response.BodyJson["history"].AsArray()) {
             transactions.Add(new Transaction(b));
         }
         // Handle pagination
         if (offset > 0) {
             transactions.Previous = () => History(unit, limit, offset - limit);
         }
         if (offset + transactions.Count < transactions.Total) {
             transactions.Next = () => History(unit, limit, offset + limit);
         }
         task.PostResult(transactions);
     });
 }
开发者ID:StudioJD,项目名称:unity-sdk,代码行数:29,代码来源:GamerTransactions.cs


注:本文中的UrlBuilder.QueryParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。