Releases: merge-api/merge-java-client
v4.0.0
Merge Java SDK Release Notes - Version [4.0.0]
Breaking Changes
- Forward-Compatible Enums
The SDK now uses forward-compatible enums instead of native Java 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. Useresource.EnumProperty.getEnumValue()
to reference the enum values within Switch statements.
v3.0.0
Merge Java 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
- Previously this was imported by
import com.merge.api.ticketing.types.AccessLevelEnum
now would be imported byimport com.merge.ticketing.types.TicketAccessLevelEnum
Improvements
- Fixed issue where environments other that Production were not able to be used
v2.0.0
Merge Java 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:
import com.merge.api.MergeApiClient;
import com.merge.api.MergeApiClientBuilder;
import com.merge.api.accounting.types.Invoice;
import com.merge.api.accounting.types.InvoicesListRequest;
import com.merge.api.accounting.types.InvoicesListRequestExpandItem;
import com.merge.api.core.SyncPagingIterable;
import java.util.List;
MergeApiClient client = MergeApiClientBuilder.builder()
.apiKey("YOUR_API_KEY")
.accountToken("YOUR_ACCOUNT_TOKEN")
.build();
InvoicesListRequest request = InvoicesListRequest.builder()
// Pass a list of enum properties into the request, and the SDK will parse the values accordingly
.expand(List.of(InvoicesListRequestExpandItem.EMPLOYEE, InvoicesListRequestExpandItem.ACCOUNTING_PERIOD))
.build();
SyncPagingIterable<Invoice> invoices = client.accounting().invoices().list(request);
As part of this release we have provided a legacy client under com.merge.legacy.api
to retain the previous functionality of v1.1.1. This legacy client will not be updated with new endpoints.
import com.merge.legacy.api.MergeApiClient;
import com.merge.legacy.api.resources.crm.requests.ContactsListRequest;
import com.merge.legacy.api.resources.crm.types.PaginatedContactList;
MergeApiClient mergeClient = MergeApiClient.builder()
.apiKey("YOUR_API_KEY")
.accountToken("YOUR_ACCOUNT_TOKEN")
.build();
ContactsListRequest request = ContactsListRequest.builder()
.expand("company,addresses")
.build();
PaginatedContactList response = mergeClient.crm().contacts().list(request);
System.out.println(response.getResults());
Improvements
- Auto pagination
Users can auto-paginate through responses. Paginated requests will return an Iterable, which can be used to loop through the underlying items. Here's a code snippet below:
import com.merge.api.MergeApiClient;
import com.merge.api.MergeApiClientBuilder;
import com.merge.api.accounting.types.Invoice;
import com.merge.api.accounting.types.InvoicesListRequest;
import com.merge.api.accounting.types.InvoicesListRequestExpandItem;
import com.merge.api.core.SyncPagingIterable;
import java.util.List;
MergeApiClient client = MergeApiClientBuilder.builder()
.apiKey("YOUR_API_KEY")
.accountToken("YOUR_ACCOUNT_TOKEN")
.build();
SyncPagingIterable<Invoice> invoices =
client.accounting().invoices().list(InvoicesListRequest.builder()
.expand(List.of(InvoicesListRequestExpandItem.EMPLOYEE,
InvoicesListRequestExpandItem.ACCOUNTING_PERIOD))
.build());
for (Invoice invoice : invoices) {
System.out.printf(
"invoice: ID: %s, Type: %s\\\\n",
invoice.getId(), invoice.getType());
}
or stream them:
client.accounting().invoices()
.list(InvoicesListRequest.builder()
.expand(List.of(InvoicesListRequestExpandItem.EMPLOYEE,
InvoicesListRequestExpandItem.ACCOUNTING_PERIOD))
.build())
.streamItems()
.map(invoice -> invoice.getId());
or calling nextPage() to perform the pagination manually:
// First page
List<Invoice> pageInvoices = invoices.getItems();
for (Invoice invoice : pageInvoices) {
// ...
}
// Remaining pages
while (invoices.hasNext()) {
pageInvoices = invoices.nextPage().getItems();
for (Invoice invoice : pageInvoices) {
// ...
}
}
- Ability to specify your own OkHttpClient
import com.merge.api.MergeApiClient;
import okhttp3.OkHttpClient;
OkHttpClient customClient = ...;
MergeApiClient client = MergeApiClient
.builder()
.httpClient(customClient)
.build();
v1.1.1
Note all changes are improvements to the Java SDK usage. No changes to the API or the API schema are included in this version.
-
-
feat:
We now provide endpoint methods for streaming byte array requests in addition to the previous methods accepting
byte array directly. -
chore:
Bump Jackson version to latest (2.17.2) -
feat:
We no longer enforce non-null constraints for Object type properties in builders. -
break:
The SDK generator is now on major version 2. To take this upgrade without any breaks, please add the below
configuration to yourgenerators.yml
file:generators: - name: fernapi/fern-java-sdk config: disable-required-property-builder-checks: true
-
feat:
Generated builder methods now enforce non-null checks for required fields, ensuring that all required
fields are properly validated during object construction:@java.lang.Override @JsonSetter("name") public NameStage name(@NotNull String name) { this.name = Objects.requireNonNull(name, "name must not be null"); return this; }
-
chore:
Bump Jackson version to latest (2.17.2) -
feat:
Public constructors can now be generated for all model types:generators: - name: fernapi/fern-java-sdk config: enable-public-constructors: true # default false
-
fix:
Fixed a bug where optional collections are not handled properly in paginated responses. -
fix:
Fixed a bug where local generation custom config doesn't pick up some values, including exception naming. -
fix:
Fixed a bug where OkHttp responses could be closed prematurely. -
feat:
Generated builder methods for optional fields can now accept null directly. -
feat:
The generator now adds a class-level@JsonInclude(JsonInclude.Include.NON_ABSENT)
annotation to
each generated type in place of the previous@JsonInclude(JsonInclude.Include.NON_EMPTY)
by default. This is
configurable in thegenerators.yml
file:generators: - name: fernapi/fern-java-sdk config: json-include: non-empty # default non-absent
5 additional updates, see more
-
v1.0.18
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
v1.0.17
Note: This change impacts all categories. This SDK had some deployment issues that led to the most recent version of the Java SDK not being pushed to Maven. We have resolved the issue and rereleased the changes into this release. The release notes have been aggregated here.
Aggregated Release 1
- Sync the SDKs with the latest updates to the Merge API.
- New common models, query parameters, and fields
- [CRM + Ticketing] Improved typing on the RemoteFields object
value
field to avoid breakage when returning variable types. - Improvements to developer experience
Aggregated Release 2
- Sync the SDKs with the latest updates to the Merge API.
- New common models, query parameters, and fields
isShellData
query parameter- TaxRate added to InvoiceLineItems
- [CRM + Ticketing] Improved typing on the RemoteFields object
value
field to avoid breakage when returning variable types. - Improvements to developer experience
- update code snippets in line
- better comments for easier use of the interfaces
Aggregated Release 3
- Fix the Async Passthrough POST return object typing to allow for a string return when polling for passthrough task completion
- update dependency packages to latest compatible versions.
v1.0.14
Note: version 1.0.13 and 1.0.12 had a breaking change where the ApiError.java
class was accidentally removed. We add this class back to maintain backwards compatibility. Skip v1.0.12 and v1.0.13 when upgrading!
- The
ApiError.java
file and theApiError
class was removed in the previous version. We add it back here to maintain backwards compatibility.
v1.0.13
Note: version 1.0.12 had a breaking change where the ApiError.java
class was accidentally removed. We add this class back to maintain backwards compatibility. Skip v1.0.12 when upgrading!
- The
ApiError.java
file and theApiError
class was removed in the previous version. We add it back here to maintain backwards compatibility.
v1.0.12
Note: DO NOT upgrade to v1.0.12 - this release accidentally removes the ApiError.java
file and the class in that file. It breaks compatibility. This is fixed in v1.0.13 which is already released.
- The SDK now generates undiscriminated unions with de-conflicted method signatures. Previously, certain undiscriminated unions would have failed to compile due to Java's type erasure causing conflicts.
- The SDK generator now supports returning response properties from client methods rather than just the responses themselves.
- The SDK generator now generates
@java.lang.Override
over@Override
in all files to avoid clashes with any
Override.java
class that may have been generated in the same package. The former was used most places, but not all,
until this release. RequestOptions
are now generated with thetimeout
field initialized toOptional.empty()
instead ofnull
to avoid NPEs iftimeout
is not set in the builder.