Releases: merge-api/merge-java-client
v5.0.1
Merge Java SDK Release Notes - Version [5.0.1]
This release includes support for all of the latest updates to the ticketing category. For more information, see https://www.merge.dev/changelog
v5.0.0
Merge Java SDK Release Notes - Version [5.0.0]
Breaking Changes
- CRM association function param order change
The order of the parameters in thecustomObjectClassesCustomObjectsAssociationsUpdatefunction insrc/main/java/com/merge/api/crm/AssociationsClient.javahas changed. Please review your code if you're using this method.
Improvements
-
Introduced cursor pagination
Previous versions of the sdk only had auto pagination which had limits when used in frontend applications. You can now extract cursor tokens from responses and use them to fetch specific pages.For example see the following code snippet:Example - Extracting and using a cursor:
void testStatelessPaginationWithCursor() {
// Simulate frontend flow: get first page
SyncPagingIterable<Folder> firstPage = client.fileStorage().folders().list();
// Get the first page response to extract cursor
firstPage.getResponse().ifPresent(response -> {
assertTrue(response instanceof PaginatedFolderList, "Response should be PaginatedFolderList");
PaginatedFolderList paginatedResponse = (PaginatedFolderList) response;
// If there's a next cursor, test stateless pagination by actually using it
paginatedResponse.getNext().ifPresent(nextCursor -> {
// This demonstrates how a frontend would implement stateless pagination
// by using the cursor token from the response
assertNotNull(nextCursor, "Next cursor should be available");
assertFalse(nextCursor.trim().isEmpty(), "Next cursor should not be empty");
// Frontend sends cursor back to backend for next page
FoldersListRequest secondPageRequest =
FoldersListRequest.builder().cursor(nextCursor).build();
// Backend fetches second page using the cursor
SyncPagingIterable<Folder> secondPage =
client.fileStorage().folders().list(secondPageRequest);
assertNotNull(secondPage, "Second page should not be null");
// Verify we got a valid response with results
secondPage.getResponse().ifPresent(secondResponse -> {
assertTrue(
secondResponse instanceof PaginatedFolderList,
"Second page response should be PaginatedFolderList");
PaginatedFolderList secondPageResponse = (PaginatedFolderList) secondResponse;
assertNotNull(secondPageResponse.getResults(), "Second page should have results");
});
});
});
}
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.AccessLevelEnumnow 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.ymlfile: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.ymlfile: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
valuefield 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
isShellDataquery parameter- TaxRate added to InvoiceLineItems
- [CRM + Ticketing] Improved typing on the RemoteFields object
valuefield 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.javafile and theApiErrorclass 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.javafile and theApiErrorclass was removed in the previous version. We add it back here to maintain backwards compatibility.