Comments (3)
Hi @valh1996
Sorry for the late response. At the moment, we suggest transforming the model for specific objects, just the way you did in the workaround. If you would like to file a feature request that we could add in future, please create a separate feature request.
from postmark-java.
Hi @liorhar
could you share bit more details on where do you use this and in which scenario? Are you referring to template model, when sending emails with templates?
Thanks
from postmark-java.
Hi @ibalosh
I'm trying to send a List of DTO through setTemplateModel()
:
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class PeriodData {
public LocalDate start;
public LocalDate end;
}
List<PeriodData> periods = this.periodService.getPeriods(contract);
HashMap<String, Object> model = new HashMap<>() {{
put("periods", periods);
//
}};
TemplatedMessage message = new TemplatedMessage(senderAddress, recipient);
message.setMessageStream("outbound");
message.setTemplateId(templateId);
message.setTemplateModel(model);
postmarkClient.deliverMessageWithTemplate(message);
However, I encounter the following error:
Java 8 date/time type `java.time.LocalDate` not supported by default
The ObjectMapper defined here does not seem to have the Java Time module configured. Is there a fix please?
Update:
As a workaround, I use my own ObjectMapper to transform my model to json before sending it into the request:
message.setTemplateModel(mapper.writeValueAsString(model));
from postmark-java.
Related Issues (20)
- Unsupported Date format HOT 2
- NoSuchFieldError: UPPER_CAMEL_CASE error when using Postmark Java SDK HOT 1
- Naming inconsistancy: Bounce.java is the only class using getMessageID instead of getMessageId HOT 2
- Some methods were not updated to handle the new JSON error code & error message responses HOT 1
- Java 9: Illegal reflective access warning caused by JAXB dependency HOT 8
- [1.5.6] ProcessingException after upgrading from 1.5.5 to 1.5.6 HOT 10
- log4j2.properties overriding log4j2 configuration HOT 1
- Logging dependencies HOT 5
- `message.addHeader` function not backwards compatible HOT 2
- Updated dependencies with high vulnerabilities HOT 1
- Allowing comma separated emails HOT 5
- HeaderValueException:Too many "Content-Type" header values: "[application/json, application/json]" HOT 13
- HeaderValueException:Too many "Content-Type" header values: "[application/json, application/json]" HOT 2
- HeaderValueException:Too many "Content-Type" header values: "[application/json, application/json] HOT 2
- Apache Tika vulnerabilities HOT 2
- Version `1.8.2` introduces `slf4j-simple` dependency HOT 2
- Upgrade Apache Tika to address vulnerability HOT 2
- Improve error handling, when HTTP status is unknown HOT 1
- Is ApiClient threadsafe? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postmark-java.