diff --git a/.fern/metadata.json b/.fern/metadata.json
index ae9343ef..7cfa835d 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -1,10 +1,19 @@
{
- "cliVersion": "3.85.3",
+ "cliVersion": "3.91.1",
"generatorName": "fernapi/fern-php-sdk",
- "generatorVersion": "2.1.2",
+ "generatorVersion": "2.1.4",
"generatorConfig": {
"clientName": "Brevo",
"namespace": "Brevo",
+ "composerJson": {
+ "description": "Official PHP SDK for the Brevo API.",
+ "author": {
+ "name": "Brevo",
+ "url": "https://brevo.com",
+ "email": "support@brevo.com"
+ },
+ "license": "MIT"
+ },
"enable-wire-tests": true,
"propertyAccess": "public",
"packageName": "getbrevo/brevo-php",
diff --git a/composer.json b/composer.json
index e4f4211b..5323fe78 100644
--- a/composer.json
+++ b/composer.json
@@ -1,13 +1,13 @@
{
"name": "getbrevo/brevo-php",
"version": "4.0.6",
- "description": "Brevo PHP Library",
+ "description": "Official PHP SDK for the Brevo API.",
"keywords": [
"brevo",
"api",
"sdk"
],
- "license": [],
+ "license": "MIT",
"require": {
"php": "^8.1",
"ext-json": "*",
@@ -42,5 +42,10 @@
],
"test": "phpunit",
"analyze": "phpstan analyze src tests --memory-limit=1G"
+ },
+ "author": {
+ "name": "Brevo",
+ "url": "https://brevo.com",
+ "email": "support@brevo.com"
}
}
\ No newline at end of file
diff --git a/reference.md b/reference.md
index a6fab8ef..1995164a 100644
--- a/reference.md
+++ b/reference.md
@@ -3853,9 +3853,9 @@ type **Marketing** channel **SMS** ####
-
-
-To have it activated please send us a request and we will activate it for your account.
-
+This is an enterprise feature.
+
+To have it activated please send us a request and we will activate it for your account.
Exports webhook event history to CSV format for analysis and reporting.
@@ -4175,6 +4175,7 @@ $client->webhooks->updateWebhook(
#### `spam`, `opened`, `click`, `hardBounce`, `softBounce`,
`unsubscribed`, `listAddition` & `delivered` - Possible values
for **Inbound** type webhook: #### `inboundEmailProcessed`
+#### `reply`
@@ -4868,12 +4869,8 @@ $client->externalFeeds->deleteExternalFeed(
-
-
-Custom objects are only available to Enterprise plans.
-
-This feature is in beta. These are subject to change.
-
-
+Custom objects are only available to Enterprise plans.
+This feature is in beta. These are subject to change.
This API allows bulk upsert of object records in a single request. Each object record may include
- Attributes
- Identifiers
@@ -4887,8 +4884,8 @@ This API allows bulk upsert of object records in a single request. Each object r
- Max 500 attributes defined per object record upsert request
- This is coherent with schema limitation: an object cannot have more than 500 attributes.
- Worth noting: Nothing happens If an attribute is mentioned in the request, but was not previously defined for the object schema (no error, no attribute creation)
- - Max 10 associations defined per object record upsert request
- - This is coherent with schema limitation: an object cannot have more than 10 associations with other objects. and each object record can be linked to max 10 other records.
+ - Max 10 associations defined per associated object type, in each record of the request
+ - This is not a schema limitation. You can associate an object record to an unlimited number of other object records by running multiple requests.
**Errors:**
- Make sure both object records exist before associating them, else the API will return an error.
- This route does not create objects. The object where the object records are upserted by this API must be created already else the API will return an error "invalid object type".
@@ -4960,12 +4957,8 @@ $client->customObjects->upsertrecords(
-
-
-Custom objects are only available to Enterprise plans.
-
-This feature is in beta. These are subject to change.
-
-
+Custom objects are only available to Enterprise plans.
+This feature is in beta. These are subject to change.
This API retrieves a list of object records along with their associated records and provides the total count of records for the specified object. **Note**: Contact as object type is not supported in this endpoint.
@@ -5124,26 +5117,6 @@ $client->customObjects->batchDeleteObjectRecords(
-
-#### 📝 Description
-
-
--
-
-
--
-
-
-Accepted Number Formats
-
-91xxxxxxxxxx
-+91xxxxxxxxxx
-0091xxxxxxxxxx
-
-
-
-
-
-
#### 🔌 Usage
@@ -5250,6 +5223,8 @@ $client->contacts->getContacts(
-
+Follow this format when passing a "SMS" phone number as an attribute.
+Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
Creates new contacts on Brevo. Contacts can be created by passing either -
1. email address of the contact (email_id),
2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}
3. ext_id
@@ -5708,9 +5683,7 @@ $client->contacts->updateBatchContacts(
-
-
-attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
-
+attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
@@ -5927,17 +5900,11 @@ $client->contacts->requestContactExport(
-
-
-Ongoing changes for this endpoint
-
+Ongoing changes for this endpoint
We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
-
These are non breaking changes.
-
The default value for the attributes will be 0.
-
-The uniqueSubscribers field is deprecated
-
+The uniqueSubscribers field is deprecated
@@ -6051,13 +6018,9 @@ $client->contacts->createFolder(
-
-
-Ongoing changes for this endpoint.
-
+Ongoing changes for this endpoint.
We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
-
-These are non breaking changes. The default value for the attributes will be 0.
-
+These are non breaking changes. The default value for the attributes will be 0.
@@ -6208,13 +6171,9 @@ $client->contacts->deleteFolder(
-
-
-Ongoing changes for this endpoint.
-
+Ongoing changes for this endpoint.
We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
-
-These are non breaking changes. The default value for the attributes will be 0.
-
+These are non breaking changes. The default value for the attributes will be 0.
@@ -6431,13 +6390,9 @@ $client->contacts->importContacts(
-
-
-Ongoing changes for this endpoint.
-
+Ongoing changes for this endpoint.
We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
-
-These are non breaking changes. The default value for the attributes will be 0.
-
+These are non breaking changes. The default value for the attributes will be 0.
@@ -6966,14 +6921,8 @@ $client->contacts->getSegments(
-
-
-Accepted Number Formats
-
-91xxxxxxxxxx
-+91xxxxxxxxxx
-0091xxxxxxxxxx
-
-
+Follow this format when passing a "SMS" phone number as an attribute.
+Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
There are 2 ways to get a contact
Option 1- https://api.brevo.com/v3/contacts/{identifier}
Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges.
@@ -7055,6 +7004,8 @@ $client->contacts->getContactInfo(
-
+Follow this format when passing a "SMS" phone number as an attribute.
+Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
There are 2 ways to update a contact
Option 1- https://api.brevo.com/v3/contacts/{identifier}
Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
@@ -8598,9 +8549,7 @@ $client->ecommerce->createOrder(
'createdAt' => '2021-07-29T20:59:23.383Z',
'id' => '14',
'products' => [
- new OrderProductsItem([
- 'price' => 99.99,
- 'productId' => 'P1',
+ new OrderProductsItemQuantity([
'quantity' => 10,
]),
],
@@ -8669,9 +8618,7 @@ $client->ecommerce->createBatchOrder(
'createdAt' => '2021-07-29T20:59:23.383Z',
'id' => '14',
'products' => [
- new OrderProductsItem([
- 'price' => 99.99,
- 'productId' => 'P1',
+ new OrderProductsItemQuantity([
'quantity' => 10,
]),
],
@@ -11459,7 +11406,7 @@ $client->balance->getTransactionHistoryApi(
'pid',
new GetLoyaltyBalanceProgramsPidTransactionHistoryRequest([
'contactId' => 1,
- 'balanceDefinitionId' => 'balance_definition_id',
+ 'balanceDefinitionId' => 'balanceDefinitionId',
]),
);
```
@@ -12322,6 +12269,71 @@ $client->program->getParameterSubscriptionInfo(
+
+
+
+
+$client->program->deleteContactSubscription($pid, $cid)
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Delete subscription for a contact
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```php
+$client->program->deleteContactSubscription(
+ 'pid',
+ 1,
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**$pid:** `string` — Loyalty Program ID. A unique identifier for the loyalty program.
+
+
+
+
+
+-
+
+**$cid:** `int` — Contact ID.
+
+
+
+
+
+
+
@@ -14350,11 +14362,8 @@ $client->tier->deleteTier(
-
-
-The response payload for this endpoint has changed
-
-You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns).
-
+The response payload for this endpoint has changed
+You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns).
@@ -16352,19 +16361,11 @@ $client->whatsAppCampaigns->getWhatsAppCampaigns(
-
-
-You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
-
-[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
-
-
-
-This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information.
-
+You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
[Get all the Lists](https://developers.brevo.com/reference/getlists-1)
-
-[Get all the Segments](https://developers.brevo.com/reference/getsegments)
-
+[Get all the Segments](https://developers.brevo.com/reference/getsegments)
@@ -16449,11 +16450,8 @@ $client->whatsAppCampaigns->createWhatsAppCampaign(
-
-
-You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
-
-[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
-
+You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
@@ -16492,11 +16490,8 @@ $client->whatsAppCampaigns->getWhatsAppConfig();
-
-
-You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
-
-[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
-
+You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
@@ -16690,11 +16685,8 @@ $client->whatsAppCampaigns->getWhatsAppTemplates(
-
-
-You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
-
-[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
-
+You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+[Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
@@ -16750,11 +16742,11 @@ $client->whatsAppCampaigns->sendWhatsAppTemplateApproval(
-
-
-You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
-
-[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
-
+You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
+[Get all the Lists](https://developers.brevo.com/reference/getlists-1)
+[Get all the Segments](https://developers.brevo.com/reference/getsegments)
@@ -16810,19 +16802,11 @@ $client->whatsAppCampaigns->getWhatsAppCampaign(
-
-
-You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
-
-[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
-
-
-
-This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information.
-
+You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
[Get all the Lists](https://developers.brevo.com/reference/getlists-1)
-
-[Get all the Segments](https://developers.brevo.com/reference/getsegments)
-
+[Get all the Segments](https://developers.brevo.com/reference/getsegments)
@@ -17483,6 +17467,115 @@ $client->companies->createACompanyDealAttribute(
+
+
+
+
+$client->companies->deleteAnAttribute($id)
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```php
+$client->companies->deleteAnAttribute(
+ 'id',
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**$id:** `string` — Attribute ID
+
+
+
+
+
+
+
+
+
+
+
+$client->companies->updateAnAttribute($id, $request)
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```php
+$client->companies->updateAnAttribute(
+ 'id',
+ new PatchCrmAttributesIdRequest([]),
+);
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**$id:** `string` — Attribute ID
+
+
+
+
+
+-
+
+**$label:** `?string` — Attribute display label
+
+
+
+
+
+-
+
+**$optionsLabels:** `?array` — Updated labels for selectable options
+
+
+
+
+
+-
+
+**$objectType:** `?string` — The type of object the attribute belongs to, it cannot be updated after creation
+
+
+
+
+
+
+
@@ -19127,7 +19220,8 @@ $client->tasks->getAllTaskTypes();
-
-You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+[Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
This endpoint is used to send a WhatsApp message.
(**The first message you send using the API must contain a Template ID. You must create a template on WhatsApp on the Brevo platform to fetch the Template ID.**)
@@ -20103,13 +20197,9 @@ $client->transactionalEmails->getTransacEmailsList(
-
-
-You can get the uuid using either of the following methods:
-
+You can get the uuid using either of the following methods:
Send a GET request to https://api.brevo.com/v3/smtp/emails and pass the message_id in the url. Use your api-key to authenticate the request and you will get your uuid as a response.
-
-The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
-
+The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
@@ -21002,15 +21092,9 @@ $client->transactionalEmails->sendTestTemplate(
-
-
-If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code.
-
-Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number.
-
-
-
-Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays.
-
+If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code.
+Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number.
+Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays.
@@ -21406,3 +21490,4 @@ $client->smsTemplates->getSmsTemplates(
+
diff --git a/src/Balance/BalanceClient.php b/src/Balance/BalanceClient.php
index a27a66e6..4d7a7e7c 100644
--- a/src/Balance/BalanceClient.php
+++ b/src/Balance/BalanceClient.php
@@ -783,8 +783,8 @@ public function getTransactionHistoryApi(string $pid, GetLoyaltyBalanceProgramsP
{
$options = array_merge($this->options, $options ?? []);
$query = [];
- $query['contact_id'] = $request->contactId;
- $query['balance_definition_id'] = $request->balanceDefinitionId;
+ $query['contactId'] = $request->contactId;
+ $query['balanceDefinitionId'] = $request->balanceDefinitionId;
if ($request->limit != null) {
$query['limit'] = $request->limit;
}
@@ -792,7 +792,7 @@ public function getTransactionHistoryApi(string $pid, GetLoyaltyBalanceProgramsP
$query['offset'] = $request->offset;
}
if ($request->sortField != null) {
- $query['sort_field'] = $request->sortField;
+ $query['sortField'] = $request->sortField;
}
if ($request->sort != null) {
$query['sort'] = $request->sort;
diff --git a/src/Balance/Requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.php b/src/Balance/Requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.php
index e291f75b..a2455355 100644
--- a/src/Balance/Requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.php
+++ b/src/Balance/Requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.php
@@ -3,7 +3,6 @@
namespace Brevo\Balance\Requests;
use Brevo\Core\Json\JsonSerializableType;
-use Brevo\Balance\Types\GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField;
use Brevo\Balance\Types\GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort;
class GetLoyaltyBalanceProgramsPidTransactionHistoryRequest extends JsonSerializableType
@@ -19,7 +18,7 @@ class GetLoyaltyBalanceProgramsPidTransactionHistoryRequest extends JsonSerializ
public ?int $offset = 0;
/**
- * @var ?value-of $sortField Field to sort by
+ * @var ?'createdAt' $sortField Field to sort by
*/
public ?string $sortField;
@@ -49,7 +48,7 @@ class GetLoyaltyBalanceProgramsPidTransactionHistoryRequest extends JsonSerializ
* balanceDefinitionId: string,
* limit?: ?int,
* offset?: ?int,
- * sortField?: ?value-of,
+ * sortField?: ?'createdAt',
* sort?: ?value-of,
* filters?: ?array,
* } $values
diff --git a/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField.php b/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField.php
deleted file mode 100644
index c353b074..00000000
--- a/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSortField.php
+++ /dev/null
@@ -1,10 +0,0 @@
-,
+ * queryParameters?: array,
+ * bodyProperties?: array,
+ * } $options
+ * @throws BrevoException
+ * @throws BrevoApiException
+ */
+ public function deleteAnAttribute(string $id, ?array $options = null): void
+ {
+ $options = array_merge($this->options, $options ?? []);
+ try {
+ $response = $this->client->sendRequest(
+ new JsonApiRequest(
+ baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
+ path: "crm/attributes/{$id}",
+ method: HttpMethod::DELETE,
+ ),
+ $options,
+ );
+ $statusCode = $response->getStatusCode();
+ if ($statusCode >= 200 && $statusCode < 400) {
+ return;
+ }
+ } catch (ClientExceptionInterface $e) {
+ throw new BrevoException(message: $e->getMessage(), previous: $e);
+ }
+ throw new BrevoApiException(
+ message: 'API request failed',
+ statusCode: $statusCode,
+ body: $response->getBody()->getContents(),
+ );
+ }
+
+ /**
+ * @param string $id Attribute ID
+ * @param PatchCrmAttributesIdRequest $request
+ * @param ?array{
+ * baseUrl?: string,
+ * maxRetries?: int,
+ * timeout?: float,
+ * headers?: array,
+ * queryParameters?: array,
+ * bodyProperties?: array,
+ * } $options
+ * @throws BrevoException
+ * @throws BrevoApiException
+ */
+ public function updateAnAttribute(string $id, PatchCrmAttributesIdRequest $request = new PatchCrmAttributesIdRequest(), ?array $options = null): void
+ {
+ $options = array_merge($this->options, $options ?? []);
+ try {
+ $response = $this->client->sendRequest(
+ new JsonApiRequest(
+ baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
+ path: "crm/attributes/{$id}",
+ method: HttpMethod::PATCH,
+ body: $request,
+ ),
+ $options,
+ );
+ $statusCode = $response->getStatusCode();
+ if ($statusCode >= 200 && $statusCode < 400) {
+ return;
+ }
+ } catch (ClientExceptionInterface $e) {
+ throw new BrevoException(message: $e->getMessage(), previous: $e);
+ }
+ throw new BrevoApiException(
+ message: 'API request failed',
+ statusCode: $statusCode,
+ body: $response->getBody()->getContents(),
+ );
+ }
+
/**
* @param ?array{
* baseUrl?: string,
diff --git a/src/Companies/CompaniesClientInterface.php b/src/Companies/CompaniesClientInterface.php
index 4ecb2d76..d98f3ada 100644
--- a/src/Companies/CompaniesClientInterface.php
+++ b/src/Companies/CompaniesClientInterface.php
@@ -13,6 +13,7 @@
use Brevo\Companies\Requests\PatchCompaniesIdRequest;
use Brevo\Companies\Requests\PostCrmAttributesRequest;
use Brevo\Companies\Types\PostCrmAttributesResponse;
+use Brevo\Companies\Requests\PatchCrmAttributesIdRequest;
use Brevo\Companies\Types\GetCrmAttributesCompaniesResponseItem;
interface CompaniesClientInterface
@@ -130,6 +131,33 @@ public function updateACompany(string $id, PatchCompaniesIdRequest $request = ne
*/
public function createACompanyDealAttribute(PostCrmAttributesRequest $request, ?array $options = null): PostCrmAttributesResponse;
+ /**
+ * @param string $id Attribute ID
+ * @param ?array{
+ * baseUrl?: string,
+ * maxRetries?: int,
+ * timeout?: float,
+ * headers?: array,
+ * queryParameters?: array,
+ * bodyProperties?: array,
+ * } $options
+ */
+ public function deleteAnAttribute(string $id, ?array $options = null): void;
+
+ /**
+ * @param string $id Attribute ID
+ * @param PatchCrmAttributesIdRequest $request
+ * @param ?array{
+ * baseUrl?: string,
+ * maxRetries?: int,
+ * timeout?: float,
+ * headers?: array,
+ * queryParameters?: array,
+ * bodyProperties?: array,
+ * } $options
+ */
+ public function updateAnAttribute(string $id, PatchCrmAttributesIdRequest $request = new PatchCrmAttributesIdRequest(), ?array $options = null): void;
+
/**
* @param ?array{
* baseUrl?: string,
diff --git a/src/Companies/Requests/PatchCrmAttributesIdRequest.php b/src/Companies/Requests/PatchCrmAttributesIdRequest.php
new file mode 100644
index 00000000..8de1934d
--- /dev/null
+++ b/src/Companies/Requests/PatchCrmAttributesIdRequest.php
@@ -0,0 +1,45 @@
+ $optionsLabels Updated labels for selectable options
+ */
+ #[JsonProperty('optionsLabels'), ArrayType([PatchCrmAttributesIdRequestOptionsLabelsItem::class])]
+ public ?array $optionsLabels;
+
+ /**
+ * @var ?value-of $objectType The type of object the attribute belongs to, it cannot be updated after creation
+ */
+ #[JsonProperty('objectType')]
+ public ?string $objectType;
+
+ /**
+ * @param array{
+ * label?: ?string,
+ * optionsLabels?: ?array,
+ * objectType?: ?value-of,
+ * } $values
+ */
+ public function __construct(
+ array $values = [],
+ ) {
+ $this->label = $values['label'] ?? null;
+ $this->optionsLabels = $values['optionsLabels'] ?? null;
+ $this->objectType = $values['objectType'] ?? null;
+ }
+}
diff --git a/src/Companies/Types/PatchCrmAttributesIdRequestObjectType.php b/src/Companies/Types/PatchCrmAttributesIdRequestObjectType.php
new file mode 100644
index 00000000..facdbef0
--- /dev/null
+++ b/src/Companies/Types/PatchCrmAttributesIdRequestObjectType.php
@@ -0,0 +1,9 @@
+key = $values['key'];
+ $this->value = $values['value'];
+ }
+
+ /**
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return $this->toJson();
+ }
+}
diff --git a/src/Contacts/ContactsClient.php b/src/Contacts/ContactsClient.php
index 669e8d3c..c0a69730 100644
--- a/src/Contacts/ContactsClient.php
+++ b/src/Contacts/ContactsClient.php
@@ -92,14 +92,6 @@ public function __construct(
}
/**
- *
- * Accepted Number Formats
- *
- * 91xxxxxxxxxx
- * +91xxxxxxxxxx
- * 0091xxxxxxxxxx
- *
- *
* @param GetContactsRequest $request
* @param ?array{
* baseUrl?: string,
@@ -169,6 +161,8 @@ public function getContacts(GetContactsRequest $request = new GetContactsRequest
}
/**
+ * Follow this format when passing a "SMS" phone number as an attribute.
+ * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
* Creates new contacts on Brevo. Contacts can be created by passing either -
1. email address of the contact (email_id),
2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}
3. ext_id
*
* @param CreateContactRequest $request
@@ -462,9 +456,7 @@ public function updateBatchContacts(UpdateBatchContactsRequest $request = new Up
}
/**
- *
- * attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
- *
+ * attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
*
* @param CreateDoiContactRequest $request
* @param ?array{
@@ -552,17 +544,11 @@ public function requestContactExport(RequestContactExportRequest $request, ?arra
}
/**
- *
- * Ongoing changes for this endpoint
- *
+ * Ongoing changes for this endpoint
* We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
- *
* These are non breaking changes.
- *
* The default value for the attributes will be 0.
- *
- * The uniqueSubscribers field is deprecated
- *
+ * The uniqueSubscribers field is deprecated
*
* @param GetFoldersRequest $request
* @param ?array{
@@ -662,13 +648,9 @@ public function createFolder(CreateUpdateFolder $request, ?array $options = null
}
/**
- *
- * Ongoing changes for this endpoint.
- *
+ * Ongoing changes for this endpoint.
* We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
- *
- * These are non breaking changes. The default value for the attributes will be 0.
- *
+ * These are non breaking changes. The default value for the attributes will be 0.
*
* @param int $folderId id of the folder
* @param ?array{
@@ -793,13 +775,9 @@ public function deleteFolder(int $folderId, ?array $options = null): void
}
/**
- *
- * Ongoing changes for this endpoint.
- *
+ * Ongoing changes for this endpoint.
* We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
- *
- * These are non breaking changes. The default value for the attributes will be 0.
- *
+ * These are non breaking changes. The default value for the attributes will be 0.
*
* @param int $folderId Id of the folder
* @param GetFolderListsRequest $request
@@ -902,13 +880,9 @@ public function importContacts(ImportContactsRequest $request = new ImportContac
}
/**
- *
- * Ongoing changes for this endpoint.
- *
+ * Ongoing changes for this endpoint.
* We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
- *
- * These are non breaking changes. The default value for the attributes will be 0.
- *
+ * These are non breaking changes. The default value for the attributes will be 0.
*
* @param GetListsRequest $request
* @param ?array{
@@ -1342,14 +1316,8 @@ public function getSegments(GetSegmentsRequest $request = new GetSegmentsRequest
}
/**
- *
- * Accepted Number Formats
- *
- * 91xxxxxxxxxx
- * +91xxxxxxxxxx
- * 0091xxxxxxxxxx
- *
- *
+ * Follow this format when passing a "SMS" phone number as an attribute.
+ * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
* There are 2 ways to get a contact
Option 1- https://api.brevo.com/v3/contacts/{identifier}
Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges.
*
* @param (
@@ -1410,6 +1378,8 @@ public function getContactInfo(string|int $identifier, GetContactInfoRequest $re
}
/**
+ * Follow this format when passing a "SMS" phone number as an attribute.
+ * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
* There are 2 ways to update a contact
Option 1- https://api.brevo.com/v3/contacts/{identifier}
Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
*
* @param (
diff --git a/src/Contacts/ContactsClientInterface.php b/src/Contacts/ContactsClientInterface.php
index 882d235a..cf7a5527 100644
--- a/src/Contacts/ContactsClientInterface.php
+++ b/src/Contacts/ContactsClientInterface.php
@@ -49,14 +49,6 @@
interface ContactsClientInterface
{
/**
- *
- * Accepted Number Formats
- *
- * 91xxxxxxxxxx
- * +91xxxxxxxxxx
- * 0091xxxxxxxxxx
- *
- *
* @param GetContactsRequest $request
* @param ?array{
* baseUrl?: string,
@@ -71,6 +63,8 @@ interface ContactsClientInterface
public function getContacts(GetContactsRequest $request = new GetContactsRequest(), ?array $options = null): GetContacts;
/**
+ * Follow this format when passing a "SMS" phone number as an attribute.
+ * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
* Creates new contacts on Brevo. Contacts can be created by passing either -
1. email address of the contact (email_id),
2. phone number of the contact (to be passed as "SMS" field in "attributes" along with proper country code), For example- {"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}
3. ext_id
*
* @param CreateContactRequest $request
@@ -172,9 +166,7 @@ public function deleteMultiAttributeOptions(string $attributeType, string $multi
public function updateBatchContacts(UpdateBatchContactsRequest $request = new UpdateBatchContactsRequest(), ?array $options = null): void;
/**
- *
- * attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
- *
+ * attributes param in this endpoint is an object containing key-value pairs where values can be either a string, integer, array, or boolean. You can create key-value pairs with these four datatypes. When a value is an array, it should be an array of strings.
*
* @param CreateDoiContactRequest $request
* @param ?array{
@@ -205,17 +197,11 @@ public function createDoiContact(CreateDoiContactRequest $request, ?array $optio
public function requestContactExport(RequestContactExportRequest $request, ?array $options = null): RequestContactExportResponse;
/**
- *
- * Ongoing changes for this endpoint
- *
+ * Ongoing changes for this endpoint
* We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
- *
* These are non breaking changes.
- *
* The default value for the attributes will be 0.
- *
- * The uniqueSubscribers field is deprecated
- *
+ * The uniqueSubscribers field is deprecated
*
* @param GetFoldersRequest $request
* @param ?array{
@@ -245,13 +231,9 @@ public function getFolders(GetFoldersRequest $request = new GetFoldersRequest(),
public function createFolder(CreateUpdateFolder $request, ?array $options = null): CreateFolderResponse;
/**
- *
- * Ongoing changes for this endpoint.
- *
+ * Ongoing changes for this endpoint.
* We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
- *
- * These are non breaking changes. The default value for the attributes will be 0.
- *
+ * These are non breaking changes. The default value for the attributes will be 0.
*
* @param int $folderId id of the folder
* @param ?array{
@@ -294,13 +276,9 @@ public function updateFolder(int $folderId, UpdateFolderRequest $request, ?array
public function deleteFolder(int $folderId, ?array $options = null): void;
/**
- *
- * Ongoing changes for this endpoint.
- *
+ * Ongoing changes for this endpoint.
* We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
- *
- * These are non breaking changes. The default value for the attributes will be 0.
- *
+ * These are non breaking changes. The default value for the attributes will be 0.
*
* @param int $folderId Id of the folder
* @param GetFolderListsRequest $request
@@ -333,13 +311,9 @@ public function getFolderLists(int $folderId, GetFolderListsRequest $request = n
public function importContacts(ImportContactsRequest $request = new ImportContactsRequest(), ?array $options = null): ImportContactsResponse;
/**
- *
- * Ongoing changes for this endpoint.
- *
+ * Ongoing changes for this endpoint.
* We're dropping support for the response attributes totalSubscribers and totalBlacklisted.
- *
- * These are non breaking changes. The default value for the attributes will be 0.
- *
+ * These are non breaking changes. The default value for the attributes will be 0.
*
* @param GetListsRequest $request
* @param ?array{
@@ -470,14 +444,8 @@ public function removeContactFromList(int $listId, RemoveContactFromListRequest
public function getSegments(GetSegmentsRequest $request = new GetSegmentsRequest(), ?array $options = null): GetSegmentsResponse;
/**
- *
- * Accepted Number Formats
- *
- * 91xxxxxxxxxx
- * +91xxxxxxxxxx
- * 0091xxxxxxxxxx
- *
- *
+ * Follow this format when passing a "SMS" phone number as an attribute.
+ * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
* There are 2 ways to get a contact
Option 1- https://api.brevo.com/v3/contacts/{identifier}
Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
Option 1 only works if identifierType is email_id (for EMAIL), phone_id (for SMS) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL, SMS and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
Along with the contact details, this endpoint will show the statistics of contact for the recent 90 days by default. To fetch the earlier statistics, please use Get contact campaign stats ``https://developers.brevo.com/reference/contacts-7#getcontactstats`` endpoint with the appropriate date ranges.
*
* @param (
@@ -498,6 +466,8 @@ public function getSegments(GetSegmentsRequest $request = new GetSegmentsRequest
public function getContactInfo(string|int $identifier, GetContactInfoRequest $request = new GetContactInfoRequest(), ?array $options = null): GetContactInfoResponse;
/**
+ * Follow this format when passing a "SMS" phone number as an attribute.
+ * Accepted Number Formats 91xxxxxxxxxx +91xxxxxxxxxx 0091xxxxxxxxxx
* There are 2 ways to update a contact
Option 1- https://api.brevo.com/v3/contacts/{identifier}
Option 2- https://api.brevo.com/v3/contacts/{identifier}?identifierType={}
Option 1 only works if identifierType is email_id (for EMAIL) or contact_id (for ID of the contact),where you can directly pass the value of EMAIL and ID of the contact.
Option 2 works for all identifierType, use email_id for EMAIL attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, phone_id for SMS attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE attribute
*
* @param (
diff --git a/src/Core/Json/JsonSerializableType.php b/src/Core/Json/JsonSerializableType.php
index 607524b5..2d7e66ff 100644
--- a/src/Core/Json/JsonSerializableType.php
+++ b/src/Core/Json/JsonSerializableType.php
@@ -181,7 +181,7 @@ public static function jsonDeserialize(array $data): static
// Fill in any missing properties with defaults
foreach ($properties as $property) {
if (!isset($args[$property->getName()])) {
- $args[$property->getName()] = $property->getDefaultValue() ?? null;
+ $args[$property->getName()] = $property->hasDefaultValue() ? $property->getDefaultValue() : null;
}
}
diff --git a/src/CustomObjects/CustomObjectsClient.php b/src/CustomObjects/CustomObjectsClient.php
index 7c2edce6..7245e770 100644
--- a/src/CustomObjects/CustomObjectsClient.php
+++ b/src/CustomObjects/CustomObjectsClient.php
@@ -55,12 +55,8 @@ public function __construct(
}
/**
- *
- * Custom objects are only available to Enterprise plans.
- *
- * This feature is in beta. These are subject to change.
- *
- *
+ * Custom objects are only available to Enterprise plans.
+ * This feature is in beta. These are subject to change.
* This API allows bulk upsert of object records in a single request. Each object record may include
* - Attributes
* - Identifiers
@@ -74,8 +70,8 @@ public function __construct(
* - Max 500 attributes defined per object record upsert request
* - This is coherent with schema limitation: an object cannot have more than 500 attributes.
* - Worth noting: Nothing happens If an attribute is mentioned in the request, but was not previously defined for the object schema (no error, no attribute creation)
- * - Max 10 associations defined per object record upsert request
- * - This is coherent with schema limitation: an object cannot have more than 10 associations with other objects. and each object record can be linked to max 10 other records.
+ * - Max 10 associations defined per associated object type, in each record of the request
+ * - This is not a schema limitation. You can associate an object record to an unlimited number of other object records by running multiple requests.
* **Errors:**
* - Make sure both object records exist before associating them, else the API will return an error.
* - This route does not create objects. The object where the object records are upserted by this API must be created already else the API will return an error "invalid object type".
@@ -125,12 +121,8 @@ public function upsertrecords(string $objectType, UpsertrecordsRequest $request,
}
/**
- *
- * Custom objects are only available to Enterprise plans.
- *
- * This feature is in beta. These are subject to change.
- *
- *
+ * Custom objects are only available to Enterprise plans.
+ * This feature is in beta. These are subject to change.
* This API retrieves a list of object records along with their associated records and provides the total count of records for the specified object. **Note**: Contact as object type is not supported in this endpoint.
*
* @param string $objectType object type for the attribute
diff --git a/src/CustomObjects/CustomObjectsClientInterface.php b/src/CustomObjects/CustomObjectsClientInterface.php
index c81f8367..8af9757b 100644
--- a/src/CustomObjects/CustomObjectsClientInterface.php
+++ b/src/CustomObjects/CustomObjectsClientInterface.php
@@ -12,12 +12,8 @@
interface CustomObjectsClientInterface
{
/**
- *
- * Custom objects are only available to Enterprise plans.
- *
- * This feature is in beta. These are subject to change.
- *
- *
+ * Custom objects are only available to Enterprise plans.
+ * This feature is in beta. These are subject to change.
* This API allows bulk upsert of object records in a single request. Each object record may include
* - Attributes
* - Identifiers
@@ -31,8 +27,8 @@ interface CustomObjectsClientInterface
* - Max 500 attributes defined per object record upsert request
* - This is coherent with schema limitation: an object cannot have more than 500 attributes.
* - Worth noting: Nothing happens If an attribute is mentioned in the request, but was not previously defined for the object schema (no error, no attribute creation)
- * - Max 10 associations defined per object record upsert request
- * - This is coherent with schema limitation: an object cannot have more than 10 associations with other objects. and each object record can be linked to max 10 other records.
+ * - Max 10 associations defined per associated object type, in each record of the request
+ * - This is not a schema limitation. You can associate an object record to an unlimited number of other object records by running multiple requests.
* **Errors:**
* - Make sure both object records exist before associating them, else the API will return an error.
* - This route does not create objects. The object where the object records are upserted by this API must be created already else the API will return an error "invalid object type".
@@ -52,12 +48,8 @@ interface CustomObjectsClientInterface
public function upsertrecords(string $objectType, UpsertrecordsRequest $request, ?array $options = null): UpsertrecordsResponse;
/**
- *
- * Custom objects are only available to Enterprise plans.
- *
- * This feature is in beta. These are subject to change.
- *
- *
+ * Custom objects are only available to Enterprise plans.
+ * This feature is in beta. These are subject to change.
* This API retrieves a list of object records along with their associated records and provides the total count of records for the specified object. **Note**: Contact as object type is not supported in this endpoint.
*
* @param string $objectType object type for the attribute
diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItem.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItem.php
index fb62b110..b92810e8 100644
--- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItem.php
+++ b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItem.php
@@ -19,7 +19,7 @@ class UpsertrecordsRequestRecordsItem extends JsonSerializableType
public ?array $associations;
/**
- * @var ?array $attributes Attributes attached with the object record. Only the already created attributes will be used with records. Minimum 1 attribute is required.
+ * @var ?array $attributes Attributes attached with the object record. Only the already created attributes will be used with records. Pass the value with the attributes key you want to set or update for the object record. Minimum 1 attribute is required.
*/
#[JsonProperty('attributes'), ArrayType(['string' => 'mixed'])]
public ?array $attributes;
diff --git a/src/CustomObjects/Types/UpsertrecordsResponse.php b/src/CustomObjects/Types/UpsertrecordsResponse.php
index d5f7bd9f..df8270b8 100644
--- a/src/CustomObjects/Types/UpsertrecordsResponse.php
+++ b/src/CustomObjects/Types/UpsertrecordsResponse.php
@@ -14,7 +14,7 @@ class UpsertrecordsResponse extends JsonSerializableType
public ?string $message;
/**
- * @var ?int $processId Unique Id for the batch process used to track the status of the batch.
+ * @var ?int $processId Unique Id for the batch process used to track the status of the batch. **How to use this processId:** Refer to the [Get process status API](https://developers.brevo.com/reference/get-process) to check the execution status of this batch using the returned `processId`.
*/
#[JsonProperty('processId')]
public ?int $processId;
diff --git a/src/EmailCampaigns/EmailCampaignsClient.php b/src/EmailCampaigns/EmailCampaignsClient.php
index 26142d1b..7eb6f846 100644
--- a/src/EmailCampaigns/EmailCampaignsClient.php
+++ b/src/EmailCampaigns/EmailCampaignsClient.php
@@ -65,11 +65,8 @@ public function __construct(
}
/**
- *
- * The response payload for this endpoint has changed
- *
- * You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns).
- *
+ * The response payload for this endpoint has changed
+ * You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns).
*
* @param GetEmailCampaignsRequest $request
* @param ?array{
diff --git a/src/EmailCampaigns/EmailCampaignsClientInterface.php b/src/EmailCampaigns/EmailCampaignsClientInterface.php
index 6f9f6de0..c726a78c 100644
--- a/src/EmailCampaigns/EmailCampaignsClientInterface.php
+++ b/src/EmailCampaigns/EmailCampaignsClientInterface.php
@@ -22,11 +22,8 @@
interface EmailCampaignsClientInterface
{
/**
- *
- * The response payload for this endpoint has changed
- *
- * You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns).
- *
+ * The response payload for this endpoint has changed
+ * You now need to specify which type of statistics you would like to retrieve. For more information visit [this page](https://developers.brevo.com/changelog/get-all-marketing-campaigns).
*
* @param GetEmailCampaignsRequest $request
* @param ?array{
diff --git a/src/Program/ProgramClient.php b/src/Program/ProgramClient.php
index 21da4422..a9278953 100644
--- a/src/Program/ProgramClient.php
+++ b/src/Program/ProgramClient.php
@@ -403,6 +403,48 @@ public function getParameterSubscriptionInfo(string $pid, GetParameterSubscripti
);
}
+ /**
+ * Delete subscription for a contact
+ *
+ * @param string $pid Loyalty Program ID. A unique identifier for the loyalty program.
+ * @param int $cid Contact ID.
+ * @param ?array{
+ * baseUrl?: string,
+ * maxRetries?: int,
+ * timeout?: float,
+ * headers?: array,
+ * queryParameters?: array,
+ * bodyProperties?: array,
+ * } $options
+ * @throws BrevoException
+ * @throws BrevoApiException
+ */
+ public function deleteContactSubscription(string $pid, int $cid, ?array $options = null): void
+ {
+ $options = array_merge($this->options, $options ?? []);
+ try {
+ $response = $this->client->sendRequest(
+ new JsonApiRequest(
+ baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value,
+ path: "loyalty/config/programs/{$pid}/contact/{$cid}",
+ method: HttpMethod::DELETE,
+ ),
+ $options,
+ );
+ $statusCode = $response->getStatusCode();
+ if ($statusCode >= 200 && $statusCode < 400) {
+ return;
+ }
+ } catch (ClientExceptionInterface $e) {
+ throw new BrevoException(message: $e->getMessage(), previous: $e);
+ }
+ throw new BrevoApiException(
+ message: 'API request failed',
+ statusCode: $statusCode,
+ body: $response->getBody()->getContents(),
+ );
+ }
+
/**
* Publishes loyalty program
*
diff --git a/src/Program/ProgramClientInterface.php b/src/Program/ProgramClientInterface.php
index 260056bd..c0c9ac5c 100644
--- a/src/Program/ProgramClientInterface.php
+++ b/src/Program/ProgramClientInterface.php
@@ -132,6 +132,22 @@ public function partiallyUpdateLoyaltyProgram(string $pid, PartiallyUpdateLoyalt
*/
public function getParameterSubscriptionInfo(string $pid, GetParameterSubscriptionInfoRequest $request = new GetParameterSubscriptionInfoRequest(), ?array $options = null): GetParameterSubscriptionInfoResponse;
+ /**
+ * Delete subscription for a contact
+ *
+ * @param string $pid Loyalty Program ID. A unique identifier for the loyalty program.
+ * @param int $cid Contact ID.
+ * @param ?array{
+ * baseUrl?: string,
+ * maxRetries?: int,
+ * timeout?: float,
+ * headers?: array,
+ * queryParameters?: array,
+ * bodyProperties?: array,
+ * } $options
+ */
+ public function deleteContactSubscription(string $pid, int $cid, ?array $options = null): void;
+
/**
* Publishes loyalty program
*
diff --git a/src/TransactionalEmails/TransactionalEmailsClient.php b/src/TransactionalEmails/TransactionalEmailsClient.php
index 79f60812..dd36aef0 100644
--- a/src/TransactionalEmails/TransactionalEmailsClient.php
+++ b/src/TransactionalEmails/TransactionalEmailsClient.php
@@ -575,13 +575,9 @@ public function getTransacEmailsList(GetTransacEmailsListRequest $request = new
}
/**
- *
- * You can get the uuid using either of the following methods:
- *
+ * You can get the uuid using either of the following methods:
* Send a GET request to https://api.brevo.com/v3/smtp/emails and pass the message_id in the url. Use your api-key to authenticate the request and you will get your uuid as a response.
- *
- * The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
- *
+ * The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
*
* @param string $uuid Unique id of the transactional email that has been sent to a particular contact
* @param ?array{
diff --git a/src/TransactionalEmails/TransactionalEmailsClientInterface.php b/src/TransactionalEmails/TransactionalEmailsClientInterface.php
index d416bd2d..61a08f71 100644
--- a/src/TransactionalEmails/TransactionalEmailsClientInterface.php
+++ b/src/TransactionalEmails/TransactionalEmailsClientInterface.php
@@ -185,13 +185,9 @@ public function getScheduledEmailById(string $identifier, GetScheduledEmailByIdR
public function getTransacEmailsList(GetTransacEmailsListRequest $request = new GetTransacEmailsListRequest(), ?array $options = null): GetTransacEmailsListResponse;
/**
- *
- * You can get the uuid using either of the following methods:
- *
+ * You can get the uuid using either of the following methods:
* Send a GET request to https://api.brevo.com/v3/smtp/emails and pass the message_id in the url. Use your api-key to authenticate the request and you will get your uuid as a response.
- *
- * The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
- *
+ * The uuid can also be fetched from the transactional logs page in your Brevo account, from the address URL.
*
* @param string $uuid Unique id of the transactional email that has been sent to a particular contact
* @param ?array{
diff --git a/src/TransactionalSms/TransactionalSmsClient.php b/src/TransactionalSms/TransactionalSmsClient.php
index 1c047745..d8e23262 100644
--- a/src/TransactionalSms/TransactionalSmsClient.php
+++ b/src/TransactionalSms/TransactionalSmsClient.php
@@ -58,15 +58,9 @@ public function __construct(
}
/**
- *
- * If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code.
- *
- * Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number.
- *
- *
- *
- * Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays.
- *
+ * If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code.
+ * Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number.
+ * Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays.
*
* @param SendTransacSms $request
* @param ?array{
diff --git a/src/TransactionalSms/TransactionalSmsClientInterface.php b/src/TransactionalSms/TransactionalSmsClientInterface.php
index 75115e39..5f1d47f8 100644
--- a/src/TransactionalSms/TransactionalSmsClientInterface.php
+++ b/src/TransactionalSms/TransactionalSmsClientInterface.php
@@ -15,15 +15,9 @@
interface TransactionalSmsClientInterface
{
/**
- *
- * If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code.
- *
- * Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number.
- *
- *
- *
- * Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays.
- *
+ * If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code.
+ * Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number.
+ * Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays.
*
* @param SendTransacSms $request
* @param ?array{
diff --git a/src/TransactionalWhatsApp/TransactionalWhatsAppClient.php b/src/TransactionalWhatsApp/TransactionalWhatsAppClient.php
index 6795c41c..4dae6e12 100644
--- a/src/TransactionalWhatsApp/TransactionalWhatsAppClient.php
+++ b/src/TransactionalWhatsApp/TransactionalWhatsAppClient.php
@@ -56,7 +56,8 @@ public function __construct(
}
/**
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
* This endpoint is used to send a WhatsApp message.
(**The first message you send using the API must contain a Template ID. You must create a template on WhatsApp on the Brevo platform to fetch the Template ID.**)
*
* @param (
diff --git a/src/TransactionalWhatsApp/TransactionalWhatsAppClientInterface.php b/src/TransactionalWhatsApp/TransactionalWhatsAppClientInterface.php
index 4ba8fe48..99213de4 100644
--- a/src/TransactionalWhatsApp/TransactionalWhatsAppClientInterface.php
+++ b/src/TransactionalWhatsApp/TransactionalWhatsAppClientInterface.php
@@ -11,7 +11,8 @@
interface TransactionalWhatsAppClientInterface
{
/**
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below. [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
* This endpoint is used to send a WhatsApp message.
(**The first message you send using the API must contain a Template ID. You must create a template on WhatsApp on the Brevo platform to fetch the Template ID.**)
*
* @param (
diff --git a/src/Types/Order.php b/src/Types/Order.php
index 44acc680..07d8f265 100644
--- a/src/Types/Order.php
+++ b/src/Types/Order.php
@@ -56,9 +56,12 @@ class Order extends JsonSerializableType
public ?array $metaInfo;
/**
- * @var array $products
+ * @var array<(
+ * OrderProductsItemQuantity
+ * |OrderProductsItemQuantityFloat
+ * )> $products
*/
- #[JsonProperty('products'), ArrayType([OrderProductsItem::class])]
+ #[JsonProperty('products'), ArrayType([new Union(OrderProductsItemQuantity::class, OrderProductsItemQuantityFloat::class)])]
public array $products;
/**
@@ -84,7 +87,10 @@ class Order extends JsonSerializableType
* amount: float,
* createdAt: string,
* id: string,
- * products: array,
+ * products: array<(
+ * OrderProductsItemQuantity
+ * |OrderProductsItemQuantityFloat
+ * )>,
* status: string,
* updatedAt: string,
* billing?: ?OrderBilling,
diff --git a/src/Types/OrderProductsItem.php b/src/Types/OrderProductsItem.php
deleted file mode 100644
index 7fd08e23..00000000
--- a/src/Types/OrderProductsItem.php
+++ /dev/null
@@ -1,61 +0,0 @@
-price = $values['price'];
- $this->productId = $values['productId'];
- $this->quantity = $values['quantity'];
- $this->variantId = $values['variantId'] ?? null;
- }
-
- /**
- * @return string
- */
- public function __toString(): string
- {
- return $this->toJson();
- }
-}
diff --git a/src/Types/OrderProductsItemQuantity.php b/src/Types/OrderProductsItemQuantity.php
new file mode 100644
index 00000000..69e25320
--- /dev/null
+++ b/src/Types/OrderProductsItemQuantity.php
@@ -0,0 +1,34 @@
+quantity = $values['quantity'];
+ }
+
+ /**
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return $this->toJson();
+ }
+}
diff --git a/src/Types/OrderProductsItemQuantityFloat.php b/src/Types/OrderProductsItemQuantityFloat.php
new file mode 100644
index 00000000..545aeeae
--- /dev/null
+++ b/src/Types/OrderProductsItemQuantityFloat.php
@@ -0,0 +1,34 @@
+quantityFloat = $values['quantityFloat'];
+ }
+
+ /**
+ * @return string
+ */
+ public function __toString(): string
+ {
+ return $this->toJson();
+ }
+}
diff --git a/src/Webhooks/Requests/UpdateWebhookRequest.php b/src/Webhooks/Requests/UpdateWebhookRequest.php
index cb9d11b1..47fc022e 100644
--- a/src/Webhooks/Requests/UpdateWebhookRequest.php
+++ b/src/Webhooks/Requests/UpdateWebhookRequest.php
@@ -44,6 +44,7 @@ class UpdateWebhookRequest extends JsonSerializableType
* #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`,
* `unsubscribed`, `listAddition` & `delivered` - Possible values
* for **Inbound** type webhook: #### `inboundEmailProcessed`
+ * #### `reply`
*
* @var ?array> $events
*/
diff --git a/src/Webhooks/Types/CreateWebhookRequestEventsItem.php b/src/Webhooks/Types/CreateWebhookRequestEventsItem.php
index 0c31dd35..60f392d0 100644
--- a/src/Webhooks/Types/CreateWebhookRequestEventsItem.php
+++ b/src/Webhooks/Types/CreateWebhookRequestEventsItem.php
@@ -21,4 +21,5 @@ enum CreateWebhookRequestEventsItem: string
case ContactUpdated = "contactUpdated";
case ContactDeleted = "contactDeleted";
case InboundEmailProcessed = "inboundEmailProcessed";
+ case Reply = "reply";
}
diff --git a/src/Webhooks/Types/UpdateWebhookRequestEventsItem.php b/src/Webhooks/Types/UpdateWebhookRequestEventsItem.php
index c7aaccc8..a6eb51ed 100644
--- a/src/Webhooks/Types/UpdateWebhookRequestEventsItem.php
+++ b/src/Webhooks/Types/UpdateWebhookRequestEventsItem.php
@@ -21,4 +21,5 @@ enum UpdateWebhookRequestEventsItem: string
case ContactUpdated = "contactUpdated";
case ContactDeleted = "contactDeleted";
case InboundEmailProcessed = "inboundEmailProcessed";
+ case Reply = "reply";
}
diff --git a/src/Webhooks/WebhooksClient.php b/src/Webhooks/WebhooksClient.php
index 24fd9353..d0d3e9b6 100644
--- a/src/Webhooks/WebhooksClient.php
+++ b/src/Webhooks/WebhooksClient.php
@@ -181,9 +181,9 @@ public function createWebhook(CreateWebhookRequest $request, ?array $options = n
}
/**
- *
- * To have it activated please send us a request and we will activate it for your account.
- *
+ * This is an enterprise feature.
+ *
+ * To have it activated please send us a request and we will activate it for your account.
*
* Exports webhook event history to CSV format for analysis and reporting.
*
diff --git a/src/Webhooks/WebhooksClientInterface.php b/src/Webhooks/WebhooksClientInterface.php
index dce226ee..a0cc596d 100644
--- a/src/Webhooks/WebhooksClientInterface.php
+++ b/src/Webhooks/WebhooksClientInterface.php
@@ -71,9 +71,9 @@ public function getWebhooks(GetWebhooksRequest $request = new GetWebhooksRequest
public function createWebhook(CreateWebhookRequest $request, ?array $options = null): CreateWebhookResponse;
/**
- *
- * To have it activated please send us a request and we will activate it for your account.
- *
+ * This is an enterprise feature.
+ *
+ * To have it activated please send us a request and we will activate it for your account.
*
* Exports webhook event history to CSV format for analysis and reporting.
*
diff --git a/src/WhatsAppCampaigns/WhatsAppCampaignsClient.php b/src/WhatsAppCampaigns/WhatsAppCampaignsClient.php
index 6e65ae5d..0d2c8df3 100644
--- a/src/WhatsAppCampaigns/WhatsAppCampaignsClient.php
+++ b/src/WhatsAppCampaigns/WhatsAppCampaignsClient.php
@@ -120,19 +120,11 @@ public function getWhatsAppCampaigns(GetWhatsAppCampaignsRequest $request = new
}
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
- *
- *
- * This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information.
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+ * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
* [Get all the Lists](https://developers.brevo.com/reference/getlists-1)
- *
- * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
- *
+ * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
*
* @param CreateWhatsAppCampaignRequest $request
* @param ?array{
@@ -178,11 +170,8 @@ public function createWhatsAppCampaign(CreateWhatsAppCampaignRequest $request, ?
}
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
*
* @param ?array{
* baseUrl?: string,
@@ -226,11 +215,8 @@ public function getWhatsAppConfig(?array $options = null): GetWhatsAppConfigResp
}
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
*
* @param CreateWhatsAppTemplateRequest $request
* @param ?array{
@@ -339,11 +325,8 @@ public function getWhatsAppTemplates(GetWhatsAppTemplatesRequest $request = new
}
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
*
* @param int $templateId id of the template
* @param ?array{
@@ -384,11 +367,11 @@ public function sendWhatsAppTemplateApproval(int $templateId, ?array $options =
}
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+ * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
+ * [Get all the Lists](https://developers.brevo.com/reference/getlists-1)
+ * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
*
* @param int $campaignId Id of the campaign
* @param ?array{
@@ -433,19 +416,11 @@ public function getWhatsAppCampaign(int $campaignId, ?array $options = null): Ge
}
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
- *
- *
- * This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information.
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+ * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
* [Get all the Lists](https://developers.brevo.com/reference/getlists-1)
- *
- * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
- *
+ * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
*
* @param int $campaignId id of the campaign
* @param UpdateWhatsAppCampaignRequest $request
diff --git a/src/WhatsAppCampaigns/WhatsAppCampaignsClientInterface.php b/src/WhatsAppCampaigns/WhatsAppCampaignsClientInterface.php
index 204d09b2..4db7e05c 100644
--- a/src/WhatsAppCampaigns/WhatsAppCampaignsClientInterface.php
+++ b/src/WhatsAppCampaigns/WhatsAppCampaignsClientInterface.php
@@ -31,19 +31,11 @@ interface WhatsAppCampaignsClientInterface
public function getWhatsAppCampaigns(GetWhatsAppCampaignsRequest $request = new GetWhatsAppCampaignsRequest(), ?array $options = null): GetWhatsAppCampaignsResponse;
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
- *
- *
- * This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information.
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+ * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
* [Get all the Lists](https://developers.brevo.com/reference/getlists-1)
- *
- * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
- *
+ * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
*
* @param CreateWhatsAppCampaignRequest $request
* @param ?array{
@@ -59,11 +51,8 @@ public function getWhatsAppCampaigns(GetWhatsAppCampaignsRequest $request = new
public function createWhatsAppCampaign(CreateWhatsAppCampaignRequest $request, ?array $options = null): CreateWhatsAppCampaignResponse;
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
*
* @param ?array{
* baseUrl?: string,
@@ -78,11 +67,8 @@ public function createWhatsAppCampaign(CreateWhatsAppCampaignRequest $request, ?
public function getWhatsAppConfig(?array $options = null): GetWhatsAppConfigResponse;
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
*
* @param CreateWhatsAppTemplateRequest $request
* @param ?array{
@@ -112,11 +98,8 @@ public function createWhatsAppTemplate(CreateWhatsAppTemplateRequest $request, ?
public function getWhatsAppTemplates(GetWhatsAppTemplatesRequest $request = new GetWhatsAppTemplatesRequest(), ?array $options = null): GetWhatsAppTemplatesResponse;
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating WhatsApp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
*
* @param int $templateId id of the template
* @param ?array{
@@ -131,11 +114,11 @@ public function getWhatsAppTemplates(GetWhatsAppTemplatesRequest $request = new
public function sendWhatsAppTemplateApproval(int $templateId, ?array $options = null): void;
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+ * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
+ * [Get all the Lists](https://developers.brevo.com/reference/getlists-1)
+ * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
*
* @param int $campaignId Id of the campaign
* @param ?array{
@@ -151,19 +134,11 @@ public function sendWhatsAppTemplateApproval(int $templateId, ?array $options =
public function getWhatsAppCampaign(int $campaignId, ?array $options = null): GetWhatsAppCampaignResponse;
/**
- *
- * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
- *
- * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
- *
- *
- *
- * This API requires the List and Segment ids as recipients in Body params. You can use the below Contact endpoints to get the required information.
- *
+ * You can use this API for WhatsApp only if you have setup your WhatsApp account on Brevo platform. To setup your WhatsApp account, follow the steps in the guide below.
+ * [Activating Whatsapp](https://developers.brevo.com/docs/whatsapp-campaigns-1) in your account
+ * This API requires the List and Segment ids as recipients in Body params.You can use the below Contact endpoints to get the required information.
* [Get all the Lists](https://developers.brevo.com/reference/getlists-1)
- *
- * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
- *
+ * [Get all the Segments](https://developers.brevo.com/reference/getsegments)
*
* @param int $campaignId id of the campaign
* @param UpdateWhatsAppCampaignRequest $request
diff --git a/tests/Wire/BalanceWireTest.php b/tests/Wire/BalanceWireTest.php
index 9b6612b9..9ea2bb86 100644
--- a/tests/Wire/BalanceWireTest.php
+++ b/tests/Wire/BalanceWireTest.php
@@ -385,7 +385,7 @@ public function testGetTransactionHistoryApi(): void {
'pid',
new GetLoyaltyBalanceProgramsPidTransactionHistoryRequest([
'contactId' => 1,
- 'balanceDefinitionId' => 'balance_definition_id',
+ 'balanceDefinitionId' => 'balanceDefinitionId',
]),
[
'headers' => [
@@ -397,7 +397,7 @@ public function testGetTransactionHistoryApi(): void {
$testId,
"GET",
"/loyalty/balance/programs/pid/transaction-history",
- ['contact_id' => '1', 'balance_definition_id' => 'balance_definition_id'],
+ ['contactId' => '1', 'balanceDefinitionId' => 'balanceDefinitionId'],
1
);
}
diff --git a/tests/Wire/CompaniesWireTest.php b/tests/Wire/CompaniesWireTest.php
index f618001a..c40043da 100644
--- a/tests/Wire/CompaniesWireTest.php
+++ b/tests/Wire/CompaniesWireTest.php
@@ -13,6 +13,7 @@
use Brevo\Companies\Requests\PostCrmAttributesRequest;
use Brevo\Companies\Types\PostCrmAttributesRequestAttributeType;
use Brevo\Companies\Types\PostCrmAttributesRequestObjectType;
+use Brevo\Companies\Requests\PatchCrmAttributesIdRequest;
class CompaniesWireTest extends WireMockTestCase
{
@@ -199,6 +200,49 @@ public function testCreateACompanyDealAttribute(): void {
);
}
+ /**
+ */
+ public function testDeleteAnAttribute(): void {
+ $testId = 'companies.delete_an_attribute.0';
+ $this->client->companies->deleteAnAttribute(
+ 'id',
+ [
+ 'headers' => [
+ 'X-Test-Id' => 'companies.delete_an_attribute.0',
+ ],
+ ],
+ );
+ $this->verifyRequestCount(
+ $testId,
+ "DELETE",
+ "/crm/attributes/id",
+ null,
+ 1
+ );
+ }
+
+ /**
+ */
+ public function testUpdateAnAttribute(): void {
+ $testId = 'companies.update_an_attribute.0';
+ $this->client->companies->updateAnAttribute(
+ 'id',
+ new PatchCrmAttributesIdRequest([]),
+ [
+ 'headers' => [
+ 'X-Test-Id' => 'companies.update_an_attribute.0',
+ ],
+ ],
+ );
+ $this->verifyRequestCount(
+ $testId,
+ "PATCH",
+ "/crm/attributes/id",
+ null,
+ 1
+ );
+ }
+
/**
*/
public function testGetCompanyAttributes(): void {
diff --git a/tests/Wire/EcommerceWireTest.php b/tests/Wire/EcommerceWireTest.php
index d0ddad9f..2ec51357 100644
--- a/tests/Wire/EcommerceWireTest.php
+++ b/tests/Wire/EcommerceWireTest.php
@@ -15,7 +15,7 @@
use Brevo\Ecommerce\Requests\SetConfigDisplayCurrencyRequest;
use Brevo\Ecommerce\Requests\GetOrdersRequest;
use Brevo\Types\Order;
-use Brevo\Types\OrderProductsItem;
+use Brevo\Types\OrderProductsItemQuantity;
use Brevo\Ecommerce\Requests\CreateBatchOrderRequest;
use Brevo\Ecommerce\Requests\GetProductsRequest;
use Brevo\Ecommerce\Requests\CreateUpdateProductRequest;
@@ -284,9 +284,7 @@ public function testCreateOrder(): void {
'createdAt' => '2021-07-29T20:59:23.383Z',
'id' => '14',
'products' => [
- new OrderProductsItem([
- 'price' => 99.99,
- 'productId' => 'P1',
+ new OrderProductsItemQuantity([
'quantity' => 10,
]),
],
@@ -320,9 +318,7 @@ public function testCreateBatchOrder(): void {
'createdAt' => '2021-07-29T20:59:23.383Z',
'id' => '14',
'products' => [
- new OrderProductsItem([
- 'price' => 99.99,
- 'productId' => 'P1',
+ new OrderProductsItemQuantity([
'quantity' => 10,
]),
],
diff --git a/tests/Wire/ProgramWireTest.php b/tests/Wire/ProgramWireTest.php
index 7fa97bc6..b190b1f0 100644
--- a/tests/Wire/ProgramWireTest.php
+++ b/tests/Wire/ProgramWireTest.php
@@ -174,6 +174,28 @@ public function testGetParameterSubscriptionInfo(): void {
);
}
+ /**
+ */
+ public function testDeleteContactSubscription(): void {
+ $testId = 'program.delete_contact_subscription.0';
+ $this->client->program->deleteContactSubscription(
+ 'pid',
+ 1,
+ [
+ 'headers' => [
+ 'X-Test-Id' => 'program.delete_contact_subscription.0',
+ ],
+ ],
+ );
+ $this->verifyRequestCount(
+ $testId,
+ "DELETE",
+ "/loyalty/config/programs/pid/contact/1",
+ null,
+ 1
+ );
+ }
+
/**
*/
public function testPublishLoyaltyProgram(): void {
diff --git a/wiremock/wiremock-mappings.json b/wiremock/wiremock-mappings.json
index 6cc5c05c..6a232584 100644
--- a/wiremock/wiremock-mappings.json
+++ b/wiremock/wiremock-mappings.json
@@ -1435,8 +1435,8 @@
}
},
{
- "id": "747584ac-68ed-4ed6-a905-9c093c09d9f6",
- "name": "Export weekly events - default",
+ "id": "0bf6e8dd-41ac-4605-b444-f39fff877649",
+ "name": "This endpoint will submit a request to get the history of webhooks in the\nCSV file. The link to download the CSV file will be sent to the webhook that\nwas provided in the notifyURL. - default",
"request": {
"urlPathTemplate": "/webhooks/export",
"method": "POST"
@@ -1448,7 +1448,7 @@
"Content-Type": "application/json"
}
},
- "uuid": "747584ac-68ed-4ed6-a905-9c093c09d9f6",
+ "uuid": "0bf6e8dd-41ac-4605-b444-f39fff877649",
"persistent": true,
"priority": 3,
"metadata": {
@@ -3265,7 +3265,7 @@
},
"response": {
"status": 200,
- "body": "{\n \"count\": 1,\n \"orders\": [\n {\n \"amount\": 2000,\n \"billing\": {\n \"address\": \"Sec 62, Noida\",\n \"city\": \"Noida\",\n \"country\": \"India\",\n \"countryCode\": \"IN\",\n \"paymentMethod\": \"Net banking\",\n \"phone\": 9238283982,\n \"postCode\": 110001,\n \"region\": \"North India\"\n },\n \"contact_id\": 2,\n \"coupons\": [\n \"flat50\",\n \"flat40\"\n ],\n \"createdAt\": \"2021-12-31T11:42:35.638Z\",\n \"email\": \"testvisitor@sendinblue.com\",\n \"id\": \"order1803\",\n \"identifiers\": {\n \"ext_id\": \"ab12\",\n \"loyalty_subscription_id\": \"1234\"\n },\n \"products\": [\n {\n \"price\": 100,\n \"productId\": 21,\n \"quantity\": 2,\n \"variantId\": \"P100\"\n },\n {\n \"price\": 100,\n \"productId\": 21,\n \"quantity\": 2,\n \"variantId\": \"P15756\"\n }\n ],\n \"status\": \"complete\",\n \"storeId\": \"123\",\n \"updatedAt\": \"2022-03-03T14:48:31.867Z\"\n }\n ]\n}",
+ "body": "{\n \"count\": 1,\n \"orders\": [\n {\n \"amount\": 2000,\n \"billing\": {\n \"address\": \"Sec 62, Noida\",\n \"city\": \"Noida\",\n \"country\": \"India\",\n \"countryCode\": \"IN\",\n \"paymentMethod\": \"Net banking\",\n \"phone\": 9238283982,\n \"postCode\": 110001,\n \"region\": \"North India\"\n },\n \"contact_id\": 2,\n \"coupons\": [\n \"flat50\",\n \"flat40\"\n ],\n \"createdAt\": \"2021-12-31T11:42:35.638Z\",\n \"email\": \"testvisitor@sendinblue.com\",\n \"id\": \"order1803\",\n \"identifiers\": {\n \"ext_id\": \"ab12\",\n \"loyalty_subscription_id\": \"1234\"\n },\n \"products\": [\n {\n \"price\": 100,\n \"productId\": 21,\n \"quantity\": 2,\n \"quantityFloat\": 0,\n \"variantId\": \"P100\"\n },\n {\n \"price\": 100,\n \"productId\": 21,\n \"quantity\": 0,\n \"quantityFloat\": 2.52,\n \"variantId\": \"P15756\"\n }\n ],\n \"status\": \"complete\",\n \"storeId\": \"123\",\n \"updatedAt\": \"2022-03-03T14:48:31.867Z\"\n }\n ]\n}",
"headers": {
"Content-Type": "application/json"
}
@@ -4631,6 +4631,40 @@
}
}
},
+ {
+ "id": "0878ece4-9fe9-491a-9a7c-daaf7cf9c341",
+ "name": "Delete subscription - default",
+ "request": {
+ "urlPathTemplate": "/loyalty/config/programs/{pid}/contact/{cid}",
+ "method": "DELETE",
+ "pathParameters": {
+ "pid": {
+ "equalTo": "pid"
+ },
+ "cid": {
+ "equalTo": "1"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "body": "\"\"",
+ "headers": {
+ "Content-Type": "application/json"
+ }
+ },
+ "uuid": "0878ece4-9fe9-491a-9a7c-daaf7cf9c341",
+ "persistent": true,
+ "priority": 3,
+ "metadata": {
+ "mocklab": {
+ "created": {
+ "at": "2020-01-01T00:00:00.000Z",
+ "via": "SYSTEM"
+ }
+ }
+ }
+ },
{
"id": "e628ecea-6ac2-4237-bf4e-d3e911f50954",
"name": "Publish loyalty program - default",
@@ -6584,6 +6618,68 @@
}
}
},
+ {
+ "id": "360c88d6-c7bb-4c00-b1ab-146f803e9eff",
+ "name": "Delete an attribute - default",
+ "request": {
+ "urlPathTemplate": "/crm/attributes/{id}",
+ "method": "DELETE",
+ "pathParameters": {
+ "id": {
+ "equalTo": "id"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "body": "\"\"",
+ "headers": {
+ "Content-Type": "application/json"
+ }
+ },
+ "uuid": "360c88d6-c7bb-4c00-b1ab-146f803e9eff",
+ "persistent": true,
+ "priority": 3,
+ "metadata": {
+ "mocklab": {
+ "created": {
+ "at": "2020-01-01T00:00:00.000Z",
+ "via": "SYSTEM"
+ }
+ }
+ }
+ },
+ {
+ "id": "a9790cec-51da-4b91-ae52-a3b58fa8c717",
+ "name": "Update an attribute - default",
+ "request": {
+ "urlPathTemplate": "/crm/attributes/{id}",
+ "method": "PATCH",
+ "pathParameters": {
+ "id": {
+ "equalTo": "id"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "body": "\"\"",
+ "headers": {
+ "Content-Type": "application/json"
+ }
+ },
+ "uuid": "a9790cec-51da-4b91-ae52-a3b58fa8c717",
+ "persistent": true,
+ "priority": 3,
+ "metadata": {
+ "mocklab": {
+ "created": {
+ "at": "2020-01-01T00:00:00.000Z",
+ "via": "SYSTEM"
+ }
+ }
+ }
+ },
{
"id": "696b098d-c426-490d-993d-82b72a9a6eec",
"name": "Get company attributes - default",
@@ -8235,6 +8331,6 @@
}
],
"meta": {
- "total": 279
+ "total": 282
}
}
\ No newline at end of file