1
1
using System . Net . Http ;
2
2
using System . Text . Json ;
3
+ using System . Threading ;
3
4
using Merge . Client . Core ;
4
5
5
6
#nullable enable
@@ -18,12 +19,18 @@ internal AccountingPeriodsClient(RawClient client)
18
19
/// <summary>
19
20
/// Returns a list of `AccountingPeriod` objects.
20
21
/// </summary>
22
+ /// <example>
23
+ /// <code>
24
+ /// await client.Accounting.AccountingPeriods.ListAsync(new AccountingPeriodsListRequest());
25
+ /// </code>
26
+ /// </example>
21
27
public async Task < PaginatedAccountingPeriodList > ListAsync (
22
28
AccountingPeriodsListRequest request ,
23
- RequestOptions ? options = null
29
+ RequestOptions ? options = null ,
30
+ CancellationToken cancellationToken = default
24
31
)
25
32
{
26
- var _query = new Dictionary < string , object > ( ) { } ;
33
+ var _query = new Dictionary < string , object > ( ) ;
27
34
if ( request . Cursor != null )
28
35
{
29
36
_query [ "cursor" ] = request . Cursor ;
@@ -47,8 +54,9 @@ public async Task<PaginatedAccountingPeriodList> ListAsync(
47
54
Method = HttpMethod . Get ,
48
55
Path = "accounting/v1/accounting-periods" ,
49
56
Query = _query ,
50
- Options = options
51
- }
57
+ Options = options ,
58
+ } ,
59
+ cancellationToken
52
60
) ;
53
61
var responseBody = await response . Raw . Content . ReadAsStringAsync ( ) ;
54
62
if ( response . StatusCode is >= 200 and < 400 )
@@ -73,13 +81,22 @@ public async Task<PaginatedAccountingPeriodList> ListAsync(
73
81
/// <summary>
74
82
/// Returns an `AccountingPeriod` object with the given `id`.
75
83
/// </summary>
84
+ /// <example>
85
+ /// <code>
86
+ /// await client.Accounting.AccountingPeriods.RetrieveAsync(
87
+ /// "id",
88
+ /// new AccountingPeriodsRetrieveRequest()
89
+ /// );
90
+ /// </code>
91
+ /// </example>
76
92
public async Task < AccountingPeriod > RetrieveAsync (
77
93
string id ,
78
94
AccountingPeriodsRetrieveRequest request ,
79
- RequestOptions ? options = null
95
+ RequestOptions ? options = null ,
96
+ CancellationToken cancellationToken = default
80
97
)
81
98
{
82
- var _query = new Dictionary < string , object > ( ) { } ;
99
+ var _query = new Dictionary < string , object > ( ) ;
83
100
if ( request . IncludeRemoteData != null )
84
101
{
85
102
_query [ "include_remote_data" ] = request . IncludeRemoteData . ToString ( ) ;
@@ -91,8 +108,9 @@ public async Task<AccountingPeriod> RetrieveAsync(
91
108
Method = HttpMethod . Get ,
92
109
Path = $ "accounting/v1/accounting-periods/{ id } ",
93
110
Query = _query ,
94
- Options = options
95
- }
111
+ Options = options ,
112
+ } ,
113
+ cancellationToken
96
114
) ;
97
115
var responseBody = await response . Raw . Content . ReadAsStringAsync ( ) ;
98
116
if ( response . StatusCode is >= 200 and < 400 )
0 commit comments