Skip to content

v5.0.0

Latest

Choose a tag to compare

@niteshsandal-merge niteshsandal-merge released this 08 Oct 14:36
· 1 commit to main since this release
b25474a

Merge Java SDK Release Notes - Version [5.0.0]

Breaking Changes

  • CRM association function param order change
    The order of the parameters in thecustomObjectClassesCustomObjectsAssociationsUpdate function in src/main/java/com/merge/api/crm/AssociationsClient.java has 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");
                });
            });
        });
    }