/// <summary> /// Browse historical payments in bulk. /// </summary> /// <param name="client">A RippleRestClient used for this request.</param> /// <param name="options">A QueryPaymentsOptions instance</param> /// <returns>A list of Payment instances</returns> /// <exception cref="RippleRestException">Request failed.</exception> public List<Payment> QueryPayments(RippleRestClient client, QueryPaymentsOptions options) { var request = client.CreateGetRequest("v1/accounts/{0}/payments", Address); if (options != null) { var args = new Dictionary<string, string>(); if (options.SourceAccount != null) args.Add("source_account", options.SourceAccount); if (options.DestinationAccount != null) args.Add("destination_account", options.DestinationAccount); if (options.EarliestFirst != null) args.Add("earliest_first", options.EarliestFirst.Value ? "true" : "false"); if (options.ExcludeFailed != null) args.Add("exclude_failed", options.ExcludeFailed.Value ? "true" : "false"); if (options.StartLedger != null) args.Add("start_ledger", options.StartLedger); if (options.EndLedger != null) args.Add("end_ledger", options.EndLedger); if (options.Page != null) args.Add("page", options.Page.Value.ToString()); if (options.ResultsPerPage != null) args.Add("results_per_page", options.ResultsPerPage.Value.ToString()); foreach (var item in args) request.AddParameter(item.Key, item.Value, ParameterType.QueryString); } var result = client.RestClient.Execute<QueryPaymentsResponse>(request); client.HandleRestResponseErrors(result); return result.Data.Payments.ConvertAll((o) => { o.Payment.ClientResourceId = o.ClientResourceId; return o.Payment; }); }
/// <summary> /// Browse historical payments in bulk. /// </summary> /// <param name="options">A QueryPaymentsOptions instance</param> /// <returns>A list of Payment instances</returns> /// <exception cref="RippleRestException">Request failed.</exception> public List<Payment> QueryPayments(QueryPaymentsOptions options) { return QueryPayments(RippleRestClient.GetDefaultInstanceOrThrow(), options); }