-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: master
Are you sure you want to change the base?
Conversation
Thank you, @p-vorobyev! Unfortunately, this can't be merged now, because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alles gut
public <T extends TdApi.Object> CompletableFuture<Result<T>> send(TdApi.Function<T> query) { | ||
CompletableFuture<Result<T>> future = new CompletableFuture<>(); | ||
send(query, object -> { | ||
if (object instanceof TdApi.Error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Because of CompletableFuture available since java 1.8, minimum supported version has been updated too.