-
Notifications
You must be signed in to change notification settings - Fork 35
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
Provide Beans for JSON Response from Relay Webhooks #62
Comments
It is a good idea and I am happy to create the POJO's I assume the user of the POJO's would have the responsibility to run their own HTTP server and instantiate the proper Event class for deserialization? |
I have a couple of generators that maybe easily adapted to be able to create the POJO's for the Webhook events. They are:
It might be pretty easy to adapt those to generate at least the initial Webhook POJOs |
Hi Chris, yes to both your questions. My webapp both needs to send and receive emails. The email content is sort of structured data (it is a position reporting system for sailing yachts around the world). I use GSON for other JSON data requests and since you guys already have a Java lib I thought it might be nice to have the POJO's to make getting the relay webhook data in a Java friendly manner.
…________________________________
From: Chris Wilson <[email protected]>
Sent: Friday, April 21, 2017 10:28 AM
To: SparkPost/java-sparkpost
Cc: jonturgeon; Author
Subject: Re: [SparkPost/java-sparkpost] Provide Beans for JSON Response from Relay Webhooks (#62)
It is a good idea and I am happy to create the POJO's
I assume the user of the POJO's would have the responsibility to run their own HTTP server and instantiate the proper Event class for deserialization?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#62 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFkG36V5-3KNBu4evwf7oUvQNfqk2bD7ks5ryLz7gaJpZM4NEGgZ>.
|
Hi again, I used this site to get my initial POJO's http://pojo.sodhanalibrary.com/Convert
I fed it the sample response from the relay webhook documentation. Just thought it might be nicer to have a set of POJO's that came from SparkPost to make sure we are not all missing something.
…________________________________
From: Chris Wilson <[email protected]>
Sent: Friday, April 21, 2017 12:26 PM
To: SparkPost/java-sparkpost
Cc: jonturgeon; Author
Subject: Re: [SparkPost/java-sparkpost] Provide Beans for JSON Response from Relay Webhooks (#62)
I have a couple of generators that maybe easily adapted to be able to create the POJO's for the Webhook events. They are:
* Webhook Documentor<https://github.com/SparkPost/momentum_sample_policy/tree/master/webhook-document-generator>
* an ObjC generator that is not checked in yet
It might be pretty easy to adapt those to generate at least the initial Webhook POJOs
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#62 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFkG37DXS_uvf_8pIrMV9cTWE3BCYeWSks5ryNi7gaJpZM4NEGgZ>.
|
yes, I totally agree with you. It will be nice to have those directly in the SparkPost Library. My comments above are really more about can I do something to help me generate code on other projects I need to do at the same time as I get this implemented in the Java library. |
I should also note I gladly welcome Pull Requests if this is something you want to take on. |
Hi again, although I have been whacking away at Java for years, I am completely new to SparkPost and I would not want to put something out with that little bit of knowledge. If you want I can send you my beans so far, they seem to be working for my single test case but they are by no means finished. I also do this development as a bit of a hobby, I left my corporate job 6 years ago to sail around the world, I am doing this website as sort of a way to keep my head in it. I would also be willing to incorporate any beans you create and drop mine and see how they work for me.
…________________________________
From: Chris Wilson <[email protected]>
Sent: Friday, April 21, 2017 12:48 PM
To: SparkPost/java-sparkpost
Cc: jonturgeon; Author
Subject: Re: [SparkPost/java-sparkpost] Provide Beans for JSON Response from Relay Webhooks (#62)
I should also note I gladly welcome Pull Requests if this is something you want to take on.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#62 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFkG327UFbNl_LFSMrR079nAFAT121yTks5ryN3tgaJpZM4NEGgZ>.
|
I guess I had better meet you on your Yacht so we can pair program it then ;) Kidding aside, I would be glad to look at what you have. I will work on adding Webhook events as a first class citizen to the library as you suggested. |
Attached are my work in progress beans and below is the code I use to populate them
//Stripes puts the JSON response in the parameter map
String relayJSON = this.getContext().getRequest().getParameterMap().entrySet().iterator().next().toString();
//The JSON is a bit wonky, need to be "lenient"
JsonReader reader = new JsonReader(new StringReader(relayJSON));
reader.setLenient(true);
RelayWebhook[] relayWebhooks = new Gson().fromJson(reader, RelayWebhook[].class);
…________________________________
From: Chris Wilson <[email protected]>
Sent: Friday, April 21, 2017 1:08 PM
To: SparkPost/java-sparkpost
Cc: jonturgeon; Author
Subject: Re: [SparkPost/java-sparkpost] Provide Beans for JSON Response from Relay Webhooks (#62)
I guess I had better meet you on your Yacht so we can pair program it then ;)
Kidding aside, I would be glad to look at what you have. I will work on adding Webhook events as a first class citizen to the library as you suggested.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#62 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFkG36WOwQecB3FhWq6BvJm-Vzlixwtjks5ryOKbgaJpZM4NEGgZ>.
|
I've created a branch with the initial pass at creating webhook events here Still need to test them to see if they work. |
Would be nice to have a set of POJO's that could be used with GSON for decoding the JSON Relay Webhook response.
The text was updated successfully, but these errors were encountered: