Conversation
|
@mcosier thank you for submitting this PR! Note that you can already set the var message = new PostmarkMessage
{
From = "sender@example.com",
To = "recipient@example.com",
Cc = "cc@example.com",
Subject = "A complex email",
HtmlBody = "<html><body>Test Body</body></html>",
MessageStream = "outbound"
};That constructor is there for convenience, in order to keep support for that coding style, mostly aimed for simpler scenarios. The models themselves are mutable anyway, so for more complex scenarios that involve providing many optional arguments, currently we recommend using the Object Initialiser style to create request DTOs. |
|
Thanks @vladsandu, my only concern is that lot of people may 'miss' this commonly used field due to the lack of examples in the documentation (for v2) accompanied by its dependence on the type of coding style one uses. Exposing it (at very least) to the extension method(s), or a secondary extension method may increase your uptake - without it being an obvious capability, people may look elsewhere or other ways to interact with the API directly. I'd be happy to update that v2 documentation for you with a sample if you are interested. |
|
@mcosier thank you for your message and I apologise for the delay! I agree that's a valid concern. I went ahead and updated our wiki examples to include usage of the Regarding adding that field to our extension methods, I'm reluctant about expanding them further just to facilitate initialising optional fields. That extension method has been there for historical reasons, possibly to facilitate transition from older versions of the library. But I'm thinking this type of method can become quite verbose and harder to maintain when working with complex models in the long run. Going forward, I believe we should prefer and recommend using Object initialisers for populating these complex DTOs. |
Surfacing the commonly used CC field into the PostmarkMessage constructor and SendMessage extensions to make its availability more visible to the developer.