-
Notifications
You must be signed in to change notification settings - Fork 410
Implement better "java state of the art" API #126
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
Comments
Thanks @aholbreich, I like all of your suggested changes. I'm looking forward to implementing during the refactor of the Mail Send helper. |
@thinkingserious my coworkers and I would also definitely appreciate this refactor. One request I have is to please retain the "fluent" style of the 2.2.2 client, (where you can chain method calls together, by having mutator methods return the object that they mutate. See https://github.com/sendgrid/sendgrid-java/blob/v2.2.2/src/main/java/com/sendgrid/SendGrid.java#L209 as an example). Honestly, the API of the 2.2.2 client was very good, and is, IMO, a worthy reference — if not an ideal — for how this client should behave. As it was written, it supported both the (still relatively pleasant) multi-line style illustrated in @aholbreich's example, as well as chaining calls together like so: Sendgrid.Email email = new Email()
.setFrom("[email protected]")
.setTo("[email protected]")
.setSubject("I thought you would like this email!")
.setBody("I hope you are having a good day");
SendGrid.Response response = sendGridClient.send(email); Ideally, I feel that a consumer of this client shouldn't need to know anything about the under-the-hood REST machinations (content type, method, endpoint, etc.) — it should be as simple as configuring a client object, passing that client object an "email" object, and receiving a Response object that represents the success or failure of the operation. Admittedly, my use cases so far have been relatively simple, so maybe your power-users are scoffing at such a suggestion — regardless, I'm of the opinion that the more abstraction of the actual REST nitty-gritty you can provide, the better. Finally, I want to be clear that I'm not trying to trivialize the hard work I'm sure you've put into the 3.0 version, and I hope I don't come off as overly pedantic. I just thought it would be helpful to provide some feedback about what I liked about the prior release, as a user. |
Hello @carry, Thank you for the great feedback! We definitely agree with "a consumer of this client shouldn't need to know anything about the under-the-hood REST machinations" and that's the direction we are headed. The Mail Helper is the first step in that direction. We took a few steps back to gain support for the v3 API and we are now looking forward to iterating along with community feedback. Thanks for the kind words and for your time and great feedback please email us at [email protected] with your T-shirt size and mailing address :) Same for you @aholbreich if we have not already done so. Also, I've added your vote to the issue to help get it higher in our backlog. Thanks! |
@caryy i like your improvements 👍 i think in same direction. I don't know well other parts of the API beyond the sending endpoint. But there is a lot according to documentation. Therefore in my opinion this part First Response need to hanlde specific responses of all API parts. I gess there are some that may return some statistic for example.
Here ContentResponse given but can be subclass of Response. Also Mailer and Metric entpoins could make sence. Hope this makes some sense. :) |
Hello @caryy, @aholbreich, Since you are some of the few that have providing amazing feedback, I thought you might be interested in this: #140 :) |
So I made this pull request trying to answer this issue, could you look at it ? |
I replied to your pull request, thanks! You may also be interested in the Mail Helpers project: https://github.com/sendgrid/sendgrid-java/projects |
you can use https://github.com/danielnorberg/auto-matter or https://github.com/google/auto/tree/master/value for your POJOs |
Thanks for the feedback @gilles! |
Just a 👍 for all of this, and a quick list of things I'd change (some duplicates to what's already here)
EDIT: more
|
Thanks for the feedback @kag0! I'm very much looking forward to the next iteration of this library :) |
Hello Everyone, Please follow this issue to track progress and provide feedback. Thanks! With Best Regards, Elmer |
Uh oh!
There was an error while loading. Please reload this page.
Instead of
ist should look like
as example. Discussible in details.
The text was updated successfully, but these errors were encountered: