Releases: merge-api/merge-csharp-client
v4.0.1
v4.0.0
Merge C# SDK Release Notes - Version [4.0.0]
Breaking Changes
- Forward-Compatible Enums
The SDK now uses forward-compatible enums instead of native C# enums. This allows your code to work with new enum values returned by the API before the SDK is updated. This is a breaking change if you were using enum values in switch/case statements and direct comparisons.
Use the Value property to get the string value of the enum. - For each value in the enum,
- a public static property is generated, which is an instance of the enum class,
- a public static property is generated within the nested Values class with the string value of the enum.
// Old usage with native enums
if (resource.EnumProperty == MyEnum.Value1) { ... }
switch (resource.EnumProperty)
{
case MyEnum.Value1:
// ...
break;
}
becomes
switch(resource.EnumProperty.Value) {
case MyEnum.Values.Value1:
Console.WriteLine("Value1");
break;
case MyEnum.Values.Value2:
Console.WriteLine("Value2");
break;
default:
Console.WriteLine(resource.EnumProperty.Value);
break;
}
v3.0.1
Merge C# SDK Release Notes - Version [3.0.1]
Improvements
- Fixed issue with greater than 2 expand query parameters were not functioning properly
v3.0.0
Merge C# SDK Release Notes - Version [3.0.0]
This release includes support for all of the latest updates to the Merge API. For more information, see https://www.merge.dev/changelog
Breaking Changes
- AccessLevelEnum was renamed
Usages ofAccessLevelEnumneed to be updated toTicketAccessLevelEnumin code. If you were importing AccessLevelEnum directly that would also need to be updated.
Improvements
- Fixed issue where environments other that Production were not able to be used
v2.0.0
Merge C# SDK Release Notes - Version [2.0.0]
Breaking Changes
- Expand Query Params:
Previously a comma separated string was used for multiple enums. Now users will pass in a list of enums, then the SDK will pass them into the request correctly. Here's an example below:
using System.Collections.Generic;
using System.Threading.Tasks;
using Merge.Client;
using Merge.Client.Accounting;
var apiKey = "your API key”;
var accountToken = "your account token";
var client = new MergeClient(apiKey, accountToken);
var request = new InvoicesListRequest
{
Expand = new List<InvoicesListRequestExpandItem>
{
InvoicesListRequestExpandItem.Employee,
InvoicesListRequestExpandItem.AccountingPeriod
}
};
var pager = await client.Accounting.Invoices.ListAsync(request);
Improvements
- Auto pagination
Users can auto-paginate through responses. Paginated requests will return a Pager, which can be used to loop through the underlying items. Here's a code snippet below:
using System.Collections.Generic;
using System.Threading.Tasks;
using Merge.Client;
using Merge.Client.Accounting;
var apiKey = "your API key”;
var accountToken = "your “account token;
var client = new MergeClient(apiKey, accountToken);
var request = new InvoicesListRequest
{
Expand = new List<InvoicesListRequestExpandItem>
{
InvoicesListRequestExpandItem.Employee,
InvoicesListRequestExpandItem.AccountingPeriod
}
};
var pager = await client.Accounting.Invoices.ListAsync(request);
await foreach (var invoice in pager)
{
// process the invoice
}
- Update on sync status response
The following code snippet looks at the sync status results for Accounting, this applies to other categories if you update the client:
using System.Collections.Generic;
using System.Threading.Tasks;
using NUnit.Framework;
using Merge.Client;
using Merge.Client.Accounting;
var apiKey = "your API key”;
var accountToken = "your “account token;
var client = new MergeClient(apiKey, accountToken);
var syncStatusRequest = new SyncStatusListRequest();
var pager = await client.Accounting.SyncStatus.ListAsync(syncStatusRequest);
await foreach (var syncStatus in pager)
{
Console.WriteLine(
$"Model: {syncStatus.ModelName}, " +
$"Status: {syncStatus.Status}, " +
$"Last Sync finished: {syncStatus.LastSyncFinished} " +
$"Result: {syncStatus.LastSyncResult}"
);
}
1.0.2
1.0.1
Note: This release affects all categories.
- (fix): Fixes a bug where the OauthTokenProvider.cs was incorrectly referencing the endpoint method, causing code to fail to compile.
- (fix): Fixes a bug where the ClientOptions would not compile due to incorrect Clone method generation.
- (feat): Add support for calling HTTP endpoints and gRPC endpoints within the same service.
- (chore): Update System.Text.Json dependency from 8.0.4 to 8.0.5 because a security patch was released to resolve this vulnerability
- (feat): Generate a ProjectName.Custom.props file for you to configure any MSBuild properties for your project.
- (fix): Generate the license NuGet properties inside the .csproj file correctly.
- (feat): Generate a ProjectName.Test.Custom.props file for you to configure any MSBuild properties for your test project.
- (feat): Only import ProjectName.Custom.props and ProjectName.Test.Custom.props if the file exists, so you can delete the file if you wish to.
- (fix): Do not re-import the .NET SDK inside of ProjectName.Custom.props.
- (feat): Add support for idempotency headers.
1.0.0
This release impacts all categories.
- Updated descriptions and code snippets
- Add query parameters for multiple Common Model endpoints
- async POST request support
- [accounting] add GeneralLedgerTransactions
- [accounting] add BankFeeds and BankFeedTransactions
- updated RemoteData and RemoteFields objects to allow for better handling
0.2.1
This release impacts all categories.
-
Feature: Add the
CancellationTokenparameter as the last parameter to every endpoint method.
For example,/// <summary> /// Add a movie to the database /// </summary> public async Task<string> CreateMovieAsync( CreateMovieRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ) { var response = await _client.MakeRequestAsync( new RawClient.JsonApiRequest { BaseUrl = _client.Options.BaseUrl, Method = HttpMethod.Post, Path = "/movies/create-movie", Body = request, Options = options, }, cancellationToken ); ... }
This aligns with the code analysis quality rule
CA1068outlined in the official .NET documentation.
For details, please see https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1068 -
Feature: Add support for sending the User-Agent header.
-
Feature: Generate snippets as example documentation, e.g.
/// <example> /// <code> /// await client.Data.UploadAsync( /// new UploadRequest /// { /// Columns = new List<Column>() /// { /// new Column /// { /// Id = "id", /// Values = new List<float>() { 1.1f }, /// }, /// }, /// } /// ); /// </code> /// </example> public async Task<UploadResponse> UploadAsync( UploadRequest request, RequestOptions? options = null, CancellationToken cancellationToken = default ) { ... }