Skip to content

Commit eb2410e

Browse files
committed
SDK regeneration
1 parent fccaf76 commit eb2410e

File tree

1,381 files changed

+18105
-11604
lines changed

Some content is hidden

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

1,381 files changed

+18105
-11604
lines changed

Diff for: .github/workflows/ci.yml

+22
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,28 @@ jobs:
2424
- name: Build Release
2525
run: dotnet build src -c Release /p:ContinuousIntegrationBuild=true
2626

27+
unit-tests:
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Checkout repo
32+
uses: actions/checkout@v3
33+
34+
- uses: actions/checkout@master
35+
36+
- name: Setup .NET
37+
uses: actions/setup-dotnet@v1
38+
with:
39+
dotnet-version: 8.x
40+
41+
- name: Install tools
42+
run: |
43+
dotnet tool restore
44+
45+
- name: Run Tests
46+
run: |
47+
dotnet test src
48+
2749
2850
publish:
2951
needs: [compile]

Diff for: src/Merge.Client.Test/Merge.Client.Test.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

@@ -15,6 +15,7 @@
1515
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2"/>
1616
<PackageReference Include="NUnit.Analyzers" Version="3.6.1"/>
1717
<PackageReference Include="coverlet.collector" Version="3.2.0"/>
18+
<PackageReference Include="FluentAssertions.Json" Version="6.1.0" />
1819
</ItemGroup>
1920

2021
<ItemGroup>

Diff for: src/Merge.Client.Test/TestClient.cs

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
using NUnit.Framework;
2+
3+
#nullable enable
4+
15
namespace Merge.Client.Test;
26

7+
[TestFixture]
38
public class TestClient { }

