Skip to content

Commit adf177f

Browse files
committed
SDK regeneration
1 parent a35417c commit adf177f

File tree

573 files changed

+31301
-2434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

573 files changed

+31301
-2434
lines changed

reference.md

+3,373
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
using System;
2+
using System.Net.Http;
3+
using FluentAssertions;
4+
using Merge.Client.Core;
5+
using NUnit.Framework;
6+
using WireMock.Server;
7+
using SystemTask = System.Threading.Tasks.Task;
8+
using WireMockRequest = WireMock.RequestBuilders.Request;
9+
using WireMockResponse = WireMock.ResponseBuilders.Response;
10+
11+
namespace Merge.Client.Test.Core
12+
{
13+
[TestFixture]
14+
public class RawClientTests
15+
{
16+
private WireMockServer _server;
17+
private HttpClient _httpClient;
18+
private RawClient _rawClient;
19+
private string _baseUrl;
20+
private const int _maxRetries = 3;
21+
22+
[SetUp]
23+
public void SetUp()
24+
{
25+
_server = WireMockServer.Start();
26+
_baseUrl = _server.Url ?? "";
27+
_httpClient = new HttpClient { BaseAddress = new Uri(_baseUrl) };
28+
_rawClient = new RawClient(
29+
new ClientOptions() { HttpClient = _httpClient, MaxRetries = _maxRetries }
30+
);
31+
}
32+
33+
[Test]
34+
[TestCase(408)]
35+
[TestCase(429)]
36+
[TestCase(500)]
37+
[TestCase(504)]
38+
public async SystemTask MakeRequestAsync_ShouldRetry_OnRetryableStatusCodes(int statusCode)
39+
{
40+
_server
41+
.Given(WireMockRequest.Create().WithPath("/test").UsingGet())
42+
.InScenario("Retry")
43+
.WillSetStateTo("Server Error")
44+
.RespondWith(WireMockResponse.Create().WithStatusCode(statusCode));
45+
46+
_server
47+
.Given(WireMockRequest.Create().WithPath("/test").UsingGet())
48+
.InScenario("Retry")
49+
.WhenStateIs("Server Error")
50+
.WillSetStateTo("Success")
51+
.RespondWith(WireMockResponse.Create().WithStatusCode(statusCode));
52+
53+
_server
54+
.Given(WireMockRequest.Create().WithPath("/test").UsingGet())
55+
.InScenario("Retry")
56+
.WhenStateIs("Success")
57+
.RespondWith(WireMockResponse.Create().WithStatusCode(200).WithBody("Success"));
58+
59+
var request = new RawClient.BaseApiRequest
60+
{
61+
BaseUrl = _baseUrl,
62+
Method = HttpMethod.Get,
63+
Path = "/test",
64+
};
65+
66+
var response = await _rawClient.MakeRequestAsync(request);
67+
Assert.That(response.StatusCode, Is.EqualTo(200));
68+
69+
var content = await response.Raw.Content.ReadAsStringAsync();
70+
Assert.That(content, Is.EqualTo("Success"));
71+
72+
Assert.That(_server.LogEntries.Count, Is.EqualTo(_maxRetries));
73+
}
74+
75+
[Test]
76+
[TestCase(400)]
77+
[TestCase(409)]
78+
public async SystemTask MakeRequestAsync_ShouldRetry_OnNonRetryableStatusCodes(
79+
int statusCode
80+
)
81+
{
82+
_server
83+
.Given(WireMockRequest.Create().WithPath("/test").UsingGet())
84+
.InScenario("Retry")
85+
.WillSetStateTo("Server Error")
86+
.RespondWith(
87+
WireMockResponse.Create().WithStatusCode(statusCode).WithBody("Failure")
88+
);
89+
90+
var request = new RawClient.BaseApiRequest
91+
{
92+
BaseUrl = _baseUrl,
93+
Method = HttpMethod.Get,
94+
Path = "/test",
95+
};
96+
97+
var response = await _rawClient.MakeRequestAsync(request);
98+
Assert.That(response.StatusCode, Is.EqualTo(statusCode));
99+
100+
var content = await response.Raw.Content.ReadAsStringAsync();
101+
Assert.That(content, Is.EqualTo("Failure"));
102+
103+
Assert.That(_server.LogEntries.Count, Is.EqualTo(1));
104+
}
105+
106+
[TearDown]
107+
public void TearDown()
108+
{
109+
_server.Dispose();
110+
_httpClient.Dispose();
111+
}
112+
}
113+
}

