Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompletableFuture support for java client #2792

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

p-vorobyev
Copy link

@p-vorobyev p-vorobyev commented Feb 17, 2024

Added option to java client to send query with CompletableFuture response. It allows work in a functional style with asynchronous requests, as well as chaining and combining.

client.send(new TdApi.GetMe()).thenAccept(userResult -> {
            if (userResult.error == null) {
                TdApi.User user = userResult.object;
                System.out.println("I'm " + user.firstName + " " + user.lastName);
            }
        });

Because of CompletableFuture available since java 1.8, minimum supported version has been updated too.

@levlam
Copy link
Contributor

levlam commented Feb 26, 2024

Thank you, @p-vorobyev!

Unfortunately, this can't be merged now, because CompletableFuture is available on Android only since Android 7.0 and Telegram apps still support Android 4.*, but it can be merged after support for the old Android versions is dropped, which should happen someday.

Copy link

@timscharfenort8 timscharfenort8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alles gut

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants