Skip to content

Add mail.* v3 service for mailbox/message/recipient#520

Open
mesilov wants to merge 2 commits into
v3-devfrom
feature/516-add-mail-v3-service
Open

Add mail.* v3 service for mailbox/message/recipient#520
mesilov wants to merge 2 commits into
v3-devfrom
feature/516-add-mail-v3-service

Conversation

@mesilov

@mesilov mesilov commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator
Q A
Bug fix? no
New feature? yes
Deprecations? no
Issues Fix #516
License MIT

Adds REST API v3 Services\Mail scope support for mail.* methods.

Implemented:

  • getMailScope() on the root service builder
  • separate Mailbox, Message, and Recipient services
  • separate field metadata services: MailboxField, MessageField, and RecipientField
  • result wrappers for mailbox, sender, message, recipient, action, and field metadata responses
  • batch helpers for list/send style operations
  • unit and integration test coverage, including annotation/type tests for result items
  • integration_tests_scope_mail PHPUnit suite and make test-integration-scope-mail
  • changelog entry for Add mail.* v3 service — mailbox/message/recipient (24 methods) #516

Test plan

  • make oa-schema-build - passed
  • make lint-cs-fixer - passed
  • make lint-rector - passed
  • make lint-phpstan - passed
  • make lint-deptrac - passed
  • make test-unit - passed
  • make test-integration-scope-mail - passed, 27 tests, 40 assertions, 11 skipped because the test portal has empty mailbox/contact/message collections for data-dependent checks

Closes #516

@mesilov mesilov added this to the 3.4.0 milestone Jun 30, 2026
@mesilov mesilov self-assigned this Jun 30, 2026
@mesilov mesilov marked this pull request as ready for review June 30, 2026 07:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 406279550d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{
$result = $this->getCoreResponse()->getResponseData()->getResult();

return (bool)($result['result'] ?? $result);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve false boolean API results

When mail.message.createcrmactivity or mail.message.removecrmactivity returns a plain false, Response::getResponseData() normalizes that scalar to [false]; because there is no result key here, this line casts the non-empty array to true. As a result BooleanResult::isSuccess() reports success even when the API result is false, so callers cannot detect a failed/no-op CRM activity operation.

Useful? React with 👍 / 👎.

)]
public function mailboxList(array $order = [], array $filter = [], array $select = [], ?int $limit = null): Generator
{
foreach ($this->batch->getTraversableList('mail.mailbox.list', $order, $filter, $select, $limit) as $key => $value) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Send mail batch subcommands through API v3

These new mail endpoints are invoked with ApiVersion::v3 in the normal service methods, but BatchOperationsInterface::getTraversableList() has no API-version argument and Core\Batch::getTraversableList() calls $this->core->call($apiMethod, $params) using the default v1 REST path. In practice, using getMailScope()->mailbox()->batch->mailboxList() (and the analogous message/recipient batch methods) will submit mail.* subcommands through the v1 batch machinery instead of /rest/api, so the v3-only mail methods will fail even though the non-batch wrappers work.

Useful? React with 👍 / 👎.

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.

1 participant