Documenting "withContactCounts" for campaign API#293
Documenting "withContactCounts" for campaign API#293escopecz wants to merge 11 commits intomautic:7.1from
Conversation
Co-authored-by: Ayu Adiati <45172775+adiati98@users.noreply.github.com>
|
@adiati98 thanks for the suggestions! Applied |
| - array | ||
| - Array of Event entities for the Campaign - see below | ||
| * - ``contactCount`` | ||
| - int |
There was a problem hiding this comment.
We now use 'integer' instead of 'int'. Let's update this for consistency/
| - int | |
| - integer |
There was a problem hiding this comment.
It is int in the lines above. It would be weird to change that from the consistency perspective. Also in PHP the integer type is int in the code.
| - int | ||
| - Number of Contacts in the Campaign. This property requires the ``withContactCounts=true`` query parameter | ||
| * - ``contactCountFetchedAt`` | ||
| - datetime/null |
There was a problem hiding this comment.
question:
I believe when the type is empty, it'll be automatically set to 'null'? Would it be the same if we only mention 'datetime' instead of 'datetime/null'?
I think, if we want to say `datetime/null', we might want as well to add 'null' to other types, e.g., 'integer/null', etc.
| - datetime/null | |
| - datetime |
There was a problem hiding this comment.
This is the type that the programmers should expect. It could be a datetime but it can also be null. If they well always expect datetime then the null value can cause errors. I think we should be explicit to avoid surprises.
There was a problem hiding this comment.
Does this then only applied for datetime type or for other types as well?
There was a problem hiding this comment.
I'd have to go check every property to answer. In this PR I only care about those 2 I've added.
There was a problem hiding this comment.
Pull request overview
Adds REST API documentation for the withContactCounts query parameter on Campaign endpoints, describing the returned contact-count fields and the caching behavior/TTL configuration.
Changes:
- Documented
contactCountandcontactCountFetchedAtCampaign properties (gated behindwithContactCounts=true). - Added
withContactCountsto the List Campaigns query parameters and clarified cache TTL behavior in a note. - Allowed the acronym “TTL” in Vale’s accepted vocabulary.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/rest_api/campaigns.rst | Documents withContactCounts behavior, additional response fields, and caching/TTL configuration notes. |
| .github/styles/config/vocabularies/Mautic/accept.txt | Adds “TTL” to the Vale accept list to prevent linting false-positives. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| * ``contactCount``: number of Contacts in the Campaign - integer | ||
| * ``contactCountFetchedAt``: timestamp of the Contact count retrieval - ISO 8601 format | ||
|
|
||
| .. vale off | ||
|
|
There was a problem hiding this comment.
There is trailing whitespace on the blank lines inside this note block (after the introductory sentence and after .. vale off). Please remove the extra spaces to avoid whitespace/formatting lint failures.
| * ``contactCount``: number of Contacts in the Campaign - integer | |
| * ``contactCountFetchedAt``: timestamp of the Contact count retrieval - ISO 8601 format | |
| .. vale off | |
| * ``contactCount``: number of Contacts in the Campaign - integer | |
| * ``contactCountFetchedAt``: timestamp of the Contact count retrieval - ISO 8601 format | |
| .. vale off |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * - ``minimal`` | ||
| - Return only array of entities without additional lists in it | ||
| * - ``withContactCounts`` | ||
| - Include Contact count for each Campaign. Accepts ``true`` or ``false``, with ``false`` as the default. The system caches Contact counts for 12 hours by default. Set the ``campaign_contact_count_cache_ttl`` parameter in ``config/local.php`` to configure the cache TTL - value in seconds |
There was a problem hiding this comment.
The docs mention a configurable campaign_contact_count_cache_ttl parameter in config/local.php, but this key doesn’t appear anywhere else in the repository (only in this doc). Please verify the actual config/parameter name used by the implementation and update the docs accordingly (or remove the configurability claim if it isn’t supported).
| - Include Contact count for each Campaign. Accepts ``true`` or ``false``, with ``false`` as the default. The system caches Contact counts for 12 hours by default. Set the ``campaign_contact_count_cache_ttl`` parameter in ``config/local.php`` to configure the cache TTL - value in seconds | |
| - Include Contact count for each Campaign. Accepts ``true`` or ``false``, with ``false`` as the default. The system caches Contact counts for 12 hours by default. |
Docs for mautic/mautic#15878. This should be rebased to the 7.1 branch once it exists.