pywa
pywa copied to clipboard
Implement Named parameters
Codecov Report
:x: Patch coverage is 11.59420% with 61 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 84.88%. Comparing base (a662c16) to head (c1cc36b).
:warning: Report is 321 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| pywa/types/named_parameter.py | 0.00% | 31 Missing :warning: |
| pywa/types/template.py | 21.05% | 30 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #108 +/- ##
==========================================
- Coverage 86.39% 84.88% -1.51%
==========================================
Files 16 17 +1
Lines 3183 3249 +66
==========================================
+ Hits 2750 2758 +8
- Misses 433 491 +58
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
@david-lev any update on when this will be merged ?
@david-lev any update on when this will be merged ?
We're very busy right now. could you briefly explain what the feature does? Is this a new template type?
@yehuda-lev The current implementation only allows numbered variables for templates. While calling the send_template method we pass the values for the variables in the template in the order it's defined in the template.
Now while creating a template itself we can assign a variable name for each variable we define in the template. And the respective values of that variable can be parsed with reference to the variable name while sending a message using that template
(https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates/#text-based)
This feature is useful for us. When will it be merged ?
This feature is useful for us. When will it be merged ?
Soon https://github.com/david-lev/pywa/pull/113#issuecomment-2908720098
Hi @seboraid, Thank you for your contribution and the time you took to explore the idea of named parameters — I really appreciate the effort.
Since this PR was opened, I’ve gone ahead and implemented named template parameters directly in the core of Template with a slightly different design that better fits the overall direction of the library. It offers a more streamlined developer experience, tighter integration with type hints, and improved validation, while keeping backwards compatibility with positional parameters.
Given that, I’ll go ahead and close this PR — but your work definitely helped validate the need for this feature, and I’m grateful for that.
Looking forward to seeing more contributions from you in the future!
You can see the classes here:
https://pywa.readthedocs.io/en/v3/content/templates/types.html#pywa.types.templates.HeaderText https://pywa.readthedocs.io/en/v3/content/templates/types.html#pywa.types.templates.BodyText