Diff for: 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", "{8D54A66D-E9D5-417E-9BE5-8FEF3F7F660F}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client", "Merge.Client\Merge.Client.csproj", "{5940579A-1D95-4B3E-9CC6-F5D30AB2D95A}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client.Test", "Merge.Client.Test\Merge.Client.Test.csproj", "{ECDC139A-E6BD-4FDD-9966-4F7EE068A1A8}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Merge.Client.Test", "Merge.Client.Test\Merge.Client.Test.csproj", "{6F36DC9B-1D6D-4BD7-B202-6ED89700FAF1}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -16,13 +16,13 @@ Global
1616
HideSolutionNode = FALSE
1717
EndGlobalSection
1818
GlobalSection(ProjectConfigurationPlatforms) = postSolution
19-
{8D54A66D-E9D5-417E-9BE5-8FEF3F7F660F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20-
{8D54A66D-E9D5-417E-9BE5-8FEF3F7F660F}.Debug|Any CPU.Build.0 = Debug|Any CPU
21-
{8D54A66D-E9D5-417E-9BE5-8FEF3F7F660F}.Release|Any CPU.ActiveCfg = Release|Any CPU
22-
{8D54A66D-E9D5-417E-9BE5-8FEF3F7F660F}.Release|Any CPU.Build.0 = Release|Any CPU
23-
{ECDC139A-E6BD-4FDD-9966-4F7EE068A1A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24-
{ECDC139A-E6BD-4FDD-9966-4F7EE068A1A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
25-
{ECDC139A-E6BD-4FDD-9966-4F7EE068A1A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
26-
{ECDC139A-E6BD-4FDD-9966-4F7EE068A1A8}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{5940579A-1D95-4B3E-9CC6-F5D30AB2D95A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20+
{5940579A-1D95-4B3E-9CC6-F5D30AB2D95A}.Debug|Any CPU.Build.0 = Debug|Any CPU
21+
{5940579A-1D95-4B3E-9CC6-F5D30AB2D95A}.Release|Any CPU.ActiveCfg = Release|Any CPU
22+
{5940579A-1D95-4B3E-9CC6-F5D30AB2D95A}.Release|Any CPU.Build.0 = Release|Any CPU
23+
{6F36DC9B-1D6D-4BD7-B202-6ED89700FAF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{6F36DC9B-1D6D-4BD7-B202-6ED89700FAF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{6F36DC9B-1D6D-4BD7-B202-6ED89700FAF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{6F36DC9B-1D6D-4BD7-B202-6ED89700FAF1}.Release|Any CPU.Build.0 = Release|Any CPU
2727
EndGlobalSection
2828
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,51 @@
1+
using System.Net.Http;
12
using System.Text.Json;
2-
using Merge.Client;
3-
using Merge.Client.Accounting;
3+
using Merge.Client.Core;
44

55
#nullable enable
66

77
namespace Merge.Client.Accounting;
88

9-
public class AccountDetailsClient
9+
public partial class AccountDetailsClient
1010
{
1111
private RawClient _client;
1212

13-
public AccountDetailsClient(RawClient client)
13+
internal AccountDetailsClient(RawClient client)
1414
{
1515
_client = client;
1616
}
1717

1818
/// <summary>
1919
/// Get details for a linked account.
2020
/// </summary>
21-
public async Task<AccountDetails> RetrieveAsync()
21+
public async Task<AccountDetails> RetrieveAsync(RequestOptions? options = null)
2222
{
2323
var response = await _client.MakeRequestAsync(
2424
new RawClient.JsonApiRequest
2525
{
26+
BaseUrl = _client.Options.BaseUrl,
2627
Method = HttpMethod.Get,
27-
Path = "accounting/v1/account-details"
28+
Path = "accounting/v1/account-details",
29+
Options = options
2830
}
2931
);
30-
string responseBody = await response.Raw.Content.ReadAsStringAsync();
31-
if (response.StatusCode >= 200 && response.StatusCode < 400)
32+
var responseBody = await response.Raw.Content.ReadAsStringAsync();
33+
if (response.StatusCode is >= 200 and < 400)
3234
{
33-
return JsonSerializer.Deserialize<AccountDetails>(responseBody);
35+
try
36+
{
37+
return JsonUtils.Deserialize<AccountDetails>(responseBody)!;
38+
}
39+
catch (JsonException e)
40+
{
41+
throw new MergeException("Failed to deserialize response", e);
42+
}
3443
}
35-
throw new Exception(responseBody);
44+
45+
throw new MergeApiException(
46+
$"Error with status code {response.StatusCode}",
47+
response.StatusCode,
48+
responseBody
49+
);
3650
}
3751
}
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,54 @@
1+
using System.Net.Http;
12
using System.Text.Json;
2-
using Merge.Client;
3-
using Merge.Client.Accounting;
3+
using Merge.Client.Core;
44

55
#nullable enable
66

77
namespace Merge.Client.Accounting;
88

9-
public class AccountTokenClient
9+
public partial class AccountTokenClient
1010
{
1111
private RawClient _client;
1212

13-
public AccountTokenClient(RawClient client)
13+
internal AccountTokenClient(RawClient client)
1414
{
1515
_client = client;
1616
}
1717

1818
/// <summary>
1919
/// Returns the account token for the end user with the provided public token.
2020
/// </summary>
21-
public async Task<AccountToken> RetrieveAsync(string publicToken)
21+
public async Task<AccountToken> RetrieveAsync(
22+
string publicToken,
23+
RequestOptions? options = null
24+
)
2225
{
2326
var response = await _client.MakeRequestAsync(
2427
new RawClient.JsonApiRequest
2528
{
29+
BaseUrl = _client.Options.BaseUrl,
2630
Method = HttpMethod.Get,
27-
Path = $"accounting/v1/account-token/{publicToken}"
31+
Path = $"accounting/v1/account-token/{publicToken}",
32+
Options = options
2833
}
2934
);
30-
string responseBody = await response.Raw.Content.ReadAsStringAsync();
31-
if (response.StatusCode >= 200 && response.StatusCode < 400)
35+
var responseBody = await response.Raw.Content.ReadAsStringAsync();
36+
if (response.StatusCode is >= 200 and < 400)
3237
{
33-
return JsonSerializer.Deserialize<AccountToken>(responseBody);
38+
try
39+
{
40+
return JsonUtils.Deserialize<AccountToken>(responseBody)!;
41+
}
42+
catch (JsonException e)
43+
{
44+
throw new MergeException("Failed to deserialize response", e);
45+
}
3446
}
35-
throw new Exception(responseBody);
47+
48+
throw new MergeApiException(
49+
$"Error with status code {response.StatusCode}",
50+
response.StatusCode,
51+
responseBody
52+
);
3653
}
3754
}

Diff for: src/Merge.Client/Accounting/AccountingClient.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
using Merge.Client;
2-
using Merge.Client.Accounting;
1+
using Merge.Client.Core;
32

43
#nullable enable
54

65
namespace Merge.Client.Accounting;
76

8-
public class AccountingClient
7+
public partial class AccountingClient
98
{
109
private RawClient _client;
1110

12-
public AccountingClient(RawClient client)
11+
internal AccountingClient(RawClient client)
1312
{
1413
_client = client;
1514
AccountDetails = new AccountDetailsClient(_client);

Diff for: src/Merge.Client/Accounting/AccountingPeriods/AccountingPeriodsClient.cs

+48-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1+
using System.Net.Http;
12
using System.Text.Json;
2-
using Merge.Client;
3-
using Merge.Client.Accounting;
3+
using Merge.Client.Core;
44

55
#nullable enable
66

77
namespace Merge.Client.Accounting;
88

9-
public class AccountingPeriodsClient
9+
public partial class AccountingPeriodsClient
1010
{
1111
private RawClient _client;
1212

13-
public AccountingPeriodsClient(RawClient client)
13+
internal AccountingPeriodsClient(RawClient client)
1414
{
1515
_client = client;
1616
}
1717

1818
/// <summary>
1919
/// Returns a list of `AccountingPeriod` objects.
2020
/// </summary>
21-
public async Task<PaginatedAccountingPeriodList> ListAsync(AccountingPeriodsListRequest request)
21+
public async Task<PaginatedAccountingPeriodList> ListAsync(
22+
AccountingPeriodsListRequest request,
23+
RequestOptions? options = null
24+
)
2225
{
2326
var _query = new Dictionary<string, object>() { };
2427
if (request.Cursor != null)
@@ -40,25 +43,40 @@ public async Task<PaginatedAccountingPeriodList> ListAsync(AccountingPeriodsList
4043
var response = await _client.MakeRequestAsync(
4144
new RawClient.JsonApiRequest
4245
{
46+
BaseUrl = _client.Options.BaseUrl,
4347
Method = HttpMethod.Get,
4448
Path = "accounting/v1/accounting-periods",
45-
Query = _query
49+
Query = _query,
50+
Options = options
4651
}
4752
);
48-
string responseBody = await response.Raw.Content.ReadAsStringAsync();
49-
if (response.StatusCode >= 200 && response.StatusCode < 400)
53+
var responseBody = await response.Raw.Content.ReadAsStringAsync();
54+
if (response.StatusCode is >= 200 and < 400)
5055
{
51-
return JsonSerializer.Deserialize<PaginatedAccountingPeriodList>(responseBody);
56+
try
57+
{
58+
return JsonUtils.Deserialize<PaginatedAccountingPeriodList>(responseBody)!;
59+
}
60+
catch (JsonException e)
61+
{
62+
throw new MergeException("Failed to deserialize response", e);
63+
}
5264
}
53-
throw new Exception(responseBody);
65+
66+
throw new MergeApiException(
67+
$"Error with status code {response.StatusCode}",
68+
response.StatusCode,
69+
responseBody
70+
);
5471
}
5572

5673
/// <summary>
5774
/// Returns an `AccountingPeriod` object with the given `id`.
5875
/// </summary>
5976
public async Task<AccountingPeriod> RetrieveAsync(
6077
string id,
61-
AccountingPeriodsRetrieveRequest request
78+
AccountingPeriodsRetrieveRequest request,
79+
RequestOptions? options = null
6280
)
6381
{
6482
var _query = new Dictionary<string, object>() { };
@@ -69,16 +87,30 @@ AccountingPeriodsRetrieveRequest request
6987
var response = await _client.MakeRequestAsync(
7088
new RawClient.JsonApiRequest
7189
{
90+
BaseUrl = _client.Options.BaseUrl,
7291
Method = HttpMethod.Get,
7392
Path = $"accounting/v1/accounting-periods/{id}",
74-
Query = _query
93+
Query = _query,
94+
Options = options
7595
}
7696
);
77-
string responseBody = await response.Raw.Content.ReadAsStringAsync();
78-
if (response.StatusCode >= 200 && response.StatusCode < 400)
97+
var responseBody = await response.Raw.Content.ReadAsStringAsync();
98+
if (response.StatusCode is >= 200 and < 400)
7999
{
80-
return JsonSerializer.Deserialize<AccountingPeriod>(responseBody);
100+
try
101+
{
102+
return JsonUtils.Deserialize<AccountingPeriod>(responseBody)!;
103+
}
104+
catch (JsonException e)
105+
{
106+
throw new MergeException("Failed to deserialize response", e);
107+
}
81108
}
82-
throw new Exception(responseBody);
109+
110+
throw new MergeApiException(
111+
$"Error with status code {response.StatusCode}",
112+
response.StatusCode,
113+
responseBody
114+
);
83115
}
84116
}
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
namespace Merge.Client.Accounting;
22

3-
public class AccountingPeriodsListRequest
3+
public record AccountingPeriodsListRequest
44
{
55
/// <summary>
66
/// The pagination cursor value.
77
/// </summary>
8-
public string? Cursor { get; init; }
8+
public string? Cursor { get; set; }
99

1010
/// <summary>
1111
/// Whether to include data that was marked as deleted by third party webhooks.
1212
/// </summary>
13-
public bool? IncludeDeletedData { get; init; }
13+
public bool? IncludeDeletedData { get; set; }
1414

1515
/// <summary>
1616
/// Whether to include the original data Merge fetched from the third-party to produce these models.
1717
/// </summary>
18-
public bool? IncludeRemoteData { get; init; }
18+
public bool? IncludeRemoteData { get; set; }
1919

2020
/// <summary>
2121
/// Number of results to return per page.
2222
/// </summary>
23-
public int? PageSize { get; init; }
23+
public int? PageSize { get; set; }
2424
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
namespace Merge.Client.Accounting;
22

3-
public class AccountingPeriodsRetrieveRequest
3+
public record AccountingPeriodsRetrieveRequest
44
{
55
/// <summary>
66
/// Whether to include the original data Merge fetched from the third-party to produce these models.
77
/// </summary>
8-
public bool? IncludeRemoteData { get; init; }
8+
public bool? IncludeRemoteData { get; set; }
99
}

0 commit comments

Comments
 (0)