-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathOutbound.ListOptions.cs
40 lines (35 loc) · 1.4 KB
/
Outbound.ListOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Collections.Generic;
namespace InterFAX.Api
{
public partial class Outbound
{
public class ListOptions : IOptions
{
/// <summary>
/// How many transactions to return.
/// </summary>
public int? Limit { get; set; }
/// <summary>
/// Return results from this ID onwards (not including this ID). Used for pagination.
/// </summary>
public int? LastId { get; set; }
/// <summary>
/// Ascending or descending. Sorts by fax ID. (Default is descending)
/// </summary>
public ListSortOrder SortOrder { get; set; } = ListSortOrder.Descending;
/// <summary>
/// Enables a "primary" user to query for other account users' faxes.
/// </summary>
public string UserId { get; set; }
public Dictionary<string, string> ToDictionary()
{
var options = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(UserId)) options.Add("userId", UserId);
if (LastId.HasValue) options.Add("lastId", LastId.ToString());
if (Limit.HasValue) options.Add("limit", Limit.ToString());
if (SortOrder == ListSortOrder.Ascending) options.Add("sortOrder", "asc");
return options;
}
}
}
}