Skip to content

Documenting "withContactCounts" for campaign API#293

Open
escopecz wants to merge 11 commits intomautic:7.1from
escopecz:MAUT_13385
Open

Documenting "withContactCounts" for campaign API#293
escopecz wants to merge 11 commits intomautic:7.1from
escopecz:MAUT_13385

Conversation

@escopecz
Copy link
Copy Markdown
Member

Docs for mautic/mautic#15878. This should be rebased to the 7.1 branch once it exists.

@escopecz escopecz requested a review from a team as a code owner February 17, 2026 09:42
@escopecz escopecz requested review from adiati98 and favour-chibueze and removed request for a team February 17, 2026 09:42
Copy link
Copy Markdown
Contributor

@adiati98 adiati98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @escopecz! I have some suggestions to address here. TIA! ✨

Co-authored-by: Ayu Adiati <45172775+adiati98@users.noreply.github.com>
@escopecz
Copy link
Copy Markdown
Member Author

@adiati98 thanks for the suggestions! Applied

adiati98
adiati98 previously approved these changes Mar 8, 2026
@adiati98 adiati98 added this to the 7.1 milestone Mar 9, 2026
@adiati98 adiati98 changed the base branch from 5.x to 7.1 March 25, 2026 07:16
@adiati98 adiati98 dismissed their stale review March 25, 2026 07:16

The base branch was changed.

@adiati98 adiati98 requested review from a team and adiati98 March 25, 2026 07:16
Copy link
Copy Markdown
Contributor

@adiati98 adiati98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @escopecz,

There's some minor tweak here, and I have a question. TIA! ✨

- array
- Array of Event entities for the Campaign - see below
* - ``contactCount``
- int
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now use 'integer' instead of 'int'. Let's update this for consistency/

Suggested change
- int
- integer

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- datetime/null
- datetime

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this then only applied for datetime type or for other types as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have to go check every property to answer. In this PR I only care about those 2 I've added.

Co-authored-by: Ayu Adiati <45172775+adiati98@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 contactCount and contactCountFetchedAt Campaign properties (gated behind withContactCounts=true).
  • Added withContactCounts to 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.

Comment on lines +327 to +332

* ``contactCount``: number of Contacts in the Campaign - integer
* ``contactCountFetchedAt``: timestamp of the Contact count retrieval - ISO 8601 format

.. vale off

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
* ``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

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 25, 2026 09:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
- 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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants