Add mail.* v3 service for mailbox/message/recipient#520
Conversation
There was a problem hiding this comment.
💡 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); |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 👍 / 👎.
Adds REST API v3
Services\Mailscope support formail.*methods.Implemented:
getMailScope()on the root service builderMailbox,Message, andRecipientservicesMailboxField,MessageField, andRecipientFieldintegration_tests_scope_mailPHPUnit suite andmake test-integration-scope-mailTest plan
make oa-schema-build- passedmake lint-cs-fixer- passedmake lint-rector- passedmake lint-phpstan- passedmake lint-deptrac- passedmake test-unit- passedmake test-integration-scope-mail- passed, 27 tests, 40 assertions, 11 skipped because the test portal has empty mailbox/contact/message collections for data-dependent checksCloses #516