brevo-php icon indicating copy to clipboard operation
brevo-php copied to clipboard

API support for multiple-choice

Open suvikankare opened this issue 1 year ago • 3 comments

Brevo has a new attribute type multiple-choice.

Adding this attribute type to Brevo breaks Drupal module using brevo-php and gives this error:

InvalidArgumentException: Invalid value for 'type', must be one of 'text', 'date', 'float', 'id', 'boolean' in /var/www/html/vendor/getbrevo/brevo-php/lib/Model/GetAttributesAttributes.php:373 Stack trace: #0 /var/www/html/vendor/getbrevo/brevo-php/lib/ObjectSerializer.php(316): Brevo\Client\Model\GetAttributesAttributes->setType('multiple-choice')

suvikankare avatar Sep 26 '24 13:09 suvikankare

Came across the same issue when getting the attributes (with getAttributes()).

However, came across an additional issue where there's no support for updating these type of attributes. See the constructor of Brevo\Client\Model\UpdateAttribute. Here, there's no support for multiCategoryOptions containing an array of strings (as defined by the API docs)

Blacksnipe avatar Oct 01 '24 09:10 Blacksnipe

Here is a patch that will allow Drupal's custom fields list to be retrieved correctly, it's meant to be a temporary solution.

To use it in your composer.json add this in the patches section (using cweagans/composer-patches):

        "patches": {
            "getbrevo/brevo-php": { 
                "[issues/40] Support for multiple-choice attribute --- avoid breaking sendinblue_api custom fields list": "patches/getbrevo_brevo-php/brevo-php_multiple-choice-support_40.patch"
            }
        },
        "enable-patching": "true",

brevo-php_multiple-choice-support_40.patch

tostinni avatar Dec 19 '24 04:12 tostinni

Hi, the Drupal patch works fine to prevent PHP errors, but the API still does not support creating or updating multiple-choice fields. Is this a planned feature?

finex avatar Sep 15 '25 15:09 finex