mailjet / mailjet-apiv3-dotnet

[API v3] Official Mailjet API v3 .NET wrapper
https://dev.mailjet.com
MIT License
74 stars 31 forks source link

How to use complex variables with the TransactionalEmailBuilder #64

Closed ChiefWiggum closed 3 years ago

ChiefWiggum commented 3 years ago

How can I add complex variables (e.g. a list of products) to an email with the TransactionalEmailBuilder? Somehow the WithVariable()allows only to add a string, not an object. Is there a reason for this behaviour?

sdiakovskyi-gd commented 3 years ago

Hi @ChiefWiggum, thanks for contributing!

I'm gonna check your PR later today, want to ensure some scenarios.

ChiefWiggum commented 3 years ago

Ok, thanks. After my PR I discovered a Clone Method on the TransactionalEmailBuilder which will probably not create proper clones of the variables. So that's an issue I haven't figured out/thought of a solution yet...

sdiakovskyi-gd commented 3 years ago

@ChiefWiggum regarding Clone method - yep, but as for me, that's correct behavior - it performs a deep clone of the builder properties, but uses shallow copies of passed parameters.

BTW I've released a new version with your changes, which should be available through NuGet.