src/Merge.Client.sln

+10-10
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
44
VisualStudioVersion = 17.0.31903.59
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client", "Merge.Client\Merge.Client.csproj", "{FC3BB5C9-688E-4EF8-82DF-ACA00A7A6052}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client", "Merge.Client\Merge.Client.csproj", "{C1E0DE18-D918-424C-B042-91116EB0FDC3}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client.Test", "Merge.Client.Test\Merge.Client.Test.csproj", "{F421D601-C723-4774-A58A-7E4A3E74E3FB}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client.Test", "Merge.Client.Test\Merge.Client.Test.csproj", "{71C77395-C6E2-4283-A545-1EC194300EE7}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -16,13 +16,13 @@ Global
1616
HideSolutionNode = FALSE
1717
EndGlobalSection
1818
GlobalSection(ProjectConfigurationPlatforms) = postSolution
19-
{FC3BB5C9-688E-4EF8-82DF-ACA00A7A6052}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20-
{FC3BB5C9-688E-4EF8-82DF-ACA00A7A6052}.Debug|Any CPU.Build.0 = Debug|Any CPU
21-
{FC3BB5C9-688E-4EF8-82DF-ACA00A7A6052}.Release|Any CPU.ActiveCfg = Release|Any CPU
22-
{FC3BB5C9-688E-4EF8-82DF-ACA00A7A6052}.Release|Any CPU.Build.0 = Release|Any CPU
23-
{F421D601-C723-4774-A58A-7E4A3E74E3FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24-
{F421D601-C723-4774-A58A-7E4A3E74E3FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
25-
{F421D601-C723-4774-A58A-7E4A3E74E3FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
26-
{F421D601-C723-4774-A58A-7E4A3E74E3FB}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{C1E0DE18-D918-424C-B042-91116EB0FDC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{C1E0DE18-D918-424C-B042-91116EB0FDC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{C1E0DE18-D918-424C-B042-91116EB0FDC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{C1E0DE18-D918-424C-B042-91116EB0FDC3}.Release|Any CPU.Build.0 = Release|Any CPU
23+
{71C77395-C6E2-4283-A545-1EC194300EE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{71C77395-C6E2-4283-A545-1EC194300EE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{71C77395-C6E2-4283-A545-1EC194300EE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{71C77395-C6E2-4283-A545-1EC194300EE7}.Release|Any CPU.Build.0 = Release|Any CPU
2727
EndGlobalSection
2828
EndGlobal

src/Merge.Client/Accounting/AccountingClient.cs

+15
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@ internal AccountingClient(RawClient client)
1717
Accounts = new AccountsClient(_client);
1818
Addresses = new AddressesClient(_client);
1919
AsyncPassthrough = new AsyncPassthroughClient(_client);
20+
AsyncTasks = new AsyncTasksClient(_client);
2021
Attachments = new AttachmentsClient(_client);
2122
AuditTrail = new AuditTrailClient(_client);
2223
AvailableActions = new AvailableActionsClient(_client);
2324
BalanceSheets = new BalanceSheetsClient(_client);
25+
BankFeedAccounts = new BankFeedAccountsClient(_client);
26+
BankFeedTransactions = new BankFeedTransactionsClient(_client);
2427
CashFlowStatements = new CashFlowStatementsClient(_client);
2528
CompanyInfo = new CompanyInfoClient(_client);
2629
Contacts = new ContactsClient(_client);
2730
CreditNotes = new CreditNotesClient(_client);
2831
Scopes = new ScopesClient(_client);
2932
DeleteAccount = new DeleteAccountClient(_client);
33+
Employees = new EmployeesClient(_client);
3034
Expenses = new ExpensesClient(_client);
3135
FieldMapping = new FieldMappingClient(_client);
36+
GeneralLedgerTransactions = new GeneralLedgerTransactionsClient(_client);
3237
GenerateKey = new GenerateKeyClient(_client);
3338
IncomeStatements = new IncomeStatementsClient(_client);
3439
Invoices = new InvoicesClient(_client);
@@ -63,6 +68,8 @@ internal AccountingClient(RawClient client)
6368

6469
public AsyncPassthroughClient AsyncPassthrough { get; }
6570

71+
public AsyncTasksClient AsyncTasks { get; }
72+
6673
public AttachmentsClient Attachments { get; }
6774

6875
public AuditTrailClient AuditTrail { get; }
@@ -71,6 +78,10 @@ internal AccountingClient(RawClient client)
7178

7279
public BalanceSheetsClient BalanceSheets { get; }
7380

81+
public BankFeedAccountsClient BankFeedAccounts { get; }
82+
83+
public BankFeedTransactionsClient BankFeedTransactions { get; }
84+
7485
public CashFlowStatementsClient CashFlowStatements { get; }
7586

7687
public CompanyInfoClient CompanyInfo { get; }
@@ -83,10 +94,14 @@ internal AccountingClient(RawClient client)
8394

8495
public DeleteAccountClient DeleteAccount { get; }
8596

97+
public EmployeesClient Employees { get; }
98+
8699
public ExpensesClient Expenses { get; }
87100

88101
public FieldMappingClient FieldMapping { get; }
89102

103+
public GeneralLedgerTransactionsClient GeneralLedgerTransactions { get; }
104+
90105
public GenerateKeyClient GenerateKey { get; }
91106

92107
public IncomeStatementsClient IncomeStatements { get; }

src/Merge.Client/Accounting/AccountingPeriods/AccountingPeriodsClient.cs

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public async Task<PaginatedAccountingPeriodList> ListAsync(
4343
{
4444
_query["include_remote_data"] = request.IncludeRemoteData.ToString();
4545
}
46+
if (request.IncludeShellData != null)
47+
{
48+
_query["include_shell_data"] = request.IncludeShellData.ToString();
49+
}
4650
if (request.PageSize != null)
4751
{
4852
_query["page_size"] = request.PageSize.ToString();

src/Merge.Client/Accounting/AccountingPeriods/Requests/AccountingPeriodsListRequest.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public record AccountingPeriodsListRequest
1212
public string? Cursor { get; set; }
1313

1414
/// <summary>
15-
/// Whether to include data that was marked as deleted by third party webhooks.
15+
/// Indicates whether or not this object has been deleted in the third party platform. Full coverage deletion detection is a premium add-on. Native deletion detection is offered for free with limited coverage. [Learn more](https://docs.merge.dev/integrations/hris/supported-features/).
1616
/// </summary>
1717
public bool? IncludeDeletedData { get; set; }
1818

@@ -21,6 +21,11 @@ public record AccountingPeriodsListRequest
2121
/// </summary>
2222
public bool? IncludeRemoteData { get; set; }
2323

24+
/// <summary>
25+
/// Whether to include shell records. Shell records are empty records (they may contain some metadata but all other fields are null).
26+
/// </summary>
27+
public bool? IncludeShellData { get; set; }
28+
2429
/// <summary>
2530
/// Number of results to return per page.
2631
/// </summary>

src/Merge.Client/Accounting/Accounts/AccountsClient.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public async Task<PaginatedAccountList> ListAsync(
3131
)
3232
{
3333
var _query = new Dictionary<string, object>();
34+
if (request.AccountType != null)
35+
{
36+
_query["account_type"] = request.AccountType;
37+
}
3438
if (request.CompanyId != null)
3539
{
3640
_query["company_id"] = request.CompanyId;
@@ -61,6 +65,10 @@ public async Task<PaginatedAccountList> ListAsync(
6165
{
6266
_query["include_remote_data"] = request.IncludeRemoteData.ToString();
6367
}
68+
if (request.IncludeShellData != null)
69+
{
70+
_query["include_shell_data"] = request.IncludeShellData.ToString();
71+
}
6472
if (request.ModifiedAfter != null)
6573
{
6674
_query["modified_after"] = request.ModifiedAfter.Value.ToString(
@@ -126,7 +134,7 @@ public async Task<PaginatedAccountList> ListAsync(
126134
/// <example>
127135
/// <code>
128136
/// await client.Accounting.Accounts.CreateAsync(
129-
/// new AccountEndpointRequest { Model = new AccountRequest() }
137+
/// new AccountEndpointRequest { Model = new Merge.Client.Accounting.AccountRequest() }
130138
/// );
131139
/// </code>
132140
/// </example>

src/Merge.Client/Accounting/Accounts/Requests/AccountsListRequest.cs

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ namespace Merge.Client.Accounting;
66

77
public record AccountsListRequest
88
{
9+
/// <summary>
10+
/// If provided, will only provide accounts with the passed in enum.
11+
/// </summary>
12+
public string? AccountType { get; set; }
13+
914
/// <summary>
1015
/// If provided, will only return accounts for this company.
1116
/// </summary>
@@ -32,7 +37,7 @@ public record AccountsListRequest
3237
public string? Expand { get; set; }
3338

3439
/// <summary>
35-
/// Whether to include data that was marked as deleted by third party webhooks.
40+
/// Indicates whether or not this object has been deleted in the third party platform. Full coverage deletion detection is a premium add-on. Native deletion detection is offered for free with limited coverage. [Learn more](https://docs.merge.dev/integrations/hris/supported-features/).
3641
/// </summary>
3742
public bool? IncludeDeletedData { get; set; }
3843

@@ -41,6 +46,11 @@ public record AccountsListRequest
4146
/// </summary>
4247
public bool? IncludeRemoteData { get; set; }
4348

49+
/// <summary>
50+
/// Whether to include shell records. Shell records are empty records (they may contain some metadata but all other fields are null).
51+
/// </summary>
52+
public bool? IncludeShellData { get; set; }
53+
4454
/// <summary>
4555
/// If provided, only objects synced by Merge after this date time will be returned.
4656
/// </summary>

src/Merge.Client/Accounting/AsyncPassthrough/AsyncPassthroughClient.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Text.Json;
33
using System.Threading;
44
using Merge.Client.Core;
5+
using OneOf;
56

67
#nullable enable
78

@@ -22,7 +23,11 @@ internal AsyncPassthroughClient(RawClient client)
2223
/// <example>
2324
/// <code>
2425
/// await client.Accounting.AsyncPassthrough.CreateAsync(
25-
/// new DataPassthroughRequest { Method = MethodEnum.Get, Path = "/scooters" }
26+
/// new Merge.Client.Accounting.DataPassthroughRequest
27+
/// {
28+
/// Method = Merge.Client.Accounting.MethodEnum.Get,
29+
/// Path = "/scooters",
30+
/// }
2631
/// );
2732
/// </code>
2833
/// </example>
@@ -71,7 +76,7 @@ public async Task<AsyncPassthroughReciept> CreateAsync(
7176
/// await client.Accounting.AsyncPassthrough.RetrieveAsync("async_passthrough_receipt_id");
7277
/// </code>
7378
/// </example>
74-
public async Task<RemoteResponse> RetrieveAsync(
79+
public async Task<OneOf<RemoteResponse, string>> RetrieveAsync(
7580
string asyncPassthroughReceiptId,
7681
RequestOptions? options = null,
7782
CancellationToken cancellationToken = default
@@ -92,7 +97,7 @@ public async Task<RemoteResponse> RetrieveAsync(
9297
{
9398
try
9499
{
95-
return JsonUtils.Deserialize<RemoteResponse>(responseBody)!;
100+
return JsonUtils.Deserialize<OneOf<RemoteResponse, string>>(responseBody)!;
96101
}
97102
catch (JsonException e)
98103
{

0 commit comments

Comments
 (0)