diff --git a/.fern/metadata.json b/.fern/metadata.json index c5e2fa96..e208f460 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "4.65.2", + "cliVersion": "4.103.1", "generatorName": "fernapi/fern-php-sdk", - "generatorVersion": "2.4.0", + "generatorVersion": "2.9.5", "generatorConfig": { "clientName": "Brevo", "namespace": "Brevo", @@ -20,6 +20,10 @@ "generateClientInterfaces": true, "useDefaultRequestParameterValues": true }, - "originGitCommit": "d2e18d0bd27160206c8251e11269b139a3b4ea10", - "sdkVersion": "4.0.13" + "originGitCommit": "1934b60b480a426232f9443e7831353a6f965651", + "originGitCommitIsDirty": true, + "invokedBy": "manual", + "requestedVersion": "5.0.0", + "ciProvider": null, + "sdkVersion": "5.0.0" } \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 678eb6c9..ac6fa0af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.1" + php-version: "8.3" - name: Install tools run: | @@ -41,7 +41,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.1" + php-version: "8.3" - name: Install tools run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..0c772cdc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,120 @@ +# Contributing + +Thanks for your interest in contributing to this SDK! This document provides guidelines for contributing to the project. + +## Getting Started + +### Prerequisites + +- PHP 8.1+ +- Composer + +### Installation + +Install the project dependencies: + +```bash +composer install +``` + +### Testing + +Run the test suite: + +```bash +composer test +``` + +Or run PHPUnit directly: + +```bash +./vendor/bin/phpunit +``` + +### Linting & Formatting + +Fix code style issues: + +```bash +./vendor/bin/php-cs-fixer fix +``` + +### Static Analysis + +Run static analysis: + +```bash +./vendor/bin/phpstan analyse +``` + +## About Generated Code + +**Important**: Most files in this SDK are automatically generated by [Fern](https://buildwithfern.com) from the API definition. Direct modifications to generated files will be overwritten the next time the SDK is generated. + +### Generated Files + +The following directories contain generated code: +- `src/` - API client classes and types +- Most PHP files in the project + +### How to Customize + +If you need to customize the SDK, you have two options: + +#### Option 1: Use `.fernignore` + +For custom code that should persist across SDK regenerations: + +1. Create a `.fernignore` file in the project root +2. Add file patterns for files you want to preserve (similar to `.gitignore` syntax) +3. Add your custom code to those files + +Files listed in `.fernignore` will not be overwritten when the SDK is regenerated. + +For more information, see the [Fern documentation on custom code](https://buildwithfern.com/learn/sdks/overview/custom-code). + +#### Option 2: Contribute to the Generator + +If you want to change how code is generated for all users of this SDK: + +1. The PHP SDK generator lives in the [Fern repository](https://github.com/fern-api/fern) +2. Generator code is located at `generators/php/` +3. Follow the [Fern contributing guidelines](https://github.com/fern-api/fern/blob/main/CONTRIBUTING.md) +4. Submit a pull request with your changes to the generator + +This approach is best for: +- Bug fixes in generated code +- New features that would benefit all users +- Improvements to code generation patterns + +## Making Changes + +### Workflow + +1. Create a new branch for your changes +2. Make your modifications +3. Run tests to ensure nothing breaks: `composer test` +4. Run formatting: `./vendor/bin/php-cs-fixer fix` +5. Run static analysis: `./vendor/bin/phpstan analyse` +6. Commit your changes with a clear commit message +7. Push your branch and create a pull request + +### Commit Messages + +Write clear, descriptive commit messages that explain what changed and why. + +### Code Style + +This project uses PHP CS Fixer for automated code formatting. Run `./vendor/bin/php-cs-fixer fix` before committing to ensure your code meets the project's style guidelines. + +## Questions or Issues? + +If you have questions or run into issues: + +1. Check the [Fern documentation](https://buildwithfern.com) +2. Search existing [GitHub issues](https://github.com/fern-api/fern/issues) +3. Open a new issue if your question hasn't been addressed + +## License + +By contributing to this project, you agree that your contributions will be licensed under the same license as the project. diff --git a/composer.json b/composer.json index 653e6122..4ecf2141 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "getbrevo/brevo-php", - "version": "4.0.13", + "version": "5.0.0", "description": "Official PHP SDK for the Brevo API.", "keywords": [ "brevo", @@ -20,7 +20,7 @@ "php-http/multipart-stream-builder": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^9.0", + "phpunit/phpunit": "^12.5.22", "friendsofphp/php-cs-fixer": "3.5.0", "phpstan/phpstan": "^1.12", "guzzlehttp/guzzle": "^7.4" diff --git a/reference.md b/reference.md index 9b942c0f..8e7da029 100644 --- a/reference.md +++ b/reference.md @@ -19,25 +19,22 @@ Retrieves details of your Brevo account. - Check plan details (type, credits, expiration) - Get relay information (for transactional emails) - Check Marketing Automation status -- View date/time preferences and account settings - Access organization and user identifiers **Key information returned:** - Complete account details (organization ID, user ID, company information) - Address and contact information - Plan configurations and credit allocations across different verticals -- Marketing Automation settings and tracker key +- Marketing Automation settings and tracker key (when enabled) - SMTP relay configuration for transactional emails -- Date/time preferences and account settings - Enterprise features availability status **Important considerations:** - Provides comprehensive account overview for billing and configuration management - Essential for understanding current plan limitations and feature availability -- Marketing Automation key required for advanced automation features -- Plan verticals show detailed breakdown across Marketing, Chat, and CRM categories +- Marketing Automation key is only returned when Marketing Automation is enabled on the account +- Plan verticals show detailed breakdown across Marketing, Chat, and CRM categories (only returned when plan verticals are available) - Relay configuration crucial for transactional email setup and deliverability -- Date/time preferences affect campaign scheduling and reporting displays - Enterprise status determines access to advanced features and sub-account management @@ -1305,6 +1302,20 @@ $client->masterAccount->getSubAccountDetails(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently deletes a sub-account from the corporate master account. Once deleted, all data associated with the sub-account organization is removed and cannot be recovered, so ensure the sub-account is no longer needed before proceeding. +
+
+
+
+ #### πŸ”Œ Usage
@@ -2156,6 +2167,20 @@ $client->masterAccount->changeAdminUserPermissions(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieves the list of all users associated with your organization, including both active and pending invited users. Each user entry includes their email address, owner status, current invitation status, and feature access levels for marketing, CRM, and conversations. +
+
+
+
+ #### πŸ”Œ Usage
@@ -2181,6 +2206,20 @@ $client->user->getInvitedUsersList();
+#### πŸ“ Description + +
+
+ +
+
+ +Revokes all permissions for an invited user in the organization, effectively removing their access to the platform. If the user''s plan change generated credit notes, they are returned in the response for billing reconciliation. +
+
+
+
+ #### πŸ”Œ Usage
@@ -2352,6 +2391,20 @@ $client->user->inviteuser(
+#### πŸ“ Description + +
+
+ +
+
+ +Resends or cancels a pending invitation for a user in the organization, depending on the action path parameter. Use `resend` to send a new invitation email to the user, or `cancel` to revoke the pending invitation entirely and remove the user''s pending access. +
+
+
+
+ #### πŸ”Œ Usage
@@ -2531,6 +2584,20 @@ $client->user->editUserPermission(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieves the granular feature-level permissions assigned to a specific user in the organization, identified by their email address. The response includes the user''s current status (active or pending) and a detailed list of privileges specifying which features and permission levels are granted. +
+
+
+
+ #### πŸ”Œ Usage
@@ -2592,20 +2659,19 @@ Retrieves a list of background processes from your Brevo account with filtering - Identify failed or stuck processes for troubleshooting **Key information returned:** -- Process details (ID, name, type, status) -- Process creation and completion timestamps -- Process progress and completion status -- Error information for failed processes -- Process result data and download links +- Process details (ID, name, status) +- Export download URLs for completed export processes +- Import details with CSV report URLs for completed import processes +- Total count of processes for pagination **Important considerations:** - Background processes handle long-running operations like imports and exports -- Process status indicates current state (queued, processing, completed, failed, cancelled) +- Process status indicates current state (queued, processing, completed) - Export processes provide download URLs when completed -- Failed processes include error messages for troubleshooting +- Import processes provide CSV report URLs with details about problematic records - Use pagination for accounts with many historical processes - Sort options available for creation order (ascending or descending) -- Different process types handle specific operations (imports, exports, calculations) +- Default limit is 10 results per page, maximum is 50
@@ -2690,18 +2756,14 @@ Retrieves detailed information about a specific background process. - Track process execution times **Key information returned:** -- Complete process details and status -- Import/export statistics and results -- Error information for troubleshooting -- Download URLs for export processes -- Process timing and performance data +- Complete process details (ID, name, status) +- Download URLs for completed export processes +- Import details with CSV report URLs for completed import processes **Important considerations:** -- Process ID must exist in your account -- Completed processes provide detailed statistics and results -- Export processes include download URLs when successful -- Failed processes contain error messages for debugging -- Timing information helps with performance analysis +- Process ID must exist in your account and not be deleted +- Completed export processes include download URLs +- Completed import processes include CSV report URLs with details about problematic records - Different process types return different result structures
@@ -3726,9 +3788,6 @@ Key information returned: ```php $client->webhooks->createWebhook( new CreateWebhookRequest([ - 'events' => [ - CreateWebhookRequestEventsItem::Sent->value, - ], 'url' => 'http://requestb.in/173lyyx1', ]), ); @@ -3762,7 +3821,7 @@ $client->webhooks->createWebhook(
-**$channel:** `?string` β€” channel of webhook +**$channel:** `?string` β€” Channel of the webhook
@@ -3789,24 +3848,18 @@ Inbound domain of webhook, required in case of event type
-**$events:** `array` +**$events:** `?array` -- Events triggering the webhook. Possible values for -**Transactional** type webhook: #### `sent` OR `request`, -`delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, -`invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and -`unsubscribed` - Possible values for **Marketing** type webhook: -#### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, -`unsubscribed`, `listAddition` & `delivered` - Possible values -for **Inbound** type webhook: #### `inboundEmailProcessed` - -Possible values for type **Transactional** and channel **SMS** -#### -`accepted`,`delivered`,`softBounce`,`hardBounce`,`unsubscribe`,`reply`, -`subscribe`,`sent`,`blacklisted`,`skip` - Possible values for -type **Marketing** channel **SMS** #### -`sent`,`delivered`,`softBounce`,`hardBounce`,`unsubscribe`,`reply`, -`subscribe`,`skip` -#### `reply` +Events triggering the webhook. Required for transactional and +marketing types, optional for inbound type (defaults to +`inboundEmailProcessed`). Possible values for **Transactional** +type webhook: `sent` OR `request`, `delivered`, `hardBounce`, +`softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, +`opened`, `uniqueOpened` and `unsubscribed`. Possible values for +**Marketing** type webhook: `spam`, `opened`, `click`, +`hardBounce`, `softBounce`, `unsubscribed`, `listAddition`, +`delivered`, `contactUpdated` & `contactDeleted`. Possible values +for **Inbound** type webhook: `inboundEmailProcessed`.
@@ -3937,7 +3990,7 @@ Mandatory if startDate is used. Ending date of the report
-**$messageId:** `?int` +**$messageId:** `?string` Filter the history for a specific message id. Applicable only for transactional webhooks. @@ -4866,24 +4919,51 @@ $client->externalFeeds->deleteExternalFeed( 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 - - Associations -**Response:** - The API processes the request asynchronously and returns a processId that you can use to track the background process status. -**API and Schema Limitation:** - - Size: - - Max 1000 objects records per request - - Max request body size: 1 MB - - 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 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. +Performs bulk create or update (upsert) operations for object records in a single asynchronous request. This endpoint is optimized for high-volume data imports and synchronization scenarios. + +**How Upsert Works:** +- **Create**: Omit `identifiers`, or provide only `ext_id` (if it doesn't already exist). A new record is created with a Brevo-generated `id`. +- **Update**: Provide `id` (Brevo internal ID) or an `ext_id` that already exists. The matching record is updated with the new attribute values. +- **Important:** `id` is for **updates only**. Providing an `id` that does not belong to an existing record will fail during async processing (the HTTP response will still be 202, but the record will be rejected in the background). To create a new record with a stable external reference, use `ext_id` instead. + +**Request Structure:** +Each object record in the `records` array can include: +- `identifiers`: Either `id` (internal Brevo ID) or `ext_id` (your external system ID) β€” required for updates. **Note:** use `id` (singular), not `ids`. +- `attributes`: Key-value pairs where each key is the attribute **key** (e.g., `company_name`), not the attribute label (e.g., "Company Name"). +- `associations`: Controls linking and unlinking of associated records (optional). Each entry specifies: + - `object_type`: The type of the associated object + - `action`: `link` (default) to create the association, or `unlink` to remove it + - `records`: The associated records to link or unlink (each identified by `ext_id` or `id`) + - **Unlink is idempotent** β€” unlinking a non-existing association is a no-op (no error returned) + - `link` and `unlink` actions can be submitted for the same `object_type` in a single record entry + - Both associated records must already exist before a link can be created + +> **Common mistake:** Passing the attribute **label** (the display name you see in the UI) instead of the attribute **key** will cause the attribute to be silently ignored and the record may not be created as expected. + +**Asynchronous Processing:** +- Returns immediately with a `processId` (HTTP 202 Accepted) +- Use the processId to track status via the Get process API + +**API and Schema Limitations:** +- Max 1000 object records per request +- Max request body size: 1 MB +- Max 500 attributes per object record (matches the schema limit of 500 attributes per object) +- Unknown attribute keys are silently ignored (no error, no attribute creation) +- Max 10 association records per associated object-type in each record of the request. If you need more, send multiple requests. + +**Important Behaviors:** +- The object schema must be created before upserting records +- Unknown attribute keys are silently ignored (no error, no creation) +- Both associated object records must already exist before creating a link association +- Unlink operations are idempotent: attempting to unlink a non-existing association returns success +- `link` and `unlink` actions can be submitted for the same `object_type` in a single record entry +- Contact objects cannot be created via this endpoint +- For `category` and `multiple_category` attributes, pass the option **key** as the value (not the option label or option ID). +- The `id` identifier (internal Brevo ID) can only be used for **updating** existing records. To create new records, either omit identifiers (Brevo auto-generates an ID) or provide an `ext_id`. + **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". +- 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".
@@ -4902,7 +4982,41 @@ $client->customObjects->upsertrecords( 'vehicle', new UpsertrecordsRequest([ 'records' => [ - new UpsertrecordsRequestRecordsItem([]), + new UpsertrecordsRequestRecordsItem([ + 'associations' => [ + new UpsertrecordsRequestRecordsItemAssociationsItem([ + 'objectType' => 'garage', + 'action' => UpsertrecordsRequestRecordsItemAssociationsItemAction::Link->value, + 'records' => [ + new UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem([ + 'identifiers' => new UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers([ + 'id' => 435435, + ]), + ]), + ], + ]), + new UpsertrecordsRequestRecordsItemAssociationsItem([ + 'objectType' => 'garage', + 'action' => UpsertrecordsRequestRecordsItemAssociationsItemAction::Unlink->value, + 'records' => [ + new UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem([ + 'identifiers' => new UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers([ + 'extId' => 'old-garage-001', + ]), + ]), + ], + ]), + ], + 'attributes' => [ + 'make' => "Toyota", + 'model' => "Camry", + 'year' => 2020, + 'engine_type' => "hybrid", + ], + 'identifiers' => new UpsertrecordsRequestRecordsItemIdentifiers([ + 'extId' => 'VIN123', + ]), + ]), ], ]), ); @@ -4920,7 +5034,7 @@ $client->customObjects->upsertrecords(
-**$objectType:** `string` β€” object type for the attribute +**$objectType:** `string` β€” Object type for the records to upsert. Must be a previously created custom object type. Only lowercase alphanumeric characters and underscores are allowed (max 32 characters).
@@ -4990,7 +5104,7 @@ $client->customObjects->getrecords(
-**$objectType:** `string` β€” object type for the attribute +**$objectType:** `string` β€” Object type for the records to retrieve. Must be a previously created custom object type. Contact as object type is not supported in this endpoint.
@@ -5047,8 +5161,8 @@ $client->customObjects->getrecords(
Use this endpoint to delete multiple object records of the same object-type in one request. -The request is accepted and processed asynchronously. You can track the status of the deletion process using the returned **processId**. -**API and Schema Limitations:** - Each request can contain up to **1000** object record identifiers - If more records must be deleted β†’ send multiple batch requests +The request is accepted and processed asynchronously. You can track the status of the deletion process using the returned **processId**. +**Limitations:** - Each request can contain up to **1000** object record identifiers - Either `ids` or `ext_ids` must be provided, but **not both** in the same request - Deletion of Brevo standard object records is not supported via this endpoint - If more records must be deleted, send multiple batch requests
@@ -5095,7 +5209,7 @@ $client->customObjects->batchDeleteObjectRecords(
-**$identifiers:** `BatchDeleteObjectRecordsRequestIdentifiersIds|BatchDeleteObjectRecordsRequestIdentifiersExtIds|null` β€” One of the below must be provided +**$identifiers:** `BatchDeleteObjectRecordsRequestIdentifiersIds|BatchDeleteObjectRecordsRequestIdentifiersExtIds|null` β€” Either `ids` or `ext_ids` must be provided, but not both in the same request.
@@ -5112,6 +5226,20 @@ $client->customObjects->batchDeleteObjectRecords(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve all contacts from your Brevo account with support for pagination, filtering, and sorting. Results default to 50 contacts per page (maximum 1000) sorted in descending order of creation, and can be filtered by modification date, creation date, contact IDs (up to 20), list IDs, segment ID, or contact attributes using the equals operator. Note that either listIds or segmentId can be passed but not both simultaneously. +
+
+
+
+ #### πŸ”Œ Usage
@@ -5178,7 +5306,15 @@ $client->contacts->getContacts(
-**$segmentId:** `?int` β€” Id of the segment. **Either listIds or segmentId can be passed.** +**$ids:** `?int` β€” Filter by a list of contact IDs. You can pass a **maximum of 20 IDs**. All elements must be integers. + +
+
+ +
+
+ +**$segmentId:** `?int` β€” Id of the segment. **Either listIds or segmentId can be passed.** Must be a positive integer (minimum value of 1).
@@ -5310,6 +5446,22 @@ $client->contacts->createContact( **$updateEnabled:** `?bool` β€” Facilitate to update the existing contact in the same request (updateEnabled = true) +
+
+ +
+
+ +**$forceMerge:** `?bool` β€” When true, if the contact being created shares an identifier (email, SMS, ext_id, whatsapp, landline) with an existing contact, the two contacts are force-merged. The contact with the most recent `last_modified` timestamp is retained; the other is deleted. When false (default), a 4xx error is returned on identifier conflict. + +
+
+ +
+
+ +**$getId:** `?bool` β€” When true, the response returns the `id` of the surviving contact after merge. +
@@ -5324,6 +5476,20 @@ $client->contacts->createContact(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve all contact attributes defined in your Brevo account, grouped by category (normal, transactional, category, calculated, global). Each attribute includes its name, type, and category, along with enumeration values for category-type attributes and options for multiple-choice-type attributes. +
+
+
+
+ #### πŸ”Œ Usage
@@ -5349,6 +5515,20 @@ $client->contacts->getAttributes();
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new contact attribute under the specified category and name. The required body properties depend on the category: use "type" for normal, transactional, or category attributes; use "value" for calculated or global attributes; use "enumeration" for category attributes; and use "multiCategoryOptions" for normal multiple-choice attributes. None of the category or multicategory option values can exceed 200 characters. +
+
+
+
+ #### πŸ”Œ Usage
@@ -5441,6 +5621,20 @@ $client->contacts->createAttribute(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing contact attribute identified by its category and name. For category-type attributes, you can update the enumeration values; for calculated or global attributes, update the computed value formula; and for normal multiple-choice attributes, update the multicategory options. None of the category or multicategory option values can exceed 200 characters. +
+
+
+
+ #### πŸ”Œ Usage
@@ -5517,6 +5711,20 @@ $client->contacts->updateAttribute(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete an existing contact attribute by its category and name. The attribute must exist in the specified category (normal, transactional, category, calculated, or global), otherwise a 404 error is returned. +
+
+
+
+ #### πŸ”Œ Usage
@@ -5568,6 +5776,20 @@ $client->contacts->deleteAttribute(
+#### πŸ“ Description + +
+
+ +
+
+ +Delete a specific option from an existing multiple-choice contact attribute. The attribute type must be "multiple-choice", and both the attribute name and the option to delete must already exist in your account. +
+
+
+
+ #### πŸ”Œ Usage
@@ -5628,6 +5850,20 @@ $client->contacts->deleteMultiAttributeOptions(
+#### πŸ“ Description + +
+
+ +
+
+ +Update multiple contacts in a single API call by passing an array of contact objects. Each contact in the array must be identified by one of: email, id, or sms (only one identifier per contact). You can update attributes, blacklist status, list memberships, ext_id, and transactional email forbidden senders for each contact in the batch. +
+
+
+
+ #### πŸ”Œ Usage
@@ -5963,6 +6199,20 @@ $client->contacts->getFolders(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new folder to organize your contact lists. Folders serve as containers for grouping related lists together. The folder name is required and must be provided in the request body. +
+
+
+
+ #### πŸ”Œ Usage
@@ -6063,6 +6313,20 @@ $client->contacts->getFolder(
+#### πŸ“ Description + +
+
+ +
+
+ +Update the name of an existing folder identified by its ID. The new folder name must be provided in the request body. Returns a 404 error if the folder ID does not exist. +
+
+
+
+ #### πŸ”Œ Usage
@@ -6116,6 +6380,20 @@ $client->contacts->updateFolder(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete a folder identified by its ID. Deleting a folder will also delete all the contact lists contained within it. This action cannot be undone. +
+
+
+
+ #### πŸ”Œ Usage
@@ -6451,6 +6729,20 @@ $client->contacts->getLists(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new contact list inside a specified folder. Both the list name and the parent folder ID are required. The newly created list will be empty and ready to receive contacts via the add contacts endpoint. +
+
+
+
+ #### πŸ”Œ Usage
@@ -6504,7 +6796,7 @@ $client->contacts->createList(
-#### πŸ”Œ Usage +#### πŸ“ Description
@@ -6512,18 +6804,32 @@ $client->contacts->createList(
-```php -$client->contacts->getList( - 1000000, - new GetListRequest([]), -); -``` +Retrieve the details of a specific contact list by its ID, including its name, folder ID, creation date, subscriber counts, and campaign statistics. You can optionally filter campaign statistics by providing startDate and endDate parameters (both must be used together in YYYY-MM-DD format).
-#### βš™οΈ Parameters +#### πŸ”Œ Usage + +
+
+ +
+
+ +```php +$client->contacts->getList( + 1000000, + new GetListRequest([]), +); +``` +
+
+
+
+ +#### βš™οΈ Parameters
@@ -6539,7 +6845,7 @@ $client->contacts->getList(
-**$startDate:** `?string` β€” **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** +**$startDate:** `?string` β€” **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result**
@@ -6563,6 +6869,20 @@ $client->contacts->getList(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing contact list identified by its ID. You can update the list name, move it to a different folder by providing a new folderId, or both. Only one of the two parameters (name, folderId) needs to be provided per request. +
+
+
+
+ #### πŸ”Œ Usage
@@ -6622,6 +6942,20 @@ $client->contacts->updateList(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete a contact list identified by its ID. The contacts in the list are not deleted; they are only removed from this list. Returns a 404 error if the list ID does not exist. +
+
+
+
+ #### πŸ”Œ Usage
@@ -6664,6 +6998,20 @@ $client->contacts->deleteList(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve all contacts belonging to a specific list, identified by its list ID. Results are paginated with a default of 50 contacts per page (maximum 500) and sorted in descending order of creation. You can optionally filter contacts by their modification date using the modifiedSince parameter. +
+
+
+
+ #### πŸ”Œ Usage
@@ -6850,6 +7198,20 @@ $client->contacts->removeContactFromList(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve all contact segments defined in your Brevo account with support for pagination and sorting. Results default to 10 segments per page (maximum 50) sorted in descending order of creation. Each segment includes its ID, name, category name, and last update timestamp. +
+
+
+
+ #### πŸ”Œ Usage
@@ -6967,7 +7329,7 @@ $client->contacts->getContactInfo(
-**$startDate:** `?string` β€” **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate +**$startDate:** `?string` β€” **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate. Must not be greater than the current date.
@@ -6975,7 +7337,7 @@ $client->contacts->getContactInfo(
-**$endDate:** `?string` β€” **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. +**$endDate:** `?string` β€” **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Must not be greater than the current date.
@@ -7034,7 +7396,7 @@ $client->contacts->updateContact(
-**$identifier:** `string|int` β€” Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value +**$identifier:** `string|int` β€” Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE_NUMBER attribute value
@@ -7042,7 +7404,7 @@ $client->contacts->updateContact(
-**$identifierType:** `?string` β€” email_id for Email, 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 +**$identifierType:** `?string` β€” email_id for Email, 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_NUMBER attribute
@@ -7100,6 +7462,14 @@ $client->contacts->updateContact( **$unlinkListIds:** `?array` β€” Ids of the lists to remove the contact from +
+
+ +
+
+ +**$forceMerge:** `?bool` β€” When true, if the contact being updated shares an identifier (email, SMS, ext_id, whatsapp, landline) with an existing contact, the two contacts are force-merged. The contact with the most recent `last_modified` timestamp is retained; the other is deleted. When false (default), a 4xx error is returned on identifier conflict. +
@@ -7179,6 +7549,20 @@ $client->contacts->deleteContact(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve email campaign statistics for a specific contact identified by email address or numeric ID. Statistics include messages sent, opens, clicks, hard/soft bounces, deliveries, unsubscriptions, complaints, and transactional attributes. By default, data covers the last 90 days; use startDate and endDate parameters (YYYY-MM-DD) to specify a custom range with a maximum span of 90 days. +
+
+
+
+ #### πŸ”Œ Usage
@@ -7214,7 +7598,7 @@ $client->contacts->getContactStats(
-**$startDate:** `?string` β€” **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate +**$startDate:** `?string` β€” **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate. Must not be greater than the current date.
@@ -7222,7 +7606,7 @@ $client->contacts->getContactStats(
-**$endDate:** `?string` β€” **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days +**$endDate:** `?string` β€” **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Must not be greater than the current date. Maximum difference between startDate and endDate should not be greater than 90 days.
@@ -7247,7 +7631,7 @@ $client->contacts->getContactStats(
-We recommend pinging this endpoint every minute for as long as the agent has to be considered online. +Sets the agent's status to online for 2-3 minutes. We recommend pinging this endpoint every minute for as long as the agent has to be considered online. You must provide either `agentId` alone, or all three of `agentEmail` + `agentName` + `receivedFrom`.
@@ -7264,7 +7648,7 @@ We recommend pinging this endpoint every minute for as long as the agent has to ```php $client->conversations->setsAgentsStatusToOnlineFor23Minutes( new PostConversationsAgentOnlinePingRequest([ - 'agentId' => "d9nKoegKSjmCtyK78", + 'agentId' => 'd9nKoegKSjmCtyK78', ]), ); ``` @@ -7281,7 +7665,7 @@ $client->conversations->setsAgentsStatusToOnlineFor23Minutes(
-**$agentEmail:** `mixed` β€” agent email. When sending online pings from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there’s no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. +**$agentEmail:** `?string` β€” Agent's email address. When sending online pings from a standalone system, it's hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there's no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically.
@@ -7289,7 +7673,7 @@ $client->conversations->setsAgentsStatusToOnlineFor23Minutes(
-**$agentId:** `mixed` β€” agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). +**$agentId:** `?string` β€” Agent ID. It can be found on the agent's page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required).
@@ -7297,7 +7681,7 @@ $client->conversations->setsAgentsStatusToOnlineFor23Minutes(
-**$agentName:** `mixed` β€” agent name +**$agentName:** `?string` β€” Agent's name.
@@ -7305,7 +7689,7 @@ $client->conversations->setsAgentsStatusToOnlineFor23Minutes(
-**$receivedFrom:** `mixed` β€” mark your messages to distinguish messages created by you from the others. +**$receivedFrom:** `?string` β€” Mark your messages to distinguish messages created by you from the others.
@@ -7321,6 +7705,20 @@ $client->conversations->setsAgentsStatusToOnlineFor23Minutes(
+#### πŸ“ Description + +
+
+ +
+
+ +Send a message as an agent to an existing visitor's conversation. You must provide either `agentId` alone, or all three of `agentEmail` + `agentName` + `receivedFrom` to identify the agent. +
+
+
+
+ #### πŸ”Œ Usage
@@ -7332,9 +7730,9 @@ $client->conversations->setsAgentsStatusToOnlineFor23Minutes( ```php $client->conversations->sendAMessageAsAnAgent( new PostConversationsMessagesRequest([ - 'agentId' => "d9nKoegKSjmCtyK78", - 'text' => "Hello! How can I help you?", - 'visitorId' => "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", + 'agentId' => 'd9nKoegKSjmCtyK78', + 'text' => 'Hello! How can I help you?', + 'visitorId' => 'kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg', ]), ); ``` @@ -7351,7 +7749,7 @@ $client->conversations->sendAMessageAsAnAgent(
-**$agentEmail:** `mixed` β€” agent email. When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. +**$agentEmail:** `?string` β€” Agent's email address. When sending messages from a standalone system, it's hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address.
@@ -7359,7 +7757,7 @@ $client->conversations->sendAMessageAsAnAgent(
-**$agentId:** `mixed` β€” agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). +**$agentId:** `?string` β€” Agent ID. It can be found on the agent's page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required).
@@ -7367,7 +7765,7 @@ $client->conversations->sendAMessageAsAnAgent(
-**$agentName:** `mixed` β€” agent name +**$agentName:** `?string` β€” Agent's name.
@@ -7375,7 +7773,7 @@ $client->conversations->sendAMessageAsAnAgent(
-**$receivedFrom:** `mixed` β€” mark your messages to distinguish messages created by you from the others. +**$receivedFrom:** `?string` β€” Mark your messages to distinguish messages created by you from the others.
@@ -7383,7 +7781,7 @@ $client->conversations->sendAMessageAsAnAgent(
-**$text:** `mixed` +**$text:** `string` β€” Message text.
@@ -7391,7 +7789,7 @@ $client->conversations->sendAMessageAsAnAgent(
-**$visitorId:** `mixed` +**$visitorId:** `string` β€” Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
@@ -7407,6 +7805,20 @@ $client->conversations->sendAMessageAsAnAgent(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a single message by its ID. +
+
+
+
+ #### πŸ”Œ Usage
@@ -7457,7 +7869,7 @@ $client->conversations->getAMessage(
-Only agents’ messages can be edited. +Update the text of a message sent by an agent. Only messages of type `agent` can be edited. The `text` and `html` fields of the message will be updated.
@@ -7500,7 +7912,7 @@ $client->conversations->updateAMessageSentByAnAgent(
-**$text:** `string` β€” edited message text +**$text:** `string` β€” The new message text.
@@ -7524,7 +7936,7 @@ $client->conversations->updateAMessageSentByAnAgent(
-Only agents’ messages can be deleted. +Delete a message sent by an agent. Only messages of type `agent` can be deleted.
@@ -7580,7 +7992,7 @@ $client->conversations->deleteAMessageSentByAnAgent(
-Example of automated messages: order status, announce new features in your web app, etc. +Send an automated (pushed) message to a visitor on behalf of an agent. Example use cases: order status updates, announcing new features in your web app, etc.
@@ -7597,9 +8009,9 @@ Example of automated messages: order status, announce new features in your web a ```php $client->conversations->sendAnAutomatedMessageToAVisitor( new PostConversationsPushedMessagesRequest([ - 'groupId' => "PjRBMhWGen6aRHjif", - 'text' => "Your order has shipped! Here’s your tracking number: 9114 5847 3325 9667 4328 88", - 'visitorId' => "kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg", + 'groupId' => 'PjRBMhWGen6aRHjif', + 'text' => "Your order has shipped! Here's your tracking number: 9114 5847 3325 9667 4328 88", + 'visitorId' => 'kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg', ]), ); ``` @@ -7616,7 +8028,7 @@ $client->conversations->sendAnAutomatedMessageToAVisitor(
-**$agentId:** `mixed` β€” agent ID. It can be found on agent’s page or received from a webhook. +**$agentId:** `?string` β€” Agent ID. It can be found on the agent's page or received from a webhook.
@@ -7624,7 +8036,7 @@ $client->conversations->sendAnAutomatedMessageToAVisitor(
-**$groupId:** `mixed` β€” group ID. It can be found on group’s page. +**$groupId:** `?string` β€” Group ID. It can be found on the group's page.
@@ -7632,7 +8044,7 @@ $client->conversations->sendAnAutomatedMessageToAVisitor(
-**$text:** `mixed` +**$text:** `string` β€” Message text.
@@ -7640,7 +8052,7 @@ $client->conversations->sendAnAutomatedMessageToAVisitor(
-**$visitorId:** `mixed` +**$visitorId:** `string` β€” Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
@@ -7656,6 +8068,20 @@ $client->conversations->sendAnAutomatedMessageToAVisitor(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a single automated (pushed) message by its ID. +
+
+
+
+ #### πŸ”Œ Usage
@@ -7698,6 +8124,20 @@ $client->conversations->getAnAutomatedMessage(
+#### πŸ“ Description + +
+
+ +
+
+ +Update the text of an automated (pushed) message. The `text` and `html` fields of the message will be updated. +
+
+
+
+ #### πŸ”Œ Usage
@@ -7710,7 +8150,7 @@ $client->conversations->getAnAutomatedMessage( $client->conversations->updateAnAutomatedMessage( 'id', new PutConversationsPushedMessagesIdRequest([ - 'text' => 'Your order has shipped! Here’s your tracking number: 9114 5847 4668 7775 9233 54', + 'text' => "Your order has shipped! Here's your tracking number: 9114 5847 4668 7775 9233 54", ]), ); ``` @@ -7735,7 +8175,7 @@ $client->conversations->updateAnAutomatedMessage(
-**$text:** `string` β€” edited message text +**$text:** `string` β€” The new message text.
@@ -7751,6 +8191,20 @@ $client->conversations->updateAnAutomatedMessage(
+#### πŸ“ Description + +
+
+ +
+
+ +Delete an automated (pushed) message by its ID. +
+
+
+
+ #### πŸ”Œ Usage
@@ -7852,6 +8306,20 @@ $client->conversations->setVisitorGroupAssignment(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of all ecommerce categories stored in your Brevo account. Results are sorted by creation date in descending order by default, and can be filtered by category IDs, name, modification date, creation date, or deletion status. The response includes a `count` field with the total number of matching categories, and pagination defaults to 50 categories per page (maximum 100). +
+
+
+
+ #### πŸ”Œ Usage
@@ -7950,6 +8418,20 @@ $client->ecommerce->getCategories(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new ecommerce category or update an existing one, identified by the mandatory `id` field. When `updateEnabled` is set to `false` (the default), the endpoint performs an insert and returns `201`; if the category ID already exists, a `400` error is returned. When `updateEnabled` is `true`, the endpoint performs an upsert, returning `201` for a new category or `204` when an existing category is updated. The `name` field is mandatory for creation but optional for updates. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8034,6 +8516,20 @@ $client->ecommerce->createUpdateCategory(
+#### πŸ“ Description + +
+
+ +
+
+ +Create or update multiple ecommerce categories in a single request. The `categories` array accepts up to 100 category objects, each requiring a unique `id`. When `updateEnabled` is `false` (the default), all categories are inserted as new; if any ID already exists, a `400` error is returned. When `updateEnabled` is `true`, existing categories are updated and new ones are created via upsert. Duplicate IDs within the same request payload are rejected. The response returns the count of created and updated categories. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8090,6 +8586,20 @@ $client->ecommerce->createUpdateBatchCategory(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the full details of a single ecommerce category by its unique ID. The response includes the category name, URL, creation and modification timestamps, and deletion status. Returns a `404` error if no category matches the provided ID. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8171,6 +8681,20 @@ $client->ecommerce->activateTheECommerceApp();
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve aggregated ecommerce attribution metrics for one or more Brevo email campaigns, SMS campaigns, or automation workflows. You can optionally filter by a date range using `periodFrom` and `periodTo` in RFC3339 format. The response includes per-source metrics (orders count, revenue, and average basket) as well as aggregated totals across all requested sources. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8184,6 +8708,9 @@ $client->ecommerce->getAttributionMetricsForOneOrMoreBrevoCampaignsOrWorkflows( new GetEcommerceAttributionMetricsRequest([ 'periodFrom' => new DateTime('2022-01-02T00:00:00Z'), 'periodTo' => new DateTime('2022-01-03T00:00:00Z'), + 'emailCampaignIdArray' => [ + 'sale', + ], ]), ); ``` @@ -8256,6 +8783,20 @@ $client->ecommerce->getAttributionMetricsForOneOrMoreBrevoCampaignsOrWorkflows(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve detailed attribution metrics for a single Brevo campaign or automation workflow, identified by its conversion source type and ID. The response includes orders count, revenue, average basket value, and the number of new customers attributed to that specific campaign or workflow. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8307,6 +8848,20 @@ $client->ecommerce->getDetailedAttributionMetricsForASingleBrevoCampaignOrWorkfl
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the list of products whose sales have been attributed to a specific Brevo campaign or automation workflow. Each product entry includes its ID, name, SKU, image URL, product URL, price, revenue, and orders count. The conversion source type must be one of `email_campaign`, `sms_campaign`, `automation_workflow_email`, or `automation_workflow_sms`. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8358,7 +8913,7 @@ $client->ecommerce->getAttributedProductSalesForASingleBrevoCampaignOrWorkflow(
-#### πŸ”Œ Usage +#### πŸ“ Description
@@ -8366,9 +8921,23 @@ $client->ecommerce->getAttributedProductSalesForASingleBrevoCampaignOrWorkflow(
-```php -$client->ecommerce->getTheIso4217CompliantDisplayCurrencyCodeForYourBrevoAccount(); -``` +Retrieve the ISO 4217 display currency code currently configured for your Brevo ecommerce account. This currency is used to display monetary values across the ecommerce dashboard and reports. Returns a `403` error if ecommerce is not activated on the account. +
+
+
+
+ +#### πŸ”Œ Usage + +
+
+ +
+
+ +```php +$client->ecommerce->getTheIso4217CompliantDisplayCurrencyCodeForYourBrevoAccount(); +```
@@ -8383,6 +8952,20 @@ $client->ecommerce->getTheIso4217CompliantDisplayCurrencyCodeForYourBrevoAccount
+#### πŸ“ Description + +
+
+ +
+
+ +Set or update the ISO 4217 display currency code for your Brevo ecommerce account. This currency determines how monetary values are displayed in the ecommerce dashboard and reports. The provided currency code must be a valid ISO 4217 code; invalid codes result in a `422` error. Returns a `403` error if ecommerce is not activated on the account. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8639,7 +9222,7 @@ $client->ecommerce->createBatchOrder(
-**$historical:** `?bool` β€” Defines wether you want your orders to be considered as live data or as historical data (import of past data, synchronising data). True: orders will not trigger any automation workflows. False: orders will trigger workflows as usual. +**$historical:** `?bool` β€” Defines whether you want your orders to be considered as live data or as historical data (import of past data, synchronising data). True: orders will not trigger any automation workflows. False: orders will trigger workflows as usual.
@@ -8647,7 +9230,7 @@ $client->ecommerce->createBatchOrder(
-**$notifyUrl:** `?string` β€” Notify Url provided by client_dev to get the status of batch request +**$notifyUrl:** `?string` β€” Webhook URL to receive the status of the batch request
@@ -8671,6 +9254,20 @@ $client->ecommerce->createBatchOrder(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of all ecommerce products stored in your Brevo account. Results are sorted by creation date in descending order by default, and can be filtered by product IDs, name (minimum 3 characters), price range, category IDs, modification date, creation date, or deletion status. Use the `search` parameter to query across SKU, name, and ID simultaneously β€” results are prioritized as exact SKU match > SKU prefix match > name match > ID match. Pagination defaults to 50 products per page (maximum 1000), and the response includes a `count` field with the total number of matching products. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8729,6 +9326,14 @@ $client->ecommerce->getProducts(
+**$search:** `?string` β€” Search products simultaneously across SKU, name, and ID fields. Results are returned in the following priority order: **exact SKU match** > **SKU prefix match** > **name match** > **ID match**. For example, `?search=123` on products with `{sku: "123"}` and `{sku: "123456"}` returns the exact SKU match first. + +
+
+ +
+
+ **$name:** `?string` β€” Filter by product name, minimum 3 characters should be present for search.
@@ -8785,6 +9390,54 @@ $client->ecommerce->getProducts(
+**$alternativePriceLte:** `?float` β€” Alternative price filter for products less than and equals to particular amount + +
+
+ +
+
+ +**$alternativePriceGte:** `?float` β€” Alternative price filter for products greater than and equals to particular amount + +
+
+ +
+
+ +**$alternativePriceLt:** `?float` β€” Alternative price filter for products less than particular amount + +
+
+ +
+
+ +**$alternativePriceGt:** `?float` β€” Alternative price filter for products greater than particular amount + +
+
+ +
+
+ +**$alternativePriceEq:** `?float` β€” Alternative price filter for products equals to particular amount + +
+
+ +
+
+ +**$alternativePriceNe:** `?float` β€” Alternative price filter for products not equals to particular amount + +
+
+ +
+
+ **$categories:** `?string` β€” Filter by categories ids
@@ -8793,7 +9446,7 @@ $client->ecommerce->getProducts(
-**$modifiedSince:** `?string` β€” Filter (urlencoded) the orders modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** +**$modifiedSince:** `?string` β€” Filter (urlencoded) the products modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.**
@@ -8801,7 +9454,15 @@ $client->ecommerce->getProducts(
-**$createdSince:** `?string` β€” Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** +**$createdSince:** `?string` β€” Filter (urlencoded) the products created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + +
+
+ +
+
+ +**$sortByField:** `?string` β€” Sort the results by a specific field. Default sort field is `created_at` when not passed.
@@ -8825,6 +9486,20 @@ $client->ecommerce->getProducts(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new ecommerce product or update an existing one, identified by the mandatory `id` field. When `updateEnabled` is `false` (the default), the endpoint inserts a new product and returns `201`; if the product ID already exists, a `400` error is returned. When `updateEnabled` is `true`, the endpoint performs an upsert, returning `201` for a new product or `204` for an update. The `name` field is mandatory for creation but optional for updates. Product images are downloaded, validated (max 5 MB, formats: jpeg, jpg, png, bmp, gif, webp), and re-hosted on S3. The `metaInfo` object supports up to 20 keys with a cumulative size limit of approximately 1000 KB. +
+
+
+
+ #### πŸ”Œ Usage
@@ -8918,7 +9593,7 @@ $client->ecommerce->createUpdateProduct(
-**$name:** `string` β€” Mandatory in case of creation**. Name of the product for which you requested the details +**$name:** `string` β€” **Mandatory in case of creation**. Name of the product, as displayed in the shop
@@ -8942,6 +9617,14 @@ $client->ecommerce->createUpdateProduct(
+**$alternativePrice:** `?float` β€” Alternative price of the product + +
+
+ +
+
+ **$sku:** `?string` β€” Product identifier from the shop
@@ -8958,7 +9641,7 @@ $client->ecommerce->createUpdateProduct(
-**$updateEnabled:** `?bool` β€” Facilitate to update the existing category in the same request (updateEnabled = true) +**$updateEnabled:** `?bool` β€” Facilitate to update the existing product in the same request (updateEnabled = true)
@@ -8982,6 +9665,20 @@ $client->ecommerce->createUpdateProduct(
+#### πŸ“ Description + +
+
+ +
+
+ +Create or update multiple ecommerce products in a single request. The `products` array accepts up to 100 product objects for creation (or up to 1000 when `updateEnabled` is `true` and the account has an increased limit). Each product requires a unique `id` and `name` (name is mandatory for creation only). When `updateEnabled` is `false`, all products are inserted as new; if any ID already exists, a `400` error is returned. When `updateEnabled` is `true`, existing products are updated and new ones are created via upsert. Duplicate IDs within the same request payload are rejected. The response returns the count of created and updated products. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9023,7 +9720,7 @@ $client->ecommerce->createUpdateBatchProducts(
-**$updateEnabled:** `?bool` β€” Facilitate to update the existing categories in the same request (updateEnabled = true) +**$updateEnabled:** `?bool` β€” Facilitate to update the existing products in the same request (updateEnabled = true)
@@ -9039,6 +9736,20 @@ $client->ecommerce->createUpdateBatchProducts(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the full details of a single ecommerce product by its unique ID. The response includes the product name, price, SKU, URL, image URLs (original and thumbnails), categories, stock level, meta information, creation and modification timestamps, and deletion status. Returns a `404` error if no product matches the provided ID. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9081,6 +9792,20 @@ $client->ecommerce->getProductInfo(
+#### πŸ“ Description + +
+
+ +
+
+ +Register a contact to receive an alert for a specific product event, such as `back_in_stock`. At least one contact identifier (`ext_id`, `email`, or `sms`) must be provided; when multiple are given, priority is `ext_id` > `email` > `sms`. Returns a `404` error if the product ID does not exist, and a `403` error if product alerts are not enabled for the account. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9142,6 +9867,20 @@ $client->ecommerce->createProductAlert(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of all coupon collections in your Brevo account. Results can be sorted by creation date, remaining coupons count, or expiration date, in ascending or descending order. Pagination defaults to 50 collections per page (maximum 100). +
+
+
+
+ #### πŸ”Œ Usage
@@ -9208,6 +9947,20 @@ $client->coupons->getCouponCollections(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new coupon collection with a name and a default coupon value. You can optionally set an expiration date in RFC3339 format and configure alert thresholds to receive email notifications when remaining coupons or remaining days before expiration fall below a specified number. The collection ID is auto-generated as a UUID and returned in the response. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9285,6 +10038,20 @@ $client->coupons->createCouponCollection(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the details of a single coupon collection by its UUID. The response includes the collection name, default coupon value, total and remaining coupon counts, and creation timestamp. Returns a `404` error if no collection matches the provided ID. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9327,6 +10094,20 @@ $client->coupons->getCouponCollection(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing coupon collection by its UUID. You can modify the default coupon value, set or remove the expiration date (pass `null` to remove), and configure or disable alert thresholds for remaining coupons or remaining days. Only the fields included in the request body are updated; omitted fields remain unchanged. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9402,6 +10183,20 @@ $client->coupons->updateCouponCollection(
+#### πŸ“ Description + +
+
+ +
+
+ +Add coupons to an existing coupon collection. The `coupons` array must contain between 1 and 10,000 unique coupon code strings, all associated with the specified `collectionId`. Coupon creation is processed asynchronously and a `204` status is returned immediately upon acceptance. Returns a `404` error if the specified coupon collection does not exist. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9458,6 +10253,20 @@ $client->coupons->createCoupons(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new payment request for a Brevo contact. The request requires a reference (displayed on the payment page), a contact ID, and a cart with currency and amount in cents. You can optionally configure a custom success redirect URL and enable email notifications with reminders. Returns the payment request ID and its public payment URL. A `403` error is returned if Brevo Payments is not activated or the account is not validated. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9547,6 +10356,20 @@ $client->payments->createPaymentRequest(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the details of a specific payment request by its ID. The response includes the reference, status (created, sent, reminderSent, or paid), cart details, notification configuration, contact ID, and the number of reminders sent. Returns a `404` error if no payment request matches the provided ID. +
+
+
+
+ #### πŸ”Œ Usage
@@ -9589,7 +10412,7 @@ $client->payments->getPaymentRequest(
-#### πŸ”Œ Usage +#### πŸ“ Description
@@ -9597,8 +10420,22 @@ $client->payments->getPaymentRequest(
-```php -$client->payments->deletePaymentRequest( +Delete a payment request by its UUID. Once deleted, the payment request can no longer be accessed or paid. Returns a `404` error if no payment request matches the provided ID, and a `403` error if Brevo Payments is not activated or the account is not validated. +
+
+
+
+ +#### πŸ”Œ Usage + +
+
+ +
+
+ +```php +$client->payments->deletePaymentRequest( '9ae7d68a-565c-4695-9381-d8fb3e3a14cc', ); ``` @@ -9791,7 +10628,7 @@ $client->event->createEvent(
-**$eventDate:** `?string` β€” Timestamp of when the event occurred (e.g. "2024-01-24T17:39:57+01:00"). If no value is passed, the timestamp of the event creation is used. +**$eventDate:** `?DateTime` β€” ISO 8601 timestamp of when the event occurred (e.g. "2024-01-24T17:39:57+01:00"). If no value is passed, the timestamp of the event creation is used.
@@ -9799,7 +10636,7 @@ $client->event->createEvent(
-**$eventName:** `string` β€” The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only. +**$eventName:** `string` β€” The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters; only alphanumeric characters, hyphens (-), and underscores (_) are allowed.
@@ -9807,7 +10644,7 @@ $client->event->createEvent(
-**$eventProperties:** `?array` β€” Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. "2024-01-24T17:39:57+01:00"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb. +**$eventProperties:** `?array` β€” Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field types are supported: string, number, boolean (true/false), date (Timestamp e.g. "2024-01-24T17:39:57+01:00"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50KB.
@@ -9863,12 +10700,14 @@ Create multiple events to track contacts' interactions in a single request. ```php $client->event->createBatchEvents( - [ - new CreateBatchEventsRequestItem([ - 'eventName' => 'order_created', - 'identifiers' => new CreateBatchEventsRequestItemIdentifiers([]), - ]), - ], + new CreateBatchEventsRequest([ + 'events' => [ + new CreateBatchEventsRequestEventsItem([ + 'eventName' => 'order_created', + 'identifiers' => new CreateBatchEventsRequestEventsItemIdentifiers([]), + ]), + ], + ]), ); ```
@@ -9884,7 +10723,7 @@ $client->event->createBatchEvents(
-**$request:** `array` +**$events:** `array`
@@ -9909,7 +10748,7 @@ $client->event->createBatchEvents(
-This endpoint will show the list of all the events for the received emails. +This endpoint will show the list of all the events for the received emails. When no date range is provided, the last 30 days of events are returned by default.
@@ -9949,7 +10788,7 @@ $client->inboundParsing->getInboundEmailEvents(
-**$startDate:** `?string` β€” Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. +**$startDate:** `?string` β€” Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is 30 days. Must not be in the future.
@@ -9957,7 +10796,7 @@ $client->inboundParsing->getInboundEmailEvents(
-**$endDate:** `?string` β€” Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. +**$endDate:** `?string` β€” Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is 30 days. Must not be in the future.
@@ -10106,7 +10945,7 @@ $client->inboundParsing->getInboundEmailAttachment( ## Balance -
$client->balance->getActiveBalancesApi($pid, $request) -> ?BalanceLimit +
$client->balance->getActiveBalancesApi($pid, $request) -> ?GetLoyaltyBalanceProgramsPidActiveBalanceResponse
@@ -10136,8 +10975,8 @@ Returns Active Balances $client->balance->getActiveBalancesApi( 'pid', new GetLoyaltyBalanceProgramsPidActiveBalanceRequest([ - 'contactId' => 1, - 'balanceDefinitionId' => 'balance_definition_id', + 'contactId' => 1000000, + 'balanceDefinitionId' => 'balanceDefinitionId', ]), ); ``` @@ -11261,7 +12100,7 @@ $client->balance->deleteBalanceLimit(
-Returns balance list +Returns contact balances for a given balance definition across all subscriptions.
@@ -11278,7 +12117,9 @@ Returns balance list ```php $client->balance->getContactBalances( 'pid', - new GetContactBalancesRequest([]), + new GetContactBalancesRequest([ + 'balanceDefinitionId' => 'balanceDefinitionId', + ]), ); ```
@@ -11304,6 +12145,46 @@ $client->balance->getContactBalances( **$includeInternal:** `?bool` β€” Include balances tied to internal definitions. +
+
+ +
+
+ +**$limit:** `?int` β€” Limit the number of records returned + +
+
+ +
+
+ +**$offset:** `?int` β€” Skip a number of records + +
+
+ +
+
+ +**$sort:** `?string` β€” Sort order + +
+
+ +
+
+ +**$sortField:** `?string` β€” Field to sort by + +
+
+ +
+
+ +**$balanceDefinitionId:** `string` β€” Balance Definition ID (required) +
@@ -11348,7 +12229,7 @@ $client->balance->createBalanceOrder( 'balanceDefinitionId' => 'balanceDefinitionId', 'contactId' => 1, 'dueAt' => 'dueAt', - 'source' => 'source', + 'source' => CreateBalanceOrderRequestSource::Engine->value, ]), ); ``` @@ -11421,7 +12302,7 @@ $client->balance->createBalanceOrder(
-**$source:** `string` β€” Specifies the origin of the order (`engine` or `user`). +**$source:** `string` β€” Specifies the origin of the order.
@@ -11613,7 +12494,7 @@ Returns transaction history $client->balance->getTransactionHistoryApi( 'pid', new GetLoyaltyBalanceProgramsPidTransactionHistoryRequest([ - 'contactId' => 1, + 'contactId' => 1000000, 'balanceDefinitionId' => 'balanceDefinitionId', ]), ); @@ -11663,7 +12544,7 @@ $client->balance->getTransactionHistoryApi(
-**$sort:** `?string` β€” Sort order, either asc or desc +**$sort:** `?string` β€” Sort order
@@ -11687,7 +12568,7 @@ $client->balance->getTransactionHistoryApi(
-**$filters:** `?string` β€” Filters to apply +**$status:** `?string` β€” Transaction status filter
@@ -11695,7 +12576,7 @@ $client->balance->getTransactionHistoryApi(
-**$status:** `?string` β€” Transaction status filter. Allowed values: draft, completed, rejected, cancelled, expired +**$transactionType:** `?string` β€” Transaction type filter
@@ -11703,7 +12584,7 @@ $client->balance->getTransactionHistoryApi(
-**$transactionType:** `?string` β€” Transaction type filter. Allowed values: credit, debit +**$loyaltySubscriptionId:** `?string` β€” Loyalty Subscription ID filter
@@ -11771,7 +12652,7 @@ $client->balance->beginTransaction(
-**$loyaltySubscriptionId:** `?string` β€” Unique identifier for the loyalty subscription (required unless `contactId` is provided). +**$amount:** `float` β€” Transaction amount. A positive value creates a credit transaction and a negative value creates a debit transaction (unless transactionType is explicitly provided).
@@ -11779,7 +12660,7 @@ $client->balance->beginTransaction(
-**$amount:** `float` β€” Transaction amount (must be provided). +**$transactionType:** `?string` β€” Explicit transaction type. If not provided, the type is inferred from the sign of the amount (positive = credit, negative = debit).
@@ -11787,7 +12668,7 @@ $client->balance->beginTransaction(
-**$autoComplete:** `?bool` β€” Whether the transaction should be automatically completed. +**$balanceDefinitionId:** `string` β€” Unique identifier (UUID) of the associated balance definition.
@@ -11795,7 +12676,7 @@ $client->balance->beginTransaction(
-**$balanceDefinitionId:** `string` β€” Unique identifier (UUID) of the associated balance definition. +**$contactId:** `?int` β€” Unique identifier of the contact involved in the transaction. Required unless `LoyaltySubscriptionId` is provided.
@@ -11803,7 +12684,7 @@ $client->balance->beginTransaction(
-**$balanceExpiryInMinutes:** `?int` β€” Optional expiry time for the balance in minutes (must be greater than 0 if provided). +**$loyaltySubscriptionId:** `?string` β€” Unique identifier for the loyalty subscription. Required unless `contactId` is provided.
@@ -11811,7 +12692,7 @@ $client->balance->beginTransaction(
-**$contactId:** `?int` β€” Unique identifier of the contact involved in the transaction (required unless `LoyaltySubscriptionId` is provided). +**$meta:** `?array` β€” Optional metadata associated with the transaction.
@@ -11819,7 +12700,7 @@ $client->balance->beginTransaction(
-**$eventTime:** `?string` β€” Optional timestamp specifying when the transaction occurred. +**$ttl:** `?int` β€” Time-to-live for the transaction in seconds. Must be at least 10 seconds if provided.
@@ -11827,7 +12708,15 @@ $client->balance->beginTransaction(
-**$meta:** `?array` β€” Optional metadata associated with the transaction. +**$eventTime:** `?DateTime` β€” Timestamp specifying when the transaction event occurred (ISO 8601 / RFC 3339 format). + +
+
+ +
+
+ +**$autoComplete:** `?bool` β€” Whether the transaction should be automatically completed.
@@ -11835,7 +12724,7 @@ $client->balance->beginTransaction(
-**$ttl:** `?int` β€” Optional time-to-live for the transaction (must be greater than 0 if provided). +**$balanceExpiryInMinutes:** `?int` β€” Expiry time for the balance in minutes. Must be greater than 0 if provided. Only applicable when autoComplete is true.
@@ -12046,7 +12935,7 @@ $client->program->getLpList(
-**$sort:** `?string` β€” Sort documents by field +**$sort:** `?string` β€” Sort order
@@ -12808,7 +13697,7 @@ Subscribes to a loyalty program $client->program->subscribeToLoyaltyProgram( 'pid', new SubscribeToLoyaltyProgramRequest([ - 'contactId' => 1, + 'contactId' => 1000000, ]), ); ``` @@ -12841,7 +13730,7 @@ $client->program->subscribeToLoyaltyProgram(
-**$creationDate:** `?string` β€” Optional custom date-time format. +**$loyaltySubscriptionId:** `?string` β€” Optional subscription ID (max length 64).
@@ -12849,7 +13738,15 @@ $client->program->subscribeToLoyaltyProgram(
-**$loyaltySubscriptionId:** `?string` β€” Optional subscription ID (max length 64). +**$creationDate:** `?DateTime` β€” Optional creation date in ISO 8601 format (YYYY-MM-DDThh:mm:ss.ffffff+HH:MM). Must be in the past. + +
+
+ +
+
+ +**$meta:** `?array` β€” Optional metadata associated with the subscription.
@@ -13212,6 +14109,14 @@ $client->reward->createVoucher( **$value:** `?float` β€” Value of the selected reward config +
+
+ +
+
+ +**$validFrom:** `?string` β€” Date from which the voucher becomes valid. Accepts RFC 3339 or DD/MM/YYYY HH:MM AM/PM format. Converted to UTC using the organization's timezone. +
@@ -13333,6 +14238,14 @@ $client->reward->redeemVoucher( **$ttl:** `?int` β€” Time to live in seconds for the redemption request +
+
+ +
+
+ +**$autoComplete:** `?bool` β€” Whether the redemption should be automatically completed +
@@ -13996,6 +14909,22 @@ $client->tier->createTierGroup( **$upgradeStrategy:** `?string` β€” Select real_time to upgrade tier on real time balance updates. Select membership_anniversary to upgrade tier on subscription anniversary. Select tier_anniversary to upgrade tier on tier anniversary. +
+
+ +
+
+ +**$upgradeSchedule:** `?CreateTierGroupRequestUpgradeSchedule` β€” Schedule configuration for tier upgrades. Required when upgradeStrategy is set to a schedule-based strategy. + +
+
+ +
+
+ +**$downgradeSchedule:** `?CreateTierGroupRequestDowngradeSchedule` β€” Schedule configuration for tier downgrades. Required when downgradeStrategy is set to a schedule-based strategy. +
@@ -14611,7 +15540,7 @@ $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). +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/2023/2/7).
@@ -14659,7 +15588,7 @@ $client->emailCampaigns->getEmailCampaigns(
-**$statistics:** `?string` β€” Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. +**$statistics:** `?string` β€” Filter on the type of statistics required. Example: **globalStats** value will only fetch globalStats info of the campaign in the returned response. This option only returns data for events that occurred in the last 6 months. For older campaigns, it is advisable to use the **Get Campaign Report** endpoint.
@@ -14667,7 +15596,7 @@ $client->emailCampaigns->getEmailCampaigns(
-**$startDate:** `?string` β€” **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) +**$startDate:** `?string` β€” **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result.** Only available if `status` is not passed or is set to `sent`. The date range between `startDate` and `endDate` must not exceed 2 years. `startDate` must not be in the future.
@@ -14675,7 +15604,7 @@ $client->emailCampaigns->getEmailCampaigns(
-**$endDate:** `?string` β€” **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) +**$endDate:** `?string` β€” **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result.** Only available if `status` is not passed or is set to `sent`. The date range between `startDate` and `endDate` must not exceed 2 years. `endDate` must not be in the future.
@@ -14707,7 +15636,15 @@ $client->emailCampaigns->getEmailCampaigns(
-**$excludeHtmlContent:** `?bool` β€” Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body +**$excludeHtmlContent:** `?bool` β€” Use this flag to exclude htmlContent from the response body. If set to **true**, the htmlContent field will be returned as an empty string in the response body. + +
+
+ +
+
+ +**$excludePdfAttachment:** `?bool` β€” Use this flag to filter out campaigns that have a PDF attachment. If set to **true**, only campaigns without a PDF attachment (or with no attachment at all) will be returned.
@@ -14723,6 +15660,20 @@ $client->emailCampaigns->getEmailCampaigns(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new email campaign. The campaign requires at minimum a name and sender details, and is created in draft status by default. You must provide email content via one of three mutually exclusive options: htmlContent (inline HTML), htmlUrl (remote URL), or templateId (existing template); additionally, A/B testing can be enabled by setting abTesting to true with subjectA and subjectB, but this is incompatible with sendAtBestTime. +
+
+
+
+ #### πŸ”Œ Usage
@@ -14792,7 +15743,7 @@ $client->emailCampaigns->createEmailCampaign(
-**$htmlContent:** `?string` β€” Mandatory if htmlUrl and templateId are empty. Body of the message (HTML). +**$htmlContent:** `?string` β€” **Mandatory if htmlUrl and templateId are empty.** Body of the message (HTML). Must have more than 10 characters and be less than 1MB in size. Cannot be used together with `htmlUrl` or `templateId`.
@@ -14800,7 +15751,7 @@ $client->emailCampaigns->createEmailCampaign(
-**$htmlUrl:** `?string` β€” **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: **https://html.domain.com** +**$htmlUrl:** `?string` β€” **Mandatory if htmlContent and templateId are empty.** URL to the message (HTML). Cannot be used together with `htmlContent` or `templateId`. For example: **https://html.domain.com**
@@ -14904,7 +15855,7 @@ $client->emailCampaigns->createEmailCampaign(
-**$sender:** `CreateEmailCampaignRequestSender` β€” Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{"name":"xyz", "email":"example@abc.com"}** **{"name":"xyz", "id":123}** +**$sender:** `CreateEmailCampaignRequestSender` β€” Sender details including id or email and name (optional). Only one of either Sender’s email or Sender’s ID shall be passed in one request at a time. Passing both `email` and `id` will result in an error. For example: **{"name":"xyz", "email":"example@abc.com"}** or **{"name":"xyz", "id":123}**
@@ -14952,7 +15903,7 @@ $client->emailCampaigns->createEmailCampaign(
-**$templateId:** `?int` β€” **Mandatory if htmlContent and htmlUrl are empty**. Id of the transactional email template with status _active_. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature. +**$templateId:** `?int` β€” **Mandatory if htmlContent and htmlUrl are empty.** Id of the transactional email template with status _active_. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature. Cannot be used together with `htmlContent` or `htmlUrl`.
@@ -15016,6 +15967,20 @@ $client->emailCampaigns->createEmailCampaign(
+#### πŸ“ Description + +
+
+ +
+
+ +Upload an image to your account''s image gallery by providing an absolute URL to the image. The maximum allowed image size is 2MB and supported formats are jpeg, jpg, png, bmp, and gif; local file uploads are not supported. +
+
+
+
+ #### πŸ”Œ Usage
@@ -15068,6 +16033,20 @@ $client->emailCampaigns->uploadImageToGallery(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve detailed information about a specific email campaign by its ID, including recipients, statistics, and HTML content. Use the statistics query parameter to select which statistics to include (globalStats, linksStats, statsByDomain, statsByDevice, or statsByBrowser); statsByDevice and statsByBrowser are only available on this single-campaign endpoint. You can exclude HTML content from the response by setting excludeHtmlContent to true. +
+
+
+
+ #### πŸ”Œ Usage
@@ -15103,7 +16082,7 @@ $client->emailCampaigns->getEmailCampaign(
-**$statistics:** `?string` β€” Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. +**$statistics:** `?string` β€” Filter on the type of statistics required. Example: **globalStats** value will only fetch globalStats info of the campaign in the returned response. `statsByDevice` and `statsByBrowser` are only available when retrieving a single campaign (not in the list endpoint).
@@ -15127,6 +16106,20 @@ $client->emailCampaigns->getEmailCampaign(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing email campaign''s properties such as name, subject, content, sender, recipients, schedule, and A/B testing configuration. The campaign must exist and the request body must contain at least one valid field to update. Only draft or scheduled campaigns can be modified; if sendAtBestTime is enabled, IP warmup will be automatically disabled. +
+
+
+
+ #### πŸ”Œ Usage
@@ -15426,6 +16419,20 @@ $client->emailCampaigns->updateEmailCampaign(
+#### πŸ“ Description + +
+
+ +
+
+ +Delete an email campaign by its campaign ID. Only campaigns that have not been scheduled can be deleted; attempting to delete a campaign that has already been scheduled will return a 403 permission denied error. Related data in templates, newsletter builder, and schedule collections is also cleaned up. +
+
+
+
+ #### πŸ”Œ Usage
@@ -15524,6 +16531,20 @@ $client->emailCampaigns->getAbTestCampaignResult(
+#### πŸ“ Description + +
+
+ +
+
+ +Export the recipients of a sent email campaign as an asynchronous process, filtered by recipient type (e.g. openers, clickers, hardBounces). The recipientsType field is required and determines which subset of recipients to export. An optional notifyURL webhook will be called once the export is complete, and the response returns a processId to track the export status. +
+
+
+
+ #### πŸ”Œ Usage
@@ -15585,6 +16606,20 @@ $client->emailCampaigns->emailExportRecipients(
+#### πŸ“ Description + +
+
+ +
+
+ +Send an existing email campaign immediately by scheduling it for the current time. The campaign must have valid recipients and content configured before sending. The system verifies your account''s send limit and credit balance before dispatching; if credits are insufficient, a 402 error is returned. +
+
+
+
+ #### πŸ”Œ Usage
@@ -15701,6 +16736,20 @@ $client->emailCampaigns->sendReport(
+#### πŸ“ Description + +
+
+ +
+
+ +Send a test version of an email campaign to specified email addresses or your entire test list. If the emailTo array is left empty, the test mail will be sent to all addresses in your test list. You can send a maximum of 50 test emails per day. +
+
+
+
+ #### πŸ”Œ Usage
@@ -15810,6 +16859,20 @@ $client->emailCampaigns->getSharedTemplateUrl(
+#### πŸ“ Description + +
+
+ +
+
+ +Update the status of an email campaign, such as suspending, archiving, or replicating it. Available status values include suspended, archive, darchive, sent, queued, replicate, replicateTemplate, cancel, and draft. Note that the replicateTemplate status is only available for template type campaigns. +
+
+
+
+ #### πŸ”Œ Usage
@@ -15864,7 +16927,7 @@ $client->emailCampaigns->updateCampaignStatus(
-#### πŸ”Œ Usage +#### πŸ“ Description
@@ -15872,17 +16935,13 @@ $client->emailCampaigns->updateCampaignStatus(
-```php -$client->smsCampaigns->getSmsCampaigns( - new GetSmsCampaignsRequest([]), -); -``` +Retrieve a paginated list of all your SMS campaigns with their statistics and recipient information. Results can be filtered by status and date range, with a default limit of 500 and maximum of 1000 per page. The sort order defaults to descending by creation date; date filters are only available when status is not passed or is set to sent.
-#### βš™οΈ Parameters +#### πŸ”Œ Usage
@@ -15890,15 +16949,25 @@ $client->smsCampaigns->getSmsCampaigns(
-**$status:** `?string` β€” Status of campaign. - -
+```php +$client->smsCampaigns->getSmsCampaigns( + new GetSmsCampaignsRequest([]), +); +``` +
+
+
+#### βš™οΈ Parameters + +
+
+
-**$startDate:** `?string` β€” **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) +**$status:** `?string` β€” Status of campaign.
@@ -15906,7 +16975,7 @@ $client->smsCampaigns->getSmsCampaigns(
-**$endDate:** `?string` β€” **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) +**$startDate:** `?string` β€” **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent SMS campaigns. **Prefer to pass your timezone in date-time format for accurate result.** Only available if `status` is not passed or is set to `sent`. `startDate` must not be in the future.
@@ -15914,7 +16983,15 @@ $client->smsCampaigns->getSmsCampaigns(
-**$limit:** `?int` β€” Number limitation for the result returned +**$endDate:** `?string` β€” **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent SMS campaigns. **Prefer to pass your timezone in date-time format for accurate result.** Only available if `status` is not passed or is set to `sent`. `endDate` must not be in the future. + +
+
+ +
+
+ +**$limit:** `?int` β€” Number of documents per page
@@ -15946,6 +17023,20 @@ $client->smsCampaigns->getSmsCampaigns(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new SMS campaign with the required name, sender, and content fields. The sender name is limited to 11 alphanumeric characters or 15 numeric characters, and the content should stay within 160 characters per SMS segment. If a scheduledAt date is provided, listIds in recipients become mandatory; accounts under validation are limited to 4 total campaigns and campaigns with more than 10 recipients will be saved as draft. +
+
+
+
+ #### πŸ”Œ Usage
@@ -16048,6 +17139,20 @@ $client->smsCampaigns->createSmsCampaign(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve detailed information about a specific SMS campaign by its ID, including campaign content, sender, recipients with list names, statistics (delivered, sent, bounces, unsubscriptions, answered), and tags. Unlike the list endpoint, recipients are returned as objects with id and name fields rather than plain IDs. +
+
+
+
+ #### πŸ”Œ Usage
@@ -16090,6 +17195,20 @@ $client->smsCampaigns->getSmsCampaign(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing SMS campaign''s properties such as name, sender, content, recipients, scheduled date, organisation prefix, and unsubscribe instructions. The request body must contain at least one valid field to update. The campaign must exist and must be of type SMS; if a scheduledAt is provided, valid recipients must be present either in the request or already configured on the campaign. +
+
+
+
+ #### πŸ”Œ Usage
@@ -16197,6 +17316,20 @@ $client->smsCampaigns->updateSmsCampaign(
+#### πŸ“ Description + +
+
+ +
+
+ +Delete an SMS campaign by its campaign ID. Only campaigns that have not been scheduled or sent can be deleted; attempting to delete a campaign that is queued, in process, or has been sent with recipients will return a 403 permission denied error. +
+
+
+
+ #### πŸ”Œ Usage
@@ -16314,6 +17447,20 @@ $client->smsCampaigns->requestSmsRecipientExport(
+#### πŸ“ Description + +
+
+ +
+
+ +Send an existing SMS campaign immediately by scheduling it for the current time. The system verifies your account''s SMS credit balance before dispatching; if credits are insufficient or the remaining credit is less than the number of recipients, a 402 error is returned. The campaign must have valid recipients and content already configured. +
+
+
+
+ #### πŸ”Œ Usage
@@ -16430,6 +17577,20 @@ $client->smsCampaigns->sendSmsReport(
+#### πŸ“ Description + +
+
+ +
+
+ +Send a test SMS to a specified phone number to preview the campaign before sending it to all recipients. The phone number must belong to one of your existing contacts in your Brevo account and must not be blacklisted. The number should include the country code (e.g. 33689965433). +
+
+
+
+ #### πŸ”Œ Usage
@@ -16481,6 +17642,20 @@ $client->smsCampaigns->sendTestSms(
+#### πŸ“ Description + +
+
+ +
+
+ +Update the status of an SMS campaign, such as suspending, archiving, or replicating it. Available status values include suspended, archive, darchive, sent, queued, replicate, replicateTemplate, cancel, and draft. Note that the replicateTemplate status is only available for template type campaigns. +
+
+
+
+ #### πŸ”Œ Usage
@@ -16535,6 +17710,20 @@ $client->smsCampaigns->updateSmsCampaignStatus(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of all your WhatsApp campaigns with their statistics and metadata. Results can be filtered by creation date range using startDate and endDate, with a default limit of 50 and maximum of 100 per page. The sort order defaults to descending by modification date. +
+
+
+
+ #### πŸ”Œ Usage
@@ -16851,6 +18040,20 @@ Language of the template. For Example :
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of all your WhatsApp templates with their status, category, language, and metadata. Results can be filtered by creation date range and optionally by source (Automation or Conversations), with a default limit of 50 and maximum of 100 per page. The sort order defaults to descending by modification date. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17143,6 +18346,20 @@ $client->whatsAppCampaigns->updateWhatsAppCampaign(
+#### πŸ“ Description + +
+
+ +
+
+ +Delete a WhatsApp campaign by its campaign ID. The campaign must exist; if the campaign ID is not found, a 404 error is returned. This action is permanent and cannot be undone. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17186,6 +18403,20 @@ $client->whatsAppCampaigns->deleteWhatsAppCampaign(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of companies with optional filtering, sorting, and search capabilities. Results are sorted by creation date in descending order by default, and can be filtered by attributes, linked contacts, linked deals, or modification/creation timestamps. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17212,7 +18443,7 @@ $client->companies->getAllCompanies(
-**$filters:** `?string` β€” Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"} +**$filtersAttributesName:** `?string` β€” Filter by attributes. If you have a filter for the owner on your side please send it as filters[attributes.owner] and utilize the account email for the filtering.
@@ -17236,7 +18467,7 @@ $client->companies->getAllCompanies(
-**$modifiedSince:** `?string` β€” Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. +**$modifiedSince:** `?string` β€” Filter (urlencoded) the companies modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.
@@ -17244,7 +18475,7 @@ $client->companies->getAllCompanies(
-**$createdSince:** `?string` β€” Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. +**$createdSince:** `?string` β€” Filter (urlencoded) the companies created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.
@@ -17292,6 +18523,20 @@ $client->companies->getAllCompanies(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new CRM company with the specified name, attributes, and optional associations to contacts and deals. The company name is required, and you can optionally provide a country code when a phone number attribute is included. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17411,6 +18656,20 @@ $client->companies->importCompaniesCreationAndUpdation(
+#### πŸ“ Description + +
+
+ +
+
+ +Link or unlink contacts and deals with a specific company in a single request. You can simultaneously link new contacts/deals and unlink existing ones by providing the respective ID arrays in the request body. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17486,6 +18745,20 @@ $client->companies->linkAndUnlinkCompanyWithContactAndDeal(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the full details of a single company by its identifier, including its attributes, linked contacts, and linked deals. Returns a 404 error if the company does not exist, or a 403 error if the user lacks permission to view the company. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17528,6 +18801,20 @@ $client->companies->getACompany(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete a company by its identifier. The requesting user must be the company owner or have manage permission on companies; otherwise, a 403 Forbidden error is returned. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17570,6 +18857,20 @@ $client->companies->deleteACompany(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing company''s attributes, name, linked contacts, or linked deals. Note that passing `linkedContactsIds` or `linkedDealsIds` replaces the entire list of associations, so omitted IDs will be removed. The company name cannot be set to an empty string. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17629,7 +18930,7 @@ $client->companies->updateACompany(
-**$linkedDealsIds:** `?array` β€” Warning - Using PATCH on linkedDealsIds replaces the list of linked contacts. Omitted IDs will be removed. +**$linkedDealsIds:** `?array` β€” Warning - Using PATCH on linkedDealsIds replaces the list of linked deals. Omitted IDs will be removed.
@@ -17653,6 +18954,20 @@ $client->companies->updateACompany(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new custom attribute for companies or deals. The attribute label must be unique within the object type, cannot exceed 50 characters, and cannot use reserved names. For `single-select` or `multi-choice` attribute types, you must also provide the `optionsLabels` array. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17707,7 +19022,7 @@ $client->companies->createACompanyDealAttribute(
-**$objectType:** `string` β€” The type of object the attribute belongs to (prefilled with `companies`, mandatory) +**$objectType:** `string` β€” The type of object the attribute belongs to. Must be either `companies` or `deals`.
@@ -17731,7 +19046,7 @@ $client->companies->createACompanyDealAttribute(
-#### πŸ”Œ Usage +#### πŸ“ Description
@@ -17739,17 +19054,13 @@ $client->companies->createACompanyDealAttribute(
-```php -$client->companies->deleteAnAttribute( - 'id', -); -``` +Delete an existing custom attribute by its identifier. This permanently removes the attribute definition and cleans up all references to it across companies or deals. System-default and non-editable attributes cannot be deleted.
-#### βš™οΈ Parameters +#### πŸ”Œ Usage
@@ -17757,9 +19068,27 @@ $client->companies->deleteAnAttribute(
-**$id:** `string` β€” Attribute ID - -
+```php +$client->companies->deleteAnAttribute( + 'id', +); +``` +
+
+
+
+ +#### βš™οΈ Parameters + +
+
+ +
+
+ +**$id:** `string` β€” Attribute ID + +
@@ -17773,6 +19102,20 @@ $client->companies->deleteAnAttribute(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing custom attribute''s label or options. You can rename the attribute label or modify the available options for `single-select` and `multi-choice` attribute types. System-default attributes cannot be modified except for specific editable fields. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17840,6 +19183,20 @@ $client->companies->updateAnAttribute(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the list of all attributes defined for companies, including both system-default and custom attributes. Each attribute includes its label, internal name, type, required status, and available options for select-type attributes. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17866,6 +19223,20 @@ $client->companies->getCompanyAttributes();
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the list of all attributes defined for deals, including both system-default and custom attributes. Each attribute includes its label, internal name, type, required status, and available options for select-type attributes. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17891,6 +19262,20 @@ $client->deals->getDealAttributes();
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of deals with optional filtering, sorting, and search capabilities. Results can be filtered by attributes such as deal name or owner, linked companies, linked contacts, or modification/creation timestamps. Default sort order is descending by creation date. +
+
+
+
+ #### πŸ”Œ Usage
@@ -17933,7 +19318,7 @@ $client->deals->getAllDeals(
-**$filtersLinkedContactsIds:** `?string` β€” Filter by linked companies ids +**$filtersLinkedContactsIds:** `?string` β€” Filter by linked contacts ids
@@ -17941,7 +19326,7 @@ $client->deals->getAllDeals(
-**$modifiedSince:** `?string` β€” Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. +**$modifiedSince:** `?string` β€” Filter (urlencoded) the deals modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.
@@ -17949,7 +19334,7 @@ $client->deals->getAllDeals(
-**$createdSince:** `?string` β€” Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. +**$createdSince:** `?string` β€” Filter (urlencoded) the deals created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result.
@@ -17975,6 +19360,14 @@ $client->deals->getAllDeals( **$sort:** `?string` β€” Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed +
+
+ +
+
+ +**$sortBy:** `?string` β€” The field used to sort field names. +
@@ -17989,6 +19382,20 @@ $client->deals->getAllDeals(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new deal in the CRM with the specified name, attributes, and optional associations to contacts and companies. You can assign the deal to a specific pipeline and stage by providing `pipeline` and `deal_stage` attribute IDs, which can be retrieved from the pipeline details endpoint. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18100,6 +19507,20 @@ $client->deals->importDealsCreationAndUpdation(
+#### πŸ“ Description + +
+
+ +
+
+ +Link or unlink contacts and companies with a specific deal in a single request. You can simultaneously link new contacts/companies and unlink existing ones by providing the respective ID arrays in the request body. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18175,6 +19596,20 @@ $client->deals->linkAndUnlinkADealWithContactsAndCompanies(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the full details of a single deal by its identifier, including its attributes, pipeline stage, linked contacts, and linked companies. Returns a 404 error if the deal does not exist. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18217,6 +19652,20 @@ $client->deals->getADeal(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete a deal by its identifier. The requesting user must be the deal owner or have manage permission on deals; otherwise, a 403 Forbidden error is returned. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18259,6 +19708,20 @@ $client->deals->deleteADeal(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing deal''s attributes, name, linked contacts, or linked companies. Note that passing `linkedContactsIds` or `linkedCompaniesIds` replaces the entire list of associations, so omitted IDs will be removed. To move a deal to a different pipeline or stage, provide both the `pipeline` and `deal_stage` attribute IDs. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18302,7 +19765,7 @@ $client->deals->updateADeal(
-**$linkedCompaniesIds:** `?array` β€” Warning - Using PATCH on linkedCompaniesIds replaces the list of linked contacts. Omitted IDs will be removed. +**$linkedCompaniesIds:** `?array` β€” Warning - Using PATCH on linkedCompaniesIds replaces the list of linked companies. Omitted IDs will be removed.
@@ -18373,6 +19836,20 @@ $client->deals->getPipelineStages();
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the list of all deal pipelines configured for your account, including each pipeline''s stages and settings. If no pipelines have been configured yet, a default pipeline is automatically created and returned. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18398,6 +19875,20 @@ $client->deals->getAllPipelines();
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the details of a specific deal pipeline by its identifier, including its stages, stage ordering, and configuration. Use this endpoint to obtain the pipeline and stage IDs needed when creating or updating deals. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18441,6 +19932,20 @@ $client->deals->getAPipeline(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of CRM files with optional filtering by entity type, entity IDs, and date range. Results are sorted by creation date in descending order by default, with a default limit of 50 files per page. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18531,6 +20036,20 @@ $client->files->getAllFiles(
+#### πŸ“ Description + +
+
+ +
+
+ +Upload a file and associate it with a contact, company, or deal. The file must be sent as multipart form data with a maximum size of 10 MB. You can optionally link the file to a specific entity by providing the corresponding entity ID. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18560,6 +20079,20 @@ $client->files->uploadAFile(
+#### πŸ“ Description + +
+
+ +
+
+ +Get a temporary download URL for a CRM file by its identifier. The returned URL is valid for 5 minutes only and provides direct access to the file content. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18602,6 +20135,20 @@ $client->files->downloadAFile(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete a CRM file by its identifier. This removes the file from storage and unlinks it from any associated contacts, companies, or deals. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18644,6 +20191,20 @@ $client->files->deleteAFile(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the metadata and details of a specific CRM file by its identifier. This returns information such as the file name, size, type, creation date, and associated entities, but does not include the file content itself. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18687,6 +20248,20 @@ $client->files->getFileDetails(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of CRM notes with optional filtering by entity type, entity IDs, and date range. Results are sorted by creation date in descending order by default, with a default limit of 50 notes per page. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18777,6 +20352,20 @@ $client->notes->getAllNotes(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new CRM note and optionally associate it with contacts, companies, or deals. The note text content is required, and you can link the note to multiple entities simultaneously during creation. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18788,7 +20377,7 @@ $client->notes->getAllNotes( ```php $client->notes->createANote( new NoteData([ - 'text' => 'In communication with client_dev for resolution of queries.', + 'text' => '

Meeting notes: Action item - visit Brevo for details.

', ]), ); ``` @@ -18821,6 +20410,20 @@ $client->notes->createANote(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the full details of a single CRM note by its identifier. The response includes the note''s text content, creation date, author, and any associated contacts, companies, or deals. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18863,6 +20466,20 @@ $client->notes->getANote(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete a CRM note by its identifier. This removes the note and unlinks it from any associated contacts, companies, or deals. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18905,6 +20522,20 @@ $client->notes->deleteANote(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing CRM note''s text content and its associations with contacts, companies, or deals. You can modify the note text, change the pinned status, or update the linked entities. +
+
+
+
+ #### πŸ”Œ Usage
@@ -18918,7 +20549,7 @@ $client->notes->updateANote( 'id', new PatchCrmNotesIdRequest([ 'body' => new NoteData([ - 'text' => 'In communication with client_dev for resolution of queries.', + 'text' => '

Meeting notes: Action item - visit Brevo for details.

', ]), ]), ); @@ -18961,6 +20592,20 @@ $client->notes->updateANote(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of CRM tasks with optional filtering by task type, status, date range, assignee, and linked entities (contacts, deals, companies). Results are sorted by creation date in descending order by default, with a default limit of 50 tasks per page. +
+
+
+
+ #### πŸ”Œ Usage
@@ -19101,6 +20746,20 @@ $client->tasks->getAllTasks(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new CRM task with the specified name, type, due date, and optional associations to contacts, companies, or deals. A task requires a name, task type ID, and due date at minimum. You can also set a duration, notes, a reminder, and assign the task to a specific user. +
+
+
+
+ #### πŸ”Œ Usage
@@ -19113,7 +20772,7 @@ $client->tasks->getAllTasks( $client->tasks->createATask( new PostCrmTasksRequest([ 'date' => new DateTime('2021-11-01T17:44:54Z'), - 'name' => 'Task: Connect with client_dev', + 'name' => 'Task: Connect with client', 'taskTypeId' => '61a5cd07ca1347c82306ad09', ]), ); @@ -19227,6 +20886,20 @@ $client->tasks->createATask(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the full details of a single CRM task by its identifier. The response includes the task''s name, type, status, due date, duration, notes, assignee, reminder settings, and linked contacts, companies, or deals. +
+
+
+
+ #### πŸ”Œ Usage
@@ -19269,6 +20942,20 @@ $client->tasks->getATask(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete a CRM task by its identifier. This removes the task and cancels any associated reminders. The requesting user must be the task assignee or have manage permission on tasks. +
+
+
+
+ #### πŸ”Œ Usage
@@ -19305,11 +20992,25 @@ $client->tasks->deleteATask(
- - -
$client->tasks->updateATask($id, $request) -
-
+
+ +
$client->tasks->updateATask($id, $request) +
+
+ +#### πŸ“ Description + +
+
+ +
+
+ +Update an existing CRM task''s properties such as name, type, due date, status, duration, notes, assignee, reminder, or linked entities. Only the fields provided in the request body will be updated; omitted fields remain unchanged. +
+
+
+
#### πŸ”Œ Usage @@ -19438,10 +21139,24 @@ $client->tasks->updateATask(
-
$client->tasks->getAllTaskTypes() -> ?GetCrmTasktypesResponse +
$client->tasks->getAllTaskTypes() -> ?array +
+
+ +#### πŸ“ Description + +
+
+
+Retrieve the list of all available task types, such as Email, Call, Meeting, Todo, Lunch, Deadline, and LinkedIn. If no task types exist yet, the default set is automatically created and returned. Use the task type ID when creating or updating tasks. +
+
+
+
+ #### πŸ”Œ Usage
@@ -19645,6 +21360,20 @@ $client->transactionalWhatsApp->getWhatsappEventReport(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of transactional contacts that have been blocked or unsubscribed, along with the reason for blocking (e.g. hard bounce, admin blocked, spam complaint, or unsubscription via email/API/Marketing Automation). Both `startDate` and `endDate` must be provided together when filtering by date range, and neither date can be in the future. Results default to 50 per page (max 100) and are sorted in descending order of record creation unless overridden with the `sort` parameter. +
+
+
+
+ #### πŸ”Œ Usage
@@ -19727,6 +21456,20 @@ $client->transactionalEmails->getTransacBlockedContacts(
+#### πŸ“ Description + +
+
+ +
+
+ +Unblock or resubscribe a transactional contact by removing their email address from the blacklist. The email address must be URL-encoded in the path parameter and must be a valid email format. If the contact is not found in the blocklist, a 404 error is returned. +
+
+
+
+ #### πŸ”Œ Usage
@@ -19994,6 +21737,20 @@ $client->transactionalEmails->deleteHardbounces(
+#### πŸ“ Description + +
+
+ +
+
+ +Send a transactional email to one or more recipients, either using inline HTML content or a pre-built template via `templateId`. You can schedule emails for future delivery using `scheduledAt` (UTC, up to 5-minute delay), send multiple personalized versions with `messageVersions` (max 2000 total recipients, 99 per version), and attach files via URL or base64-encoded content. A `sender` and `subject` are required when no `templateId` is provided; when a `templateId` is used, the template''s sender and subject are applied unless overridden. +
+
+
+
+ #### πŸ”Œ Usage
@@ -20209,7 +21966,7 @@ $client->transactionalEmails->deleteScheduledEmailById(
-**$identifier:** `string` β€” The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. +**$identifier:** `string` β€” The `batchId` of scheduled emails batch (must be a valid UUIDv4) or the `messageId` of scheduled email (enclosed in angle brackets with @ sign, e.g. `<...@domain>`).
@@ -20269,7 +22026,7 @@ $client->transactionalEmails->getScheduledEmailById(
-**$identifier:** `string` β€” The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. +**$identifier:** `string` β€” The `batchId` of scheduled emails batch (must be a valid UUIDv4) or the `messageId` of scheduled email (enclosed in angle brackets with @ sign, e.g. `<...@domain>`). When using `messageId`, the `limit`, `offset`, `sort`, and `status` query parameters are ignored.
@@ -20277,7 +22034,7 @@ $client->transactionalEmails->getScheduledEmailById(
-**$startDate:** `?DateTime` β€” Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. +**$startDate:** `?DateTime` β€” Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Cannot be more than 30 days older than the current date.
@@ -20499,10 +22256,24 @@ $client->transactionalEmails->getTransacEmailContent(
-
$client->transactionalEmails->deleteAnSmtpTransactionalLog($identifier) +
$client->transactionalEmails->deleteAnSmtpTransactionalLog($identifier, $request) +
+
+ +#### πŸ“ Description + +
+
+
+Delete SMTP transactional log entries identified by a message ID (enclosed in angle brackets with an @ sign) or a valid email address. Optionally narrow the deletion to a specific date range using `from_date` and `to_date` query parameters (YYYY-MM-DD format). The operation also removes any associated stored email preview content. +
+
+
+
+ #### πŸ”Œ Usage
@@ -20514,6 +22285,7 @@ $client->transactionalEmails->getTransacEmailContent( ```php $client->transactionalEmails->deleteAnSmtpTransactionalLog( 'identifier', + new DeleteSmtpLogIdentifierRequest([]), ); ```
@@ -20529,7 +22301,23 @@ $client->transactionalEmails->deleteAnSmtpTransactionalLog(
-**$identifier:** `string` β€” MessageId of the transactional log(s) to delete +**$identifier:** `string` β€” MessageId or email address of the transactional log(s) to delete. Must be a valid message ID (enclosed in angle brackets with @ sign) or a valid email address. + +
+
+ +
+
+ +**$fromDate:** `?string` β€” Starting date (YYYY-MM-DD) to narrow down logs for deletion + +
+
+ +
+
+ +**$toDate:** `?string` β€” Ending date (YYYY-MM-DD) to narrow down logs for deletion
@@ -20601,7 +22389,7 @@ $client->transactionalEmails->getAggregatedSmtpReport(
-**$days:** `?int` β€” Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ +**$days:** `?int` β€” Number of days in the past including today (positive integer, maximum 90). _Not compatible with 'startDate' and 'endDate'_. Defaults to 90 if neither dates nor days are provided.
@@ -20697,7 +22485,7 @@ $client->transactionalEmails->getEmailEventReport(
-**$days:** `?int` β€” Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ +**$days:** `?int` β€” Number of days in the past including today (positive integer, maximum 90). _Not compatible with 'startDate' and 'endDate'_. Defaults to 30 if neither dates nor days are provided.
@@ -20761,6 +22549,20 @@ $client->transactionalEmails->getEmailEventReport(
+#### πŸ“ Description + +
+
+ +
+
+ +This endpoint will show the aggregated stats per day for the past 10 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 30 days. +
+
+
+
+ #### πŸ”Œ Usage
@@ -20819,7 +22621,7 @@ $client->transactionalEmails->getSmtpReport(
-**$days:** `?int` β€” Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ +**$days:** `?int` β€” Number of days in the past including today (positive integer, maximum 30). _Not compatible with 'startDate' and 'endDate'_
@@ -20851,6 +22653,20 @@ $client->transactionalEmails->getSmtpReport(
+#### πŸ“ Description + +
+
+ +
+
+ +Generate a fully rendered preview of a transactional email template by resolving dynamic variables. Provide either an `email` address (to populate variables from the contact''s attributes) or a `params` object with key-value pairs for manual substitution; at least one of these is required alongside the mandatory `templateId`. The response includes the rendered HTML, subject, sender details, preview text, and any feed names used in the template. +
+
+
+
+ #### πŸ”Œ Usage
@@ -20895,6 +22711,20 @@ $client->transactionalEmails->postPreviewSmtpEmailTemplates(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of all transactional email templates (including automation templates) with their details such as name, subject, sender, status, HTML content, and timestamps. Results default to 50 per page (max 1000) and are sorted in descending creation order unless overridden. You can filter by active/inactive status using `templateStatus` and by editor type using `editorType` (currently only `richTextEditor` is supported). +
+
+
+
+ #### πŸ”Œ Usage
@@ -20947,6 +22777,14 @@ $client->transactionalEmails->getSmtpTemplates( **$sort:** `?string` β€” Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed +
+
+ +
+
+ +**$editorType:** `?string` β€” Filter on the editor type used to create the template. Currently only `richTextEditor` is supported as a filter value. +
@@ -20961,6 +22799,20 @@ $client->transactionalEmails->getSmtpTemplates(
+#### πŸ“ Description + +
+
+ +
+
+ +Create a new transactional email template with the specified sender, subject, and content. The `sender`, `subject`, and `templateName` fields are required. Template content can be provided via `htmlContent` (minimum 10 characters) or `htmlUrl`; at least one must be supplied. Templates are created as inactive by default unless `isActive` is explicitly set to `true`. +
+
+
+
+ #### πŸ”Œ Usage
@@ -21079,6 +22931,20 @@ $client->transactionalEmails->createSmtpTemplate(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve the full details of a specific transactional email template by its numeric ID or custom template identifier string. The response includes the template name, subject, sender information, HTML content, active status, creation and modification timestamps, reply-to address, tag, and a `doiTemplate` flag indicating whether the template is a double opt-in template (detected by the presence of optin-related tags or variables in the content). +
+
+
+
+ #### πŸ”Œ Usage
@@ -21105,7 +22971,7 @@ $client->transactionalEmails->getSmtpTemplate(
-**$templateId:** `int` β€” id of the template +**$templateId:** `int|string` β€” ID of the template. Can be a numeric template ID or a custom template identifier string (alphanumeric, hyphens, and underscores only, max 64 characters, must start with a letter).
@@ -21121,6 +22987,20 @@ $client->transactionalEmails->getSmtpTemplate(
+#### πŸ“ Description + +
+
+ +
+
+ +Update an existing transactional email template by its numeric ID or custom template identifier string. All fields in the request body are optional; only the provided fields will be updated. You can update the template name, subject, sender, reply-to address, HTML content (via `htmlContent` or `htmlUrl`), active status, tag, attachment URL, and the personalized `toField`. Only one of sender email or sender ID should be provided per request. +
+
+
+
+ #### πŸ”Œ Usage
@@ -21148,7 +23028,7 @@ $client->transactionalEmails->updateSmtpTemplate(
-**$templateId:** `int` β€” id of the template +**$templateId:** `int|string` β€” ID of the template. Can be a numeric template ID or a custom template identifier string.
@@ -21244,6 +23124,20 @@ $client->transactionalEmails->updateSmtpTemplate(
+#### πŸ“ Description + +
+
+ +
+
+ +Permanently delete a transactional email template by its numeric ID. Only inactive templates can be deleted; attempting to delete an active template returns a 405 error. To deactivate a template before deletion, use `PUT /smtp/templates/{templateId}` with `isActive` set to `false`. Deletion also removes associated newsletter template data and triggers asynchronous cleanup of shared assets. +
+
+
+
+ #### πŸ”Œ Usage
@@ -21286,6 +23180,20 @@ $client->transactionalEmails->deleteSmtpTemplate(
+#### πŸ“ Description + +
+
+ +
+
+ +Send a test email of the specified transactional template to one or more recipients. Provide an array of email addresses in the `emailTo` field; if left empty, the test mail is sent to your entire test list. You can send a maximum of 50 test emails per day, and all provided email addresses must be valid. +
+
+
+
+ #### πŸ”Œ Usage
@@ -21401,6 +23309,20 @@ $client->transactionalSms->sendAsyncTransactionalSms(
+#### πŸ“ Description + +
+
+ +
+
+ +Send a transactional SMS message to a single mobile number. The `sender`, `recipient`, and either `content` or `templateId` fields are required. The sender name is limited to 11 alphanumeric characters or 15 numeric characters, and the recipient must be a valid international phone number (6-15 digits, optional leading +). Tags can be a string or an array of up to 10 strings. The SMS type defaults to `transactional` but can be set to `marketing`; if the content includes a stop code, it is automatically treated as marketing. Returns the message ID, SMS count, credits used, and remaining credits. +
+
+
+
+ #### πŸ”Œ Usage
@@ -21446,6 +23368,20 @@ $client->transactionalSms->sendTransacSms(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve an aggregated report of your transactional SMS activity over a specified time period, including counts for requests, delivered, hard bounces, soft bounces, blocked, unsubscribed, replied, accepted, rejected, and skipped messages. Filter by date range using `startDate` and `endDate` (both required together, YYYY-MM-DD format) or by a number of past `days` (not compatible with date range). You can further narrow results by `tag`. If no date filter is provided, the report covers all available data and returns the auto-detected date range. +
+
+
+
+ #### πŸ”Œ Usage
@@ -21512,6 +23448,20 @@ $client->transactionalSms->getTransacAggregatedSmsReport(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a paginated list of individual SMS event records (unaggregated), including event type, phone number, message ID, timestamp, tag, and reason or reply content where applicable. Results default to 50 per page (max 100) and are sorted in descending order unless overridden. Filter by date range (`startDate`/`endDate`), past `days` (not compatible with date range), specific `event` type (e.g. delivered, bounces, replies), `phoneNumber`, or `tags`. Bounce events include the failure reason, and reply events include the reply content. +
+
+
+
+ #### πŸ”Œ Usage
@@ -21618,6 +23568,20 @@ $client->transactionalSms->getSmsEvents(
+#### πŸ“ Description + +
+
+ +
+
+ +Retrieve a day-by-day breakdown of your transactional SMS activity, with each entry containing the date and counts for requests, delivered, hard bounces, soft bounces, blocked, unsubscribed, replied, accepted, rejected, and skipped messages. Filter by date range using `startDate` and `endDate` (both required together, YYYY-MM-DD format), by a number of past `days` (not compatible with date range), or by `tag`. Results are sorted in descending order by default unless overridden with the `sort` parameter. +
+
+
+
+ #### πŸ”Œ Usage
diff --git a/src/Account/AccountClient.php b/src/Account/AccountClient.php index 938c0d17..d91b3c3c 100644 --- a/src/Account/AccountClient.php +++ b/src/Account/AccountClient.php @@ -59,25 +59,22 @@ public function __construct( * - Check plan details (type, credits, expiration) * - Get relay information (for transactional emails) * - Check Marketing Automation status - * - View date/time preferences and account settings * - Access organization and user identifiers * * **Key information returned:** * - Complete account details (organization ID, user ID, company information) * - Address and contact information * - Plan configurations and credit allocations across different verticals - * - Marketing Automation settings and tracker key + * - Marketing Automation settings and tracker key (when enabled) * - SMTP relay configuration for transactional emails - * - Date/time preferences and account settings * - Enterprise features availability status * * **Important considerations:** * - Provides comprehensive account overview for billing and configuration management * - Essential for understanding current plan limitations and feature availability - * - Marketing Automation key required for advanced automation features - * - Plan verticals show detailed breakdown across Marketing, Chat, and CRM categories + * - Marketing Automation key is only returned when Marketing Automation is enabled on the account + * - Plan verticals show detailed breakdown across Marketing, Chat, and CRM categories (only returned when plan verticals are available) * - Relay configuration crucial for transactional email setup and deliverability - * - Date/time preferences affect campaign scheduling and reporting displays * - Enterprise status determines access to advanced features and sub-account management * * @param ?array{ diff --git a/src/Account/AccountClientInterface.php b/src/Account/AccountClientInterface.php index 131b5527..cd76637b 100644 --- a/src/Account/AccountClientInterface.php +++ b/src/Account/AccountClientInterface.php @@ -16,25 +16,22 @@ interface AccountClientInterface * - Check plan details (type, credits, expiration) * - Get relay information (for transactional emails) * - Check Marketing Automation status - * - View date/time preferences and account settings * - Access organization and user identifiers * * **Key information returned:** * - Complete account details (organization ID, user ID, company information) * - Address and contact information * - Plan configurations and credit allocations across different verticals - * - Marketing Automation settings and tracker key + * - Marketing Automation settings and tracker key (when enabled) * - SMTP relay configuration for transactional emails - * - Date/time preferences and account settings * - Enterprise features availability status * * **Important considerations:** * - Provides comprehensive account overview for billing and configuration management * - Essential for understanding current plan limitations and feature availability - * - Marketing Automation key required for advanced automation features - * - Plan verticals show detailed breakdown across Marketing, Chat, and CRM categories + * - Marketing Automation key is only returned when Marketing Automation is enabled on the account + * - Plan verticals show detailed breakdown across Marketing, Chat, and CRM categories (only returned when plan verticals are available) * - Relay configuration crucial for transactional email setup and deliverability - * - Date/time preferences affect campaign scheduling and reporting displays * - Enterprise status determines access to advanced features and sub-account management * * @param ?array{ diff --git a/src/Account/Types/GetAccountResponse.php b/src/Account/Types/GetAccountResponse.php index 31eec5d6..47ee4701 100644 --- a/src/Account/Types/GetAccountResponse.php +++ b/src/Account/Types/GetAccountResponse.php @@ -51,16 +51,10 @@ class GetAccountResponse extends JsonSerializableType public string $lastName; /** - * @var GetAccountResponseAddress $address Address informations + * @var ?GetAccountResponseAddress $address Address informations */ #[JsonProperty('address')] - public GetAccountResponseAddress $address; - - /** - * @var GetAccountResponseDateTimePreferences $dateTimePreferences User's date and time preferences - */ - #[JsonProperty('dateTimePreferences')] - public GetAccountResponseDateTimePreferences $dateTimePreferences; + public ?GetAccountResponseAddress $address; /** * @var ?GetAccountResponseMarketingAutomation $marketingAutomation @@ -95,10 +89,9 @@ class GetAccountResponse extends JsonSerializableType * email: string, * firstName: string, * lastName: string, - * address: GetAccountResponseAddress, - * dateTimePreferences: GetAccountResponseDateTimePreferences, * plan: array, * relay: GetAccountResponseRelay, + * address?: ?GetAccountResponseAddress, * marketingAutomation?: ?GetAccountResponseMarketingAutomation, * planVerticals?: ?array, * } $values @@ -113,8 +106,7 @@ public function __construct( $this->email = $values['email']; $this->firstName = $values['firstName']; $this->lastName = $values['lastName']; - $this->address = $values['address']; - $this->dateTimePreferences = $values['dateTimePreferences']; + $this->address = $values['address'] ?? null; $this->marketingAutomation = $values['marketingAutomation'] ?? null; $this->plan = $values['plan']; $this->planVerticals = $values['planVerticals'] ?? null; diff --git a/src/Account/Types/GetAccountResponseDateTimePreferences.php b/src/Account/Types/GetAccountResponseDateTimePreferences.php deleted file mode 100644 index d5b4c428..00000000 --- a/src/Account/Types/GetAccountResponseDateTimePreferences.php +++ /dev/null @@ -1,53 +0,0 @@ -timezone = $values['timezone']; - $this->timeFormat = $values['timeFormat']; - $this->dateFormat = $values['dateFormat']; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Account/Types/GetAccountResponsePlanVerticalsItem.php b/src/Account/Types/GetAccountResponsePlanVerticalsItem.php index a2a92912..6dfb12de 100644 --- a/src/Account/Types/GetAccountResponsePlanVerticalsItem.php +++ b/src/Account/Types/GetAccountResponsePlanVerticalsItem.php @@ -32,16 +32,16 @@ class GetAccountResponsePlanVerticalsItem extends JsonSerializableType public string $status; /** - * @var string $startDate Plan start date (Unix timestamp) + * @var ?string $startDate Plan start date (Unix timestamp) */ #[JsonProperty('startDate')] - public string $startDate; + public ?string $startDate; /** - * @var string $endDate Plan end date (Unix timestamp) + * @var ?string $endDate Plan end date (Unix timestamp) */ #[JsonProperty('endDate')] - public string $endDate; + public ?string $endDate; /** * @var ?GetAccountResponsePlanVerticalsItemUsers $users User seat information for the plan @@ -61,8 +61,8 @@ class GetAccountResponsePlanVerticalsItem extends JsonSerializableType * planType: string, * name: string, * status: value-of, - * startDate: string, - * endDate: string, + * startDate?: ?string, + * endDate?: ?string, * users?: ?GetAccountResponsePlanVerticalsItemUsers, * credits?: ?string, * } $values @@ -74,8 +74,8 @@ public function __construct( $this->planType = $values['planType']; $this->name = $values['name']; $this->status = $values['status']; - $this->startDate = $values['startDate']; - $this->endDate = $values['endDate']; + $this->startDate = $values['startDate'] ?? null; + $this->endDate = $values['endDate'] ?? null; $this->users = $values['users'] ?? null; $this->credits = $values['credits'] ?? null; } diff --git a/src/Balance/BalanceClient.php b/src/Balance/BalanceClient.php index 5f0b824f..3252c9ed 100644 --- a/src/Balance/BalanceClient.php +++ b/src/Balance/BalanceClient.php @@ -5,7 +5,7 @@ use Psr\Http\Client\ClientInterface; use Brevo\Core\Client\RawClient; use Brevo\Balance\Requests\GetLoyaltyBalanceProgramsPidActiveBalanceRequest; -use Brevo\Types\BalanceLimit; +use Brevo\Balance\Types\GetLoyaltyBalanceProgramsPidActiveBalanceResponse; use Brevo\Exceptions\BrevoException; use Brevo\Exceptions\BrevoApiException; use Brevo\Core\Json\JsonApiRequest; @@ -20,6 +20,7 @@ use Brevo\Balance\Requests\GetBalanceDefinitionRequest; use Brevo\Balance\Requests\UpdateBalanceDefinitionRequest; use Brevo\Balance\Requests\CreateBalanceLimitRequest; +use Brevo\Types\BalanceLimit; use Brevo\Balance\Requests\GetBalanceLimitRequest; use Brevo\Balance\Requests\UpdateBalanceLimitRequest; use Brevo\Balance\Requests\GetContactBalancesRequest; @@ -84,16 +85,16 @@ public function __construct( * queryParameters?: array, * bodyProperties?: array, * } $options - * @return ?BalanceLimit + * @return ?GetLoyaltyBalanceProgramsPidActiveBalanceResponse * @throws BrevoException * @throws BrevoApiException */ - public function getActiveBalancesApi(string $pid, GetLoyaltyBalanceProgramsPidActiveBalanceRequest $request, ?array $options = null): ?BalanceLimit + public function getActiveBalancesApi(string $pid, GetLoyaltyBalanceProgramsPidActiveBalanceRequest $request, ?array $options = null): ?GetLoyaltyBalanceProgramsPidActiveBalanceResponse { $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; } @@ -101,7 +102,7 @@ public function getActiveBalancesApi(string $pid, GetLoyaltyBalanceProgramsPidAc $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; @@ -125,7 +126,7 @@ public function getActiveBalancesApi(string $pid, GetLoyaltyBalanceProgramsPidAc if (empty($json)) { return null; } - return BalanceLimit::fromJson($json); + return GetLoyaltyBalanceProgramsPidActiveBalanceResponse::fromJson($json); } } catch (JsonException $e) { throw new BrevoException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); @@ -606,7 +607,7 @@ public function deleteBalanceLimit(string $pid, string $bdid, string $blid, ?arr } /** - * Returns balance list + * Returns contact balances for a given balance definition across all subscriptions. * * @param string $pid Loyalty Program Id * @param GetContactBalancesRequest $request @@ -622,13 +623,26 @@ public function deleteBalanceLimit(string $pid, string $bdid, string $blid, ?arr * @throws BrevoException * @throws BrevoApiException */ - public function getContactBalances(string $pid, GetContactBalancesRequest $request = new GetContactBalancesRequest(), ?array $options = null): ?GetContactBalancesResponse + public function getContactBalances(string $pid, GetContactBalancesRequest $request, ?array $options = null): ?GetContactBalancesResponse { $options = array_merge($this->options, $options ?? []); $query = []; + $query['balanceDefinitionId'] = $request->balanceDefinitionId; if ($request->includeInternal != null) { $query['includeInternal'] = $request->includeInternal; } + if ($request->limit != null) { + $query['limit'] = $request->limit; + } + if ($request->offset != null) { + $query['offset'] = $request->offset; + } + if ($request->sort != null) { + $query['sort'] = $request->sort; + } + if ($request->sortField != null) { + $query['sortField'] = $request->sortField; + } try { $response = $this->client->sendRequest( new JsonApiRequest( @@ -850,15 +864,15 @@ public function getTransactionHistoryApi(string $pid, GetLoyaltyBalanceProgramsP if ($request->sort != null) { $query['sort'] = $request->sort; } - if ($request->filters != null) { - $query['filters'] = $request->filters; - } if ($request->status != null) { $query['status'] = $request->status; } if ($request->transactionType != null) { $query['transactionType'] = $request->transactionType; } + if ($request->loyaltySubscriptionId != null) { + $query['loyaltySubscriptionId'] = $request->loyaltySubscriptionId; + } try { $response = $this->client->sendRequest( new JsonApiRequest( diff --git a/src/Balance/BalanceClientInterface.php b/src/Balance/BalanceClientInterface.php index 35c62bff..c3e77ed8 100644 --- a/src/Balance/BalanceClientInterface.php +++ b/src/Balance/BalanceClientInterface.php @@ -3,7 +3,7 @@ namespace Brevo\Balance; use Brevo\Balance\Requests\GetLoyaltyBalanceProgramsPidActiveBalanceRequest; -use Brevo\Types\BalanceLimit; +use Brevo\Balance\Types\GetLoyaltyBalanceProgramsPidActiveBalanceResponse; use Brevo\Balance\Requests\GetBalanceDefinitionListRequest; use Brevo\Balance\Types\GetBalanceDefinitionListResponse; use Brevo\Balance\Requests\PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequest; @@ -11,6 +11,7 @@ use Brevo\Balance\Requests\GetBalanceDefinitionRequest; use Brevo\Balance\Requests\UpdateBalanceDefinitionRequest; use Brevo\Balance\Requests\CreateBalanceLimitRequest; +use Brevo\Types\BalanceLimit; use Brevo\Balance\Requests\GetBalanceLimitRequest; use Brevo\Balance\Requests\UpdateBalanceLimitRequest; use Brevo\Balance\Requests\GetContactBalancesRequest; @@ -41,9 +42,9 @@ interface BalanceClientInterface * queryParameters?: array, * bodyProperties?: array, * } $options - * @return ?BalanceLimit + * @return ?GetLoyaltyBalanceProgramsPidActiveBalanceResponse */ - public function getActiveBalancesApi(string $pid, GetLoyaltyBalanceProgramsPidActiveBalanceRequest $request, ?array $options = null): ?BalanceLimit; + public function getActiveBalancesApi(string $pid, GetLoyaltyBalanceProgramsPidActiveBalanceRequest $request, ?array $options = null): ?GetLoyaltyBalanceProgramsPidActiveBalanceResponse; /** * Returns balance definition page @@ -205,7 +206,7 @@ public function updateBalanceLimit(string $pid, string $bdid, string $blid, Upda public function deleteBalanceLimit(string $pid, string $bdid, string $blid, ?array $options = null): void; /** - * Returns balance list + * Returns contact balances for a given balance definition across all subscriptions. * * @param string $pid Loyalty Program Id * @param GetContactBalancesRequest $request @@ -219,7 +220,7 @@ public function deleteBalanceLimit(string $pid, string $bdid, string $blid, ?arr * } $options * @return ?GetContactBalancesResponse */ - public function getContactBalances(string $pid, GetContactBalancesRequest $request = new GetContactBalancesRequest(), ?array $options = null): ?GetContactBalancesResponse; + public function getContactBalances(string $pid, GetContactBalancesRequest $request, ?array $options = null): ?GetContactBalancesResponse; /** * Returns created order diff --git a/src/Balance/Requests/BeginTransactionRequest.php b/src/Balance/Requests/BeginTransactionRequest.php index 974e6575..a2b4ffdb 100644 --- a/src/Balance/Requests/BeginTransactionRequest.php +++ b/src/Balance/Requests/BeginTransactionRequest.php @@ -4,27 +4,24 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; +use Brevo\Balance\Types\BeginTransactionRequestTransactionType; use Brevo\Core\Types\ArrayType; +use DateTime; +use Brevo\Core\Types\Date; class BeginTransactionRequest extends JsonSerializableType { /** - * @var ?string $loyaltySubscriptionId Unique identifier for the loyalty subscription (required unless `contactId` is provided). - */ - #[JsonProperty('LoyaltySubscriptionId')] - public ?string $loyaltySubscriptionId; - - /** - * @var float $amount Transaction amount (must be provided). + * @var float $amount Transaction amount. A positive value creates a credit transaction and a negative value creates a debit transaction (unless transactionType is explicitly provided). */ #[JsonProperty('amount')] public float $amount; /** - * @var ?bool $autoComplete Whether the transaction should be automatically completed. + * @var ?value-of $transactionType Explicit transaction type. If not provided, the type is inferred from the sign of the amount (positive = credit, negative = debit). */ - #[JsonProperty('autoComplete')] - public ?bool $autoComplete; + #[JsonProperty('transactionType')] + public ?string $transactionType; /** * @var string $balanceDefinitionId Unique identifier (UUID) of the associated balance definition. @@ -33,22 +30,16 @@ class BeginTransactionRequest extends JsonSerializableType public string $balanceDefinitionId; /** - * @var ?int $balanceExpiryInMinutes Optional expiry time for the balance in minutes (must be greater than 0 if provided). - */ - #[JsonProperty('balanceExpiryInMinutes')] - public ?int $balanceExpiryInMinutes; - - /** - * @var ?int $contactId Unique identifier of the contact involved in the transaction (required unless `LoyaltySubscriptionId` is provided). + * @var ?int $contactId Unique identifier of the contact involved in the transaction. Required unless `LoyaltySubscriptionId` is provided. */ #[JsonProperty('contactId')] public ?int $contactId; /** - * @var ?string $eventTime Optional timestamp specifying when the transaction occurred. + * @var ?string $loyaltySubscriptionId Unique identifier for the loyalty subscription. Required unless `contactId` is provided. */ - #[JsonProperty('eventTime')] - public ?string $eventTime; + #[JsonProperty('LoyaltySubscriptionId')] + public ?string $loyaltySubscriptionId; /** * @var ?array $meta Optional metadata associated with the transaction. @@ -57,35 +48,55 @@ class BeginTransactionRequest extends JsonSerializableType public ?array $meta; /** - * @var ?int $ttl Optional time-to-live for the transaction (must be greater than 0 if provided). + * @var ?int $ttl Time-to-live for the transaction in seconds. Must be at least 10 seconds if provided. */ #[JsonProperty('ttl')] public ?int $ttl; + /** + * @var ?DateTime $eventTime Timestamp specifying when the transaction event occurred (ISO 8601 / RFC 3339 format). + */ + #[JsonProperty('eventTime'), Date(Date::TYPE_DATETIME)] + public ?DateTime $eventTime; + + /** + * @var ?bool $autoComplete Whether the transaction should be automatically completed. + */ + #[JsonProperty('autoComplete')] + public ?bool $autoComplete; + + /** + * @var ?int $balanceExpiryInMinutes Expiry time for the balance in minutes. Must be greater than 0 if provided. Only applicable when autoComplete is true. + */ + #[JsonProperty('balanceExpiryInMinutes')] + public ?int $balanceExpiryInMinutes; + /** * @param array{ * amount: float, * balanceDefinitionId: string, - * loyaltySubscriptionId?: ?string, - * autoComplete?: ?bool, - * balanceExpiryInMinutes?: ?int, + * transactionType?: ?value-of, * contactId?: ?int, - * eventTime?: ?string, + * loyaltySubscriptionId?: ?string, * meta?: ?array, * ttl?: ?int, + * eventTime?: ?DateTime, + * autoComplete?: ?bool, + * balanceExpiryInMinutes?: ?int, * } $values */ public function __construct( array $values, ) { - $this->loyaltySubscriptionId = $values['loyaltySubscriptionId'] ?? null; $this->amount = $values['amount']; - $this->autoComplete = $values['autoComplete'] ?? null; + $this->transactionType = $values['transactionType'] ?? null; $this->balanceDefinitionId = $values['balanceDefinitionId']; - $this->balanceExpiryInMinutes = $values['balanceExpiryInMinutes'] ?? null; $this->contactId = $values['contactId'] ?? null; - $this->eventTime = $values['eventTime'] ?? null; + $this->loyaltySubscriptionId = $values['loyaltySubscriptionId'] ?? null; $this->meta = $values['meta'] ?? null; $this->ttl = $values['ttl'] ?? null; + $this->eventTime = $values['eventTime'] ?? null; + $this->autoComplete = $values['autoComplete'] ?? null; + $this->balanceExpiryInMinutes = $values['balanceExpiryInMinutes'] ?? null; } } diff --git a/src/Balance/Requests/CreateBalanceOrderRequest.php b/src/Balance/Requests/CreateBalanceOrderRequest.php index c0e1584c..0612a15d 100644 --- a/src/Balance/Requests/CreateBalanceOrderRequest.php +++ b/src/Balance/Requests/CreateBalanceOrderRequest.php @@ -5,6 +5,7 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; use Brevo\Core\Types\ArrayType; +use Brevo\Balance\Types\CreateBalanceOrderRequestSource; class CreateBalanceOrderRequest extends JsonSerializableType { @@ -45,7 +46,7 @@ class CreateBalanceOrderRequest extends JsonSerializableType public ?array $meta; /** - * @var string $source Specifies the origin of the order (`engine` or `user`). + * @var value-of $source Specifies the origin of the order. */ #[JsonProperty('source')] public string $source; @@ -56,7 +57,7 @@ class CreateBalanceOrderRequest extends JsonSerializableType * balanceDefinitionId: string, * contactId: int, * dueAt: string, - * source: string, + * source: value-of, * expiresAt?: ?string, * meta?: ?array, * } $values diff --git a/src/Balance/Requests/GetContactBalancesRequest.php b/src/Balance/Requests/GetContactBalancesRequest.php index 3bcc1ce1..afadc439 100644 --- a/src/Balance/Requests/GetContactBalancesRequest.php +++ b/src/Balance/Requests/GetContactBalancesRequest.php @@ -3,6 +3,8 @@ namespace Brevo\Balance\Requests; use Brevo\Core\Json\JsonSerializableType; +use Brevo\Balance\Types\GetContactBalancesRequestSort; +use Brevo\Balance\Types\GetContactBalancesRequestSortField; class GetContactBalancesRequest extends JsonSerializableType { @@ -11,14 +13,49 @@ class GetContactBalancesRequest extends JsonSerializableType */ public ?bool $includeInternal; + /** + * @var ?int $limit Limit the number of records returned + */ + public ?int $limit; + + /** + * @var ?int $offset Skip a number of records + */ + public ?int $offset; + + /** + * @var ?value-of $sort Sort order + */ + public ?string $sort; + + /** + * @var ?value-of $sortField Field to sort by + */ + public ?string $sortField; + + /** + * @var string $balanceDefinitionId Balance Definition ID (required) + */ + public string $balanceDefinitionId; + /** * @param array{ + * balanceDefinitionId: string, * includeInternal?: ?bool, + * limit?: ?int, + * offset?: ?int, + * sort?: ?value-of, + * sortField?: ?value-of, * } $values */ public function __construct( - array $values = [], + array $values, ) { $this->includeInternal = $values['includeInternal'] ?? null; + $this->limit = $values['limit'] ?? null; + $this->offset = $values['offset'] ?? null; + $this->sort = $values['sort'] ?? null; + $this->sortField = $values['sortField'] ?? null; + $this->balanceDefinitionId = $values['balanceDefinitionId']; } } diff --git a/src/Balance/Requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.php b/src/Balance/Requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.php index 695b861c..6c341d4f 100644 --- a/src/Balance/Requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.php +++ b/src/Balance/Requests/GetLoyaltyBalanceProgramsPidActiveBalanceRequest.php @@ -3,6 +3,7 @@ namespace Brevo\Balance\Requests; use Brevo\Core\Json\JsonSerializableType; +use Brevo\Balance\Types\GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort; class GetLoyaltyBalanceProgramsPidActiveBalanceRequest extends JsonSerializableType { @@ -17,12 +18,12 @@ class GetLoyaltyBalanceProgramsPidActiveBalanceRequest extends JsonSerializableT public ?int $offset; /** - * @var ?string $sortField Sort Field + * @var ?'createdAt' $sortField Sort Field */ public ?string $sortField; /** - * @var ?string $sort Sort Order + * @var ?value-of $sort Sort Order */ public ?string $sort; @@ -47,8 +48,8 @@ class GetLoyaltyBalanceProgramsPidActiveBalanceRequest extends JsonSerializableT * balanceDefinitionId: string, * limit?: ?int, * offset?: ?int, - * sortField?: ?string, - * sort?: ?string, + * sortField?: ?'createdAt', + * sort?: ?value-of, * includeInternal?: ?bool, * } $values */ diff --git a/src/Balance/Requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.php b/src/Balance/Requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.php index 8668fe53..e9612c2c 100644 --- a/src/Balance/Requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.php +++ b/src/Balance/Requests/GetLoyaltyBalanceProgramsPidTransactionHistoryRequest.php @@ -12,12 +12,12 @@ class GetLoyaltyBalanceProgramsPidTransactionHistoryRequest extends JsonSerializ /** * @var ?int $limit Limit the number of records returned */ - public ?int $limit = 20; + public ?int $limit; /** * @var ?int $offset Page number to retrieve */ - public ?int $offset = 0; + public ?int $offset; /** * @var ?'createdAt' $sortField Field to sort by @@ -25,14 +25,14 @@ class GetLoyaltyBalanceProgramsPidTransactionHistoryRequest extends JsonSerializ public ?string $sortField; /** - * @var ?value-of $sort Sort order, either asc or desc + * @var ?value-of $sort Sort order */ public ?string $sort; /** * @var int $contactId Contact ID */ - public int $contactId = 0; + public int $contactId; /** * @var string $balanceDefinitionId Balance Definition ID @@ -40,31 +40,31 @@ class GetLoyaltyBalanceProgramsPidTransactionHistoryRequest extends JsonSerializ public string $balanceDefinitionId; /** - * @var ?array $filters Filters to apply + * @var ?value-of $status Transaction status filter */ - public ?array $filters; + public ?string $status; /** - * @var ?value-of $status Transaction status filter. Allowed values: draft, completed, rejected, cancelled, expired + * @var ?value-of $transactionType Transaction type filter */ - public ?string $status; + public ?string $transactionType; /** - * @var ?value-of $transactionType Transaction type filter. Allowed values: credit, debit + * @var ?string $loyaltySubscriptionId Loyalty Subscription ID filter */ - public ?string $transactionType; + public ?string $loyaltySubscriptionId; /** * @param array{ - * contactId?: int, + * contactId: int, * balanceDefinitionId: string, * limit?: ?int, * offset?: ?int, * sortField?: ?'createdAt', * sort?: ?value-of, - * filters?: ?array, * status?: ?value-of, * transactionType?: ?value-of, + * loyaltySubscriptionId?: ?string, * } $values */ public function __construct( @@ -74,10 +74,10 @@ public function __construct( $this->offset = $values['offset'] ?? null; $this->sortField = $values['sortField'] ?? null; $this->sort = $values['sort'] ?? null; - $this->contactId = $values['contactId'] ?? 0; + $this->contactId = $values['contactId']; $this->balanceDefinitionId = $values['balanceDefinitionId']; - $this->filters = $values['filters'] ?? null; $this->status = $values['status'] ?? null; $this->transactionType = $values['transactionType'] ?? null; + $this->loyaltySubscriptionId = $values['loyaltySubscriptionId'] ?? null; } } diff --git a/src/Balance/Types/BeginTransactionRequestTransactionType.php b/src/Balance/Types/BeginTransactionRequestTransactionType.php new file mode 100644 index 00000000..125afd85 --- /dev/null +++ b/src/Balance/Types/BeginTransactionRequestTransactionType.php @@ -0,0 +1,9 @@ + $activeBalances List of active balances. + */ + #[JsonProperty('activeBalances'), ArrayType([GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem::class])] + public ?array $activeBalances; + + /** + * @param array{ + * count?: ?int, + * loyaltyProgramId?: ?string, + * contactId?: ?int, + * balanceDefinitionId?: ?string, + * activeBalances?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->count = $values['count'] ?? null; + $this->loyaltyProgramId = $values['loyaltyProgramId'] ?? null; + $this->contactId = $values['contactId'] ?? null; + $this->balanceDefinitionId = $values['balanceDefinitionId'] ?? null; + $this->activeBalances = $values['activeBalances'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Balance/Types/GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem.php b/src/Balance/Types/GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem.php new file mode 100644 index 00000000..fa0a7567 --- /dev/null +++ b/src/Balance/Types/GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem.php @@ -0,0 +1,60 @@ +id = $values['id'] ?? null; + $this->amount = $values['amount'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; + $this->expiresAt = $values['expiresAt'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem.php b/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem.php index 9575994f..92e2f2e1 100644 --- a/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem.php +++ b/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem.php @@ -17,6 +17,12 @@ class GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryIt #[JsonProperty('amount')] public ?float $amount; + /** + * @var ?value-of $transactionType The type of the transaction. + */ + #[JsonProperty('transactionType')] + public ?string $transactionType; + /** * @var ?string $balanceExpirationDate Expiration date of the balance associated with this transaction. */ @@ -74,6 +80,7 @@ class GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryIt /** * @param array{ * amount?: ?float, + * transactionType?: ?value-of, * balanceExpirationDate?: ?string, * cancelledAt?: ?string, * completedAt?: ?string, @@ -89,6 +96,7 @@ public function __construct( array $values = [], ) { $this->amount = $values['amount'] ?? null; + $this->transactionType = $values['transactionType'] ?? null; $this->balanceExpirationDate = $values['balanceExpirationDate'] ?? null; $this->cancelledAt = $values['cancelledAt'] ?? null; $this->completedAt = $values['completedAt'] ?? null; diff --git a/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType.php b/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType.php new file mode 100644 index 00000000..3ff723c3 --- /dev/null +++ b/src/Balance/Types/GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType.php @@ -0,0 +1,9 @@ + $balance + * @var ?string $loyaltyProgramId Unique identifier of the loyalty program. + */ + #[JsonProperty('loyaltyProgramId')] + public ?string $loyaltyProgramId; + + /** + * @var ?int $contactId Unique identifier of the contact. + */ + #[JsonProperty('contactId')] + public ?int $contactId; + + /** + * @var ?array $balance Aggregate balance per balance definition. */ #[JsonProperty('balance'), ArrayType([GetSubscriptionBalancesResponseBalanceItem::class])] public ?array $balance; /** * @param array{ + * loyaltyProgramId?: ?string, + * contactId?: ?int, * balance?: ?array, * } $values */ public function __construct( array $values = [], ) { + $this->loyaltyProgramId = $values['loyaltyProgramId'] ?? null; + $this->contactId = $values['contactId'] ?? null; $this->balance = $values['balance'] ?? null; } diff --git a/src/Balance/Types/GetSubscriptionBalancesResponseBalanceItem.php b/src/Balance/Types/GetSubscriptionBalancesResponseBalanceItem.php index 7e202936..fa372049 100644 --- a/src/Balance/Types/GetSubscriptionBalancesResponseBalanceItem.php +++ b/src/Balance/Types/GetSubscriptionBalancesResponseBalanceItem.php @@ -8,13 +8,13 @@ class GetSubscriptionBalancesResponseBalanceItem extends JsonSerializableType { /** - * @var ?string $balanceDefinitionId balance definition ID + * @var ?string $balanceDefinitionId Balance definition ID. */ #[JsonProperty('balanceDefinitionId')] public ?string $balanceDefinitionId; /** - * @var ?float $value Unique identifier for the balance definition associated with this aggregate balance + * @var ?float $value Aggregate balance value for this definition. */ #[JsonProperty('value')] public ?float $value; diff --git a/src/Balance/Types/PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.php b/src/Balance/Types/PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.php index 1e57ee13..55c9ec20 100644 --- a/src/Balance/Types/PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.php +++ b/src/Balance/Types/PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse.php @@ -4,88 +4,90 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; +use DateTime; +use Brevo\Core\Types\Date; class PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse extends JsonSerializableType { /** - * @var ?float $amount The current amount available in the balance + * @var ?string $id Unique identifier for the balance. + */ + #[JsonProperty('id')] + public ?string $id; + + /** + * @var ?float $amount The current amount available in the balance. */ #[JsonProperty('amount')] public ?float $amount; /** - * @var ?string $balanceDefinitionId balance definition ID + * @var ?string $loyaltyProgramId Loyalty program ID. */ - #[JsonProperty('balanceDefinitionId')] - public ?string $balanceDefinitionId; + #[JsonProperty('loyaltyProgramId')] + public ?string $loyaltyProgramId; /** - * @var ?string $consumedAt Timestamp of when the balance was last consumed + * @var ?int $organizationId Organization ID. */ - #[JsonProperty('consumedAt')] - public ?string $consumedAt; + #[JsonProperty('organizationId')] + public ?int $organizationId; /** - * @var ?int $contactId contact ID + * @var ?int $contactId Contact ID. */ #[JsonProperty('contactId')] public ?int $contactId; /** - * @var ?string $createdAt Timestamp of when the balance was created + * @var ?string $balanceDefinitionId Balance definition ID. */ - #[JsonProperty('createdAt')] - public ?string $createdAt; - - /** - * @var ?string $expiresAt Expiration timestamp of the balance - */ - #[JsonProperty('expiresAt')] - public ?string $expiresAt; + #[JsonProperty('balanceDefinitionId')] + public ?string $balanceDefinitionId; /** - * @var ?string $id Unique identifier for the balance + * @var ?DateTime $createdAt Timestamp of when the balance was created. */ - #[JsonProperty('id')] - public ?string $id; + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; /** - * @var ?string $loyaltyProgramId loyalty program ID + * @var ?DateTime $expiresAt Expiration timestamp of the balance. */ - #[JsonProperty('loyaltyProgramId')] - public ?string $loyaltyProgramId; + #[JsonProperty('expiresAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $expiresAt; /** - * @var ?int $organizationId organization ID + * @var ?DateTime $consumedAt Timestamp of when the balance was last consumed. */ - #[JsonProperty('organizationId')] - public ?int $organizationId; + #[JsonProperty('consumedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $consumedAt; /** * @param array{ - * amount?: ?float, - * balanceDefinitionId?: ?string, - * consumedAt?: ?string, - * contactId?: ?int, - * createdAt?: ?string, - * expiresAt?: ?string, * id?: ?string, + * amount?: ?float, * loyaltyProgramId?: ?string, * organizationId?: ?int, + * contactId?: ?int, + * balanceDefinitionId?: ?string, + * createdAt?: ?DateTime, + * expiresAt?: ?DateTime, + * consumedAt?: ?DateTime, * } $values */ public function __construct( array $values = [], ) { + $this->id = $values['id'] ?? null; $this->amount = $values['amount'] ?? null; - $this->balanceDefinitionId = $values['balanceDefinitionId'] ?? null; - $this->consumedAt = $values['consumedAt'] ?? null; + $this->loyaltyProgramId = $values['loyaltyProgramId'] ?? null; + $this->organizationId = $values['organizationId'] ?? null; $this->contactId = $values['contactId'] ?? null; + $this->balanceDefinitionId = $values['balanceDefinitionId'] ?? null; $this->createdAt = $values['createdAt'] ?? null; $this->expiresAt = $values['expiresAt'] ?? null; - $this->id = $values['id'] ?? null; - $this->loyaltyProgramId = $values['loyaltyProgramId'] ?? null; - $this->organizationId = $values['organizationId'] ?? null; + $this->consumedAt = $values['consumedAt'] ?? null; } /** diff --git a/src/Brevo.php b/src/Brevo.php index 721d8acb..c1d0d132 100644 --- a/src/Brevo.php +++ b/src/Brevo.php @@ -265,8 +265,8 @@ public function __construct( 'api-key' => $apiKey, 'X-Fern-Language' => 'PHP', 'X-Fern-SDK-Name' => 'Brevo', - 'X-Fern-SDK-Version' => '4.0.13', - 'User-Agent' => 'getbrevo/brevo-php/4.0.13', + 'X-Fern-SDK-Version' => '5.0.0', + 'User-Agent' => 'getbrevo/brevo-php/5.0.0', ]; $this->options = $options ?? []; diff --git a/src/Companies/CompaniesClient.php b/src/Companies/CompaniesClient.php index 35d0dd08..3b2ecbea 100644 --- a/src/Companies/CompaniesClient.php +++ b/src/Companies/CompaniesClient.php @@ -66,6 +66,8 @@ public function __construct( } /** + * Retrieve a paginated list of companies with optional filtering, sorting, and search capabilities. Results are sorted by creation date in descending order by default, and can be filtered by attributes, linked contacts, linked deals, or modification/creation timestamps. + * * @param GetCompaniesRequest $request * @param ?array{ * baseUrl?: string, @@ -83,8 +85,8 @@ public function getAllCompanies(GetCompaniesRequest $request = new GetCompaniesR { $options = array_merge($this->options, $options ?? []); $query = []; - if ($request->filters != null) { - $query['filters'] = $request->filters; + if ($request->filtersAttributesName != null) { + $query['filters[attributes.name]'] = $request->filtersAttributesName; } if ($request->linkedContactsIds != null) { $query['linkedContactsIds'] = $request->linkedContactsIds; @@ -141,6 +143,8 @@ public function getAllCompanies(GetCompaniesRequest $request = new GetCompaniesR } /** + * Create a new CRM company with the specified name, attributes, and optional associations to contacts and deals. The company name is required, and you can optionally provide a country code when a phone number attribute is included. + * * @param PostCompaniesRequest $request * @param ?array{ * baseUrl?: string, @@ -243,6 +247,8 @@ public function importCompaniesCreationAndUpdation(PostCompaniesImportRequest $r } /** + * Link or unlink contacts and deals with a specific company in a single request. You can simultaneously link new contacts/deals and unlink existing ones by providing the respective ID arrays in the request body. + * * @param string $id * @param PatchCompaniesLinkUnlinkIdRequest $request * @param ?array{ @@ -284,6 +290,8 @@ public function linkAndUnlinkCompanyWithContactAndDeal(string $id, PatchCompanie } /** + * Retrieve the full details of a single company by its identifier, including its attributes, linked contacts, and linked deals. Returns a 404 error if the company does not exist, or a 403 error if the user lacks permission to view the company. + * * @param string $id Get Company Details * @param ?array{ * baseUrl?: string, @@ -330,6 +338,8 @@ public function getACompany(string $id, ?array $options = null): ?Company } /** + * Permanently delete a company by its identifier. The requesting user must be the company owner or have manage permission on companies; otherwise, a 403 Forbidden error is returned. + * * @param string $id Company ID to delete * @param ?array{ * baseUrl?: string, @@ -369,6 +379,8 @@ public function deleteACompany(string $id, ?array $options = null): void } /** + * Update an existing company''s attributes, name, linked contacts, or linked deals. Note that passing `linkedContactsIds` or `linkedDealsIds` replaces the entire list of associations, so omitted IDs will be removed. The company name cannot be set to an empty string. + * * @param string $id * @param PatchCompaniesIdRequest $request * @param ?array{ @@ -417,6 +429,8 @@ public function updateACompany(string $id, PatchCompaniesIdRequest $request = ne } /** + * Create a new custom attribute for companies or deals. The attribute label must be unique within the object type, cannot exceed 50 characters, and cannot use reserved names. For `single-select` or `multi-choice` attribute types, you must also provide the `optionsLabels` array. + * * @param PostCrmAttributesRequest $request * @param ?array{ * baseUrl?: string, @@ -464,6 +478,8 @@ public function createACompanyDealAttribute(PostCrmAttributesRequest $request, ? } /** + * Delete an existing custom attribute by its identifier. This permanently removes the attribute definition and cleans up all references to it across companies or deals. System-default and non-editable attributes cannot be deleted. + * * @param string $id Attribute ID * @param ?array{ * baseUrl?: string, @@ -503,6 +519,8 @@ public function deleteAnAttribute(string $id, ?array $options = null): void } /** + * Update an existing custom attribute''s label or options. You can rename the attribute label or modify the available options for `single-select` and `multi-choice` attribute types. System-default attributes cannot be modified except for specific editable fields. + * * @param string $id Attribute ID * @param PatchCrmAttributesIdRequest $request * @param ?array{ @@ -544,6 +562,8 @@ public function updateAnAttribute(string $id, PatchCrmAttributesIdRequest $reque } /** + * Retrieve the list of all attributes defined for companies, including both system-default and custom attributes. Each attribute includes its label, internal name, type, required status, and available options for select-type attributes. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, diff --git a/src/Companies/CompaniesClientInterface.php b/src/Companies/CompaniesClientInterface.php index 432fb0ac..8a371210 100644 --- a/src/Companies/CompaniesClientInterface.php +++ b/src/Companies/CompaniesClientInterface.php @@ -19,6 +19,8 @@ interface CompaniesClientInterface { /** + * Retrieve a paginated list of companies with optional filtering, sorting, and search capabilities. Results are sorted by creation date in descending order by default, and can be filtered by attributes, linked contacts, linked deals, or modification/creation timestamps. + * * @param GetCompaniesRequest $request * @param ?array{ * baseUrl?: string, @@ -33,6 +35,8 @@ interface CompaniesClientInterface public function getAllCompanies(GetCompaniesRequest $request = new GetCompaniesRequest(), ?array $options = null): ?GetCompaniesResponse; /** + * Create a new CRM company with the specified name, attributes, and optional associations to contacts and deals. The company name is required, and you can optionally provide a country code when a phone number attribute is included. + * * @param PostCompaniesRequest $request * @param ?array{ * baseUrl?: string, @@ -62,6 +66,8 @@ public function createACompany(PostCompaniesRequest $request, ?array $options = public function importCompaniesCreationAndUpdation(PostCompaniesImportRequest $request = new PostCompaniesImportRequest(), ?array $options = null): ?PostCompaniesImportResponse; /** + * Link or unlink contacts and deals with a specific company in a single request. You can simultaneously link new contacts/deals and unlink existing ones by providing the respective ID arrays in the request body. + * * @param string $id * @param PatchCompaniesLinkUnlinkIdRequest $request * @param ?array{ @@ -76,6 +82,8 @@ public function importCompaniesCreationAndUpdation(PostCompaniesImportRequest $r public function linkAndUnlinkCompanyWithContactAndDeal(string $id, PatchCompaniesLinkUnlinkIdRequest $request = new PatchCompaniesLinkUnlinkIdRequest(), ?array $options = null): void; /** + * Retrieve the full details of a single company by its identifier, including its attributes, linked contacts, and linked deals. Returns a 404 error if the company does not exist, or a 403 error if the user lacks permission to view the company. + * * @param string $id Get Company Details * @param ?array{ * baseUrl?: string, @@ -90,6 +98,8 @@ public function linkAndUnlinkCompanyWithContactAndDeal(string $id, PatchCompanie public function getACompany(string $id, ?array $options = null): ?Company; /** + * Permanently delete a company by its identifier. The requesting user must be the company owner or have manage permission on companies; otherwise, a 403 Forbidden error is returned. + * * @param string $id Company ID to delete * @param ?array{ * baseUrl?: string, @@ -103,6 +113,8 @@ public function getACompany(string $id, ?array $options = null): ?Company; public function deleteACompany(string $id, ?array $options = null): void; /** + * Update an existing company''s attributes, name, linked contacts, or linked deals. Note that passing `linkedContactsIds` or `linkedDealsIds` replaces the entire list of associations, so omitted IDs will be removed. The company name cannot be set to an empty string. + * * @param string $id * @param PatchCompaniesIdRequest $request * @param ?array{ @@ -118,6 +130,8 @@ public function deleteACompany(string $id, ?array $options = null): void; public function updateACompany(string $id, PatchCompaniesIdRequest $request = new PatchCompaniesIdRequest(), ?array $options = null): ?Company; /** + * Create a new custom attribute for companies or deals. The attribute label must be unique within the object type, cannot exceed 50 characters, and cannot use reserved names. For `single-select` or `multi-choice` attribute types, you must also provide the `optionsLabels` array. + * * @param PostCrmAttributesRequest $request * @param ?array{ * baseUrl?: string, @@ -132,6 +146,8 @@ public function updateACompany(string $id, PatchCompaniesIdRequest $request = ne public function createACompanyDealAttribute(PostCrmAttributesRequest $request, ?array $options = null): ?PostCrmAttributesResponse; /** + * Delete an existing custom attribute by its identifier. This permanently removes the attribute definition and cleans up all references to it across companies or deals. System-default and non-editable attributes cannot be deleted. + * * @param string $id Attribute ID * @param ?array{ * baseUrl?: string, @@ -145,6 +161,8 @@ public function createACompanyDealAttribute(PostCrmAttributesRequest $request, ? public function deleteAnAttribute(string $id, ?array $options = null): void; /** + * Update an existing custom attribute''s label or options. You can rename the attribute label or modify the available options for `single-select` and `multi-choice` attribute types. System-default attributes cannot be modified except for specific editable fields. + * * @param string $id Attribute ID * @param PatchCrmAttributesIdRequest $request * @param ?array{ @@ -159,6 +177,8 @@ public function deleteAnAttribute(string $id, ?array $options = null): void; public function updateAnAttribute(string $id, PatchCrmAttributesIdRequest $request = new PatchCrmAttributesIdRequest(), ?array $options = null): void; /** + * Retrieve the list of all attributes defined for companies, including both system-default and custom attributes. Each attribute includes its label, internal name, type, required status, and available options for select-type attributes. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, diff --git a/src/Companies/Requests/GetCompaniesRequest.php b/src/Companies/Requests/GetCompaniesRequest.php index 55cb70c8..2299c64a 100644 --- a/src/Companies/Requests/GetCompaniesRequest.php +++ b/src/Companies/Requests/GetCompaniesRequest.php @@ -8,9 +8,9 @@ class GetCompaniesRequest extends JsonSerializableType { /** - * @var ?string $filters Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"} + * @var ?string $filtersAttributesName Filter by attributes. If you have a filter for the owner on your side please send it as filters[attributes.owner] and utilize the account email for the filtering. */ - public ?string $filters; + public ?string $filtersAttributesName; /** * @var ?int $linkedContactsIds Filter by linked contacts ids @@ -23,12 +23,12 @@ class GetCompaniesRequest extends JsonSerializableType public ?string $linkedDealsIds; /** - * @var ?string $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. + * @var ?string $modifiedSince Filter (urlencoded) the companies modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. */ public ?string $modifiedSince; /** - * @var ?string $createdSince Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. + * @var ?string $createdSince Filter (urlencoded) the companies created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. */ public ?string $createdSince; @@ -54,7 +54,7 @@ class GetCompaniesRequest extends JsonSerializableType /** * @param array{ - * filters?: ?string, + * filtersAttributesName?: ?string, * linkedContactsIds?: ?int, * linkedDealsIds?: ?string, * modifiedSince?: ?string, @@ -68,7 +68,7 @@ class GetCompaniesRequest extends JsonSerializableType public function __construct( array $values = [], ) { - $this->filters = $values['filters'] ?? null; + $this->filtersAttributesName = $values['filtersAttributesName'] ?? null; $this->linkedContactsIds = $values['linkedContactsIds'] ?? null; $this->linkedDealsIds = $values['linkedDealsIds'] ?? null; $this->modifiedSince = $values['modifiedSince'] ?? null; diff --git a/src/Companies/Requests/PatchCompaniesIdRequest.php b/src/Companies/Requests/PatchCompaniesIdRequest.php index 9f2cb5a4..96c59f0c 100644 --- a/src/Companies/Requests/PatchCompaniesIdRequest.php +++ b/src/Companies/Requests/PatchCompaniesIdRequest.php @@ -27,7 +27,7 @@ class PatchCompaniesIdRequest extends JsonSerializableType public ?array $linkedContactsIds; /** - * @var ?array $linkedDealsIds Warning - Using PATCH on linkedDealsIds replaces the list of linked contacts. Omitted IDs will be removed. + * @var ?array $linkedDealsIds Warning - Using PATCH on linkedDealsIds replaces the list of linked deals. Omitted IDs will be removed. */ #[JsonProperty('linkedDealsIds'), ArrayType(['string'])] public ?array $linkedDealsIds; diff --git a/src/Companies/Requests/PostCrmAttributesRequest.php b/src/Companies/Requests/PostCrmAttributesRequest.php index bdfc20bb..96982018 100644 --- a/src/Companies/Requests/PostCrmAttributesRequest.php +++ b/src/Companies/Requests/PostCrmAttributesRequest.php @@ -29,7 +29,7 @@ class PostCrmAttributesRequest extends JsonSerializableType public string $label; /** - * @var value-of $objectType The type of object the attribute belongs to (prefilled with `companies`, mandatory) + * @var value-of $objectType The type of object the attribute belongs to. Must be either `companies` or `deals`. */ #[JsonProperty('objectType')] public string $objectType; diff --git a/src/Companies/Types/GetCrmAttributesCompaniesResponseItem.php b/src/Companies/Types/GetCrmAttributesCompaniesResponseItem.php index f6c5f5fb..99f60562 100644 --- a/src/Companies/Types/GetCrmAttributesCompaniesResponseItem.php +++ b/src/Companies/Types/GetCrmAttributesCompaniesResponseItem.php @@ -7,57 +7,65 @@ use Brevo\Core\Types\ArrayType; /** - * List of attributes + * Company attribute details */ class GetCrmAttributesCompaniesResponseItem extends JsonSerializableType { /** - * @var ?array> $attributeOptions + * @var ?string $internalName Internal name of the attribute */ - #[JsonProperty('attributeOptions'), ArrayType([['string' => 'mixed']])] - public ?array $attributeOptions; + #[JsonProperty('internalName')] + public ?string $internalName; /** - * @var ?string $attributeTypeName + * @var ?string $attributeTypeName Type of the attribute */ #[JsonProperty('attributeTypeName')] public ?string $attributeTypeName; /** - * @var ?string $internalName + * @var ?string $label Display label of the attribute */ - #[JsonProperty('internalName')] - public ?string $internalName; + #[JsonProperty('label')] + public ?string $label; + + /** + * @var ?array $attributeOptions Options for single-select or multi-choice attributes + */ + #[JsonProperty('attributeOptions'), ArrayType([GetCrmAttributesCompaniesResponseItemAttributeOptionsItem::class])] + public ?array $attributeOptions; /** - * @var ?bool $isRequired + * @var ?bool $isRequired Whether this attribute is required */ #[JsonProperty('isRequired')] public ?bool $isRequired; /** - * @var ?string $label + * @var ?bool $isValueReadonly Whether this attribute value is read-only */ - #[JsonProperty('label')] - public ?string $label; + #[JsonProperty('isValueReadonly')] + public ?bool $isValueReadonly; /** * @param array{ - * attributeOptions?: ?array>, - * attributeTypeName?: ?string, * internalName?: ?string, - * isRequired?: ?bool, + * attributeTypeName?: ?string, * label?: ?string, + * attributeOptions?: ?array, + * isRequired?: ?bool, + * isValueReadonly?: ?bool, * } $values */ public function __construct( array $values = [], ) { - $this->attributeOptions = $values['attributeOptions'] ?? null; - $this->attributeTypeName = $values['attributeTypeName'] ?? null; $this->internalName = $values['internalName'] ?? null; - $this->isRequired = $values['isRequired'] ?? null; + $this->attributeTypeName = $values['attributeTypeName'] ?? null; $this->label = $values['label'] ?? null; + $this->attributeOptions = $values['attributeOptions'] ?? null; + $this->isRequired = $values['isRequired'] ?? null; + $this->isValueReadonly = $values['isValueReadonly'] ?? null; } /** diff --git a/src/Companies/Types/GetCrmAttributesCompaniesResponseItemAttributeOptionsItem.php b/src/Companies/Types/GetCrmAttributesCompaniesResponseItemAttributeOptionsItem.php new file mode 100644 index 00000000..0d20bf4d --- /dev/null +++ b/src/Companies/Types/GetCrmAttributesCompaniesResponseItemAttributeOptionsItem.php @@ -0,0 +1,42 @@ +key = $values['key'] ?? null; + $this->value = $values['value'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Contacts/ContactsClient.php b/src/Contacts/ContactsClient.php index 74152437..8de64a0e 100644 --- a/src/Contacts/ContactsClient.php +++ b/src/Contacts/ContactsClient.php @@ -92,6 +92,8 @@ public function __construct( } /** + * Retrieve all contacts from your Brevo account with support for pagination, filtering, and sorting. Results default to 50 contacts per page (maximum 1000) sorted in descending order of creation, and can be filtered by modification date, creation date, contact IDs (up to 20), list IDs, segment ID, or contact attributes using the equals operator. Note that either listIds or segmentId can be passed but not both simultaneously. + * * @param GetContactsRequest $request * @param ?array{ * baseUrl?: string, @@ -124,6 +126,9 @@ public function getContacts(GetContactsRequest $request = new GetContactsRequest if ($request->sort != null) { $query['sort'] = $request->sort; } + if ($request->ids != null) { + $query['ids'] = $request->ids; + } if ($request->segmentId != null) { $query['segmentId'] = $request->segmentId; } @@ -215,6 +220,8 @@ public function createContact(CreateContactRequest $request = new CreateContactR } /** + * Retrieve all contact attributes defined in your Brevo account, grouped by category (normal, transactional, category, calculated, global). Each attribute includes its name, type, and category, along with enumeration values for category-type attributes and options for multiple-choice-type attributes. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -260,6 +267,8 @@ public function getAttributes(?array $options = null): ?GetAttributesResponse } /** + * Create a new contact attribute under the specified category and name. The required body properties depend on the category: use "type" for normal, transactional, or category attributes; use "value" for calculated or global attributes; use "enumeration" for category attributes; and use "multiCategoryOptions" for normal multiple-choice attributes. None of the category or multicategory option values can exceed 200 characters. + * * @param value-of $attributeCategory Category of the attribute * @param string $attributeName Name of the attribute * @param CreateAttributeRequest $request @@ -302,6 +311,8 @@ public function createAttribute(string $attributeCategory, string $attributeName } /** + * Update an existing contact attribute identified by its category and name. For category-type attributes, you can update the enumeration values; for calculated or global attributes, update the computed value formula; and for normal multiple-choice attributes, update the multicategory options. None of the category or multicategory option values can exceed 200 characters. + * * @param value-of $attributeCategory Category of the attribute * @param string $attributeName Name of the existing attribute * @param UpdateAttributeRequest $request @@ -344,6 +355,8 @@ public function updateAttribute(string $attributeCategory, string $attributeName } /** + * Permanently delete an existing contact attribute by its category and name. The attribute must exist in the specified category (normal, transactional, category, calculated, or global), otherwise a 404 error is returned. + * * @param value-of $attributeCategory Category of the attribute * @param string $attributeName Name of the existing attribute * @param ?array{ @@ -384,6 +397,8 @@ public function deleteAttribute(string $attributeCategory, string $attributeName } /** + * Delete a specific option from an existing multiple-choice contact attribute. The attribute type must be "multiple-choice", and both the attribute name and the option to delete must already exist in your account. + * * @param 'multiple-choice' $attributeType Type of the attribute * @param string $multipleChoiceAttribute Name of the existing multiple-choice attribute * @param string $multipleChoiceAttributeOption Name of the existing multiple-choice attribute option that you want to delete @@ -425,6 +440,8 @@ public function deleteMultiAttributeOptions(string $attributeType, string $multi } /** + * Update multiple contacts in a single API call by passing an array of contact objects. Each contact in the array must be identified by one of: email, id, or sms (only one identifier per contact). You can update attributes, blacklist status, list memberships, ext_id, and transactional email forbidden senders for each contact in the batch. + * * @param UpdateBatchContactsRequest $request * @param ?array{ * baseUrl?: string, @@ -619,6 +636,8 @@ public function getFolders(GetFoldersRequest $request = new GetFoldersRequest(), } /** + * Create a new folder to organize your contact lists. Folders serve as containers for grouping related lists together. The folder name is required and must be provided in the request body. + * * @param CreateUpdateFolder $request * @param ?array{ * baseUrl?: string, @@ -716,6 +735,8 @@ public function getFolder(int $folderId, ?array $options = null): ?GetFolder } /** + * Update the name of an existing folder identified by its ID. The new folder name must be provided in the request body. Returns a 404 error if the folder ID does not exist. + * * @param int $folderId Id of the folder * @param UpdateFolderRequest $request * @param ?array{ @@ -757,6 +778,8 @@ public function updateFolder(int $folderId, UpdateFolderRequest $request, ?array } /** + * Permanently delete a folder identified by its ID. Deleting a folder will also delete all the contact lists contained within it. This action cannot be undone. + * * @param int $folderId Id of the folder * @param ?array{ * baseUrl?: string, @@ -968,6 +991,8 @@ public function getLists(GetListsRequest $request = new GetListsRequest(), ?arra } /** + * Create a new contact list inside a specified folder. Both the list name and the parent folder ID are required. The newly created list will be empty and ready to receive contacts via the add contacts endpoint. + * * @param CreateListRequest $request * @param ?array{ * baseUrl?: string, @@ -1015,6 +1040,8 @@ public function createList(CreateListRequest $request, ?array $options = null): } /** + * Retrieve the details of a specific contact list by its ID, including its name, folder ID, creation date, subscriber counts, and campaign statistics. You can optionally filter campaign statistics by providing startDate and endDate parameters (both must be used together in YYYY-MM-DD format). + * * @param int $listId Id of the list * @param GetListRequest $request * @param ?array{ @@ -1070,6 +1097,8 @@ public function getList(int $listId, GetListRequest $request = new GetListReques } /** + * Update an existing contact list identified by its ID. You can update the list name, move it to a different folder by providing a new folderId, or both. Only one of the two parameters (name, folderId) needs to be provided per request. + * * @param int $listId Id of the list * @param UpdateListRequest $request * @param ?array{ @@ -1111,6 +1140,8 @@ public function updateList(int $listId, UpdateListRequest $request = new UpdateL } /** + * Permanently delete a contact list identified by its ID. The contacts in the list are not deleted; they are only removed from this list. Returns a 404 error if the list ID does not exist. + * * @param int $listId Id of the list * @param ?array{ * baseUrl?: string, @@ -1150,6 +1181,8 @@ public function deleteList(int $listId, ?array $options = null): void } /** + * Retrieve all contacts belonging to a specific list, identified by its list ID. Results are paginated with a default of 50 contacts per page (maximum 500) and sorted in descending order of creation. You can optionally filter contacts by their modification date using the modifiedSince parameter. + * * @param int $listId Id of the list * @param GetContactsFromListRequest $request * @param ?array{ @@ -1307,6 +1340,8 @@ public function removeContactFromList(int $listId, RemoveContactFromListRequest } /** + * Retrieve all contact segments defined in your Brevo account with support for pagination and sorting. Results default to 10 segments per page (maximum 50) sorted in descending order of creation. Each segment includes its ID, name, category name, and last update timestamp. + * * @param GetSegmentsRequest $request * @param ?array{ * baseUrl?: string, @@ -1436,7 +1471,7 @@ public function getContactInfo(string|int $identifier, GetContactInfoRequest $re * @param ( * string * |int - * ) $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value + * ) $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE_NUMBER attribute value * @param UpdateContactRequest $request * @param ?array{ * baseUrl?: string, @@ -1532,6 +1567,8 @@ public function deleteContact(string|int $identifier, DeleteContactRequest $requ } /** + * Retrieve email campaign statistics for a specific contact identified by email address or numeric ID. Statistics include messages sent, opens, clicks, hard/soft bounces, deliveries, unsubscriptions, complaints, and transactional attributes. By default, data covers the last 90 days; use startDate and endDate parameters (YYYY-MM-DD) to specify a custom range with a maximum span of 90 days. + * * @param ( * string * |int diff --git a/src/Contacts/ContactsClientInterface.php b/src/Contacts/ContactsClientInterface.php index 55bcea41..f081b282 100644 --- a/src/Contacts/ContactsClientInterface.php +++ b/src/Contacts/ContactsClientInterface.php @@ -49,6 +49,8 @@ interface ContactsClientInterface { /** + * Retrieve all contacts from your Brevo account with support for pagination, filtering, and sorting. Results default to 50 contacts per page (maximum 1000) sorted in descending order of creation, and can be filtered by modification date, creation date, contact IDs (up to 20), list IDs, segment ID, or contact attributes using the equals operator. Note that either listIds or segmentId can be passed but not both simultaneously. + * * @param GetContactsRequest $request * @param ?array{ * baseUrl?: string, @@ -81,6 +83,8 @@ public function getContacts(GetContactsRequest $request = new GetContactsRequest public function createContact(CreateContactRequest $request = new CreateContactRequest(), ?array $options = null): ?CreateContactResponse; /** + * Retrieve all contact attributes defined in your Brevo account, grouped by category (normal, transactional, category, calculated, global). Each attribute includes its name, type, and category, along with enumeration values for category-type attributes and options for multiple-choice-type attributes. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -94,6 +98,8 @@ public function createContact(CreateContactRequest $request = new CreateContactR public function getAttributes(?array $options = null): ?GetAttributesResponse; /** + * Create a new contact attribute under the specified category and name. The required body properties depend on the category: use "type" for normal, transactional, or category attributes; use "value" for calculated or global attributes; use "enumeration" for category attributes; and use "multiCategoryOptions" for normal multiple-choice attributes. None of the category or multicategory option values can exceed 200 characters. + * * @param value-of $attributeCategory Category of the attribute * @param string $attributeName Name of the attribute * @param CreateAttributeRequest $request @@ -109,6 +115,8 @@ public function getAttributes(?array $options = null): ?GetAttributesResponse; public function createAttribute(string $attributeCategory, string $attributeName, CreateAttributeRequest $request = new CreateAttributeRequest(), ?array $options = null): void; /** + * Update an existing contact attribute identified by its category and name. For category-type attributes, you can update the enumeration values; for calculated or global attributes, update the computed value formula; and for normal multiple-choice attributes, update the multicategory options. None of the category or multicategory option values can exceed 200 characters. + * * @param value-of $attributeCategory Category of the attribute * @param string $attributeName Name of the existing attribute * @param UpdateAttributeRequest $request @@ -124,6 +132,8 @@ public function createAttribute(string $attributeCategory, string $attributeName public function updateAttribute(string $attributeCategory, string $attributeName, UpdateAttributeRequest $request = new UpdateAttributeRequest(), ?array $options = null): void; /** + * Permanently delete an existing contact attribute by its category and name. The attribute must exist in the specified category (normal, transactional, category, calculated, or global), otherwise a 404 error is returned. + * * @param value-of $attributeCategory Category of the attribute * @param string $attributeName Name of the existing attribute * @param ?array{ @@ -138,6 +148,8 @@ public function updateAttribute(string $attributeCategory, string $attributeName public function deleteAttribute(string $attributeCategory, string $attributeName, ?array $options = null): void; /** + * Delete a specific option from an existing multiple-choice contact attribute. The attribute type must be "multiple-choice", and both the attribute name and the option to delete must already exist in your account. + * * @param 'multiple-choice' $attributeType Type of the attribute * @param string $multipleChoiceAttribute Name of the existing multiple-choice attribute * @param string $multipleChoiceAttributeOption Name of the existing multiple-choice attribute option that you want to delete @@ -153,6 +165,8 @@ public function deleteAttribute(string $attributeCategory, string $attributeName public function deleteMultiAttributeOptions(string $attributeType, string $multipleChoiceAttribute, string $multipleChoiceAttributeOption, ?array $options = null): void; /** + * Update multiple contacts in a single API call by passing an array of contact objects. Each contact in the array must be identified by one of: email, id, or sms (only one identifier per contact). You can update attributes, blacklist status, list memberships, ext_id, and transactional email forbidden senders for each contact in the batch. + * * @param UpdateBatchContactsRequest $request * @param ?array{ * baseUrl?: string, @@ -217,6 +231,8 @@ public function requestContactExport(RequestContactExportRequest $request, ?arra public function getFolders(GetFoldersRequest $request = new GetFoldersRequest(), ?array $options = null): ?GetFoldersResponse; /** + * Create a new folder to organize your contact lists. Folders serve as containers for grouping related lists together. The folder name is required and must be provided in the request body. + * * @param CreateUpdateFolder $request * @param ?array{ * baseUrl?: string, @@ -249,6 +265,8 @@ public function createFolder(CreateUpdateFolder $request, ?array $options = null public function getFolder(int $folderId, ?array $options = null): ?GetFolder; /** + * Update the name of an existing folder identified by its ID. The new folder name must be provided in the request body. Returns a 404 error if the folder ID does not exist. + * * @param int $folderId Id of the folder * @param UpdateFolderRequest $request * @param ?array{ @@ -263,6 +281,8 @@ public function getFolder(int $folderId, ?array $options = null): ?GetFolder; public function updateFolder(int $folderId, UpdateFolderRequest $request, ?array $options = null): void; /** + * Permanently delete a folder identified by its ID. Deleting a folder will also delete all the contact lists contained within it. This action cannot be undone. + * * @param int $folderId Id of the folder * @param ?array{ * baseUrl?: string, @@ -329,6 +349,8 @@ public function importContacts(ImportContactsRequest $request = new ImportContac public function getLists(GetListsRequest $request = new GetListsRequest(), ?array $options = null): ?GetListsResponse; /** + * Create a new contact list inside a specified folder. Both the list name and the parent folder ID are required. The newly created list will be empty and ready to receive contacts via the add contacts endpoint. + * * @param CreateListRequest $request * @param ?array{ * baseUrl?: string, @@ -343,6 +365,8 @@ public function getLists(GetListsRequest $request = new GetListsRequest(), ?arra public function createList(CreateListRequest $request, ?array $options = null): ?CreateListResponse; /** + * Retrieve the details of a specific contact list by its ID, including its name, folder ID, creation date, subscriber counts, and campaign statistics. You can optionally filter campaign statistics by providing startDate and endDate parameters (both must be used together in YYYY-MM-DD format). + * * @param int $listId Id of the list * @param GetListRequest $request * @param ?array{ @@ -358,6 +382,8 @@ public function createList(CreateListRequest $request, ?array $options = null): public function getList(int $listId, GetListRequest $request = new GetListRequest(), ?array $options = null): ?GetListResponse; /** + * Update an existing contact list identified by its ID. You can update the list name, move it to a different folder by providing a new folderId, or both. Only one of the two parameters (name, folderId) needs to be provided per request. + * * @param int $listId Id of the list * @param UpdateListRequest $request * @param ?array{ @@ -372,6 +398,8 @@ public function getList(int $listId, GetListRequest $request = new GetListReques public function updateList(int $listId, UpdateListRequest $request = new UpdateListRequest(), ?array $options = null): void; /** + * Permanently delete a contact list identified by its ID. The contacts in the list are not deleted; they are only removed from this list. Returns a 404 error if the list ID does not exist. + * * @param int $listId Id of the list * @param ?array{ * baseUrl?: string, @@ -385,6 +413,8 @@ public function updateList(int $listId, UpdateListRequest $request = new UpdateL public function deleteList(int $listId, ?array $options = null): void; /** + * Retrieve all contacts belonging to a specific list, identified by its list ID. Results are paginated with a default of 50 contacts per page (maximum 500) and sorted in descending order of creation. You can optionally filter contacts by their modification date using the modifiedSince parameter. + * * @param int $listId Id of the list * @param GetContactsFromListRequest $request * @param ?array{ @@ -430,6 +460,8 @@ public function addContactToList(int $listId, AddContactToListRequest $request, public function removeContactFromList(int $listId, RemoveContactFromListRequest $request, ?array $options = null): ?PostContactInfo; /** + * Retrieve all contact segments defined in your Brevo account with support for pagination and sorting. Results default to 10 segments per page (maximum 50) sorted in descending order of creation. Each segment includes its ID, name, category name, and last update timestamp. + * * @param GetSegmentsRequest $request * @param ?array{ * baseUrl?: string, @@ -473,7 +505,7 @@ public function getContactInfo(string|int $identifier, GetContactInfoRequest $re * @param ( * string * |int - * ) $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE attribute value + * ) $identifier Email (urlencoded) OR ID of the contact OR EXT_ID attribute (urlencoded) OR its SMS attribute value OR its WHATSAPP attribute value OR its LANDLINE_NUMBER attribute value * @param UpdateContactRequest $request * @param ?array{ * baseUrl?: string, @@ -506,6 +538,8 @@ public function updateContact(string|int $identifier, UpdateContactRequest $requ public function deleteContact(string|int $identifier, DeleteContactRequest $request = new DeleteContactRequest(), ?array $options = null): void; /** + * Retrieve email campaign statistics for a specific contact identified by email address or numeric ID. Statistics include messages sent, opens, clicks, hard/soft bounces, deliveries, unsubscriptions, complaints, and transactional attributes. By default, data covers the last 90 days; use startDate and endDate parameters (YYYY-MM-DD) to specify a custom range with a maximum span of 90 days. + * * @param ( * string * |int diff --git a/src/Contacts/Requests/CreateContactRequest.php b/src/Contacts/Requests/CreateContactRequest.php index 88bfa8e0..6add6f53 100644 --- a/src/Contacts/Requests/CreateContactRequest.php +++ b/src/Contacts/Requests/CreateContactRequest.php @@ -63,6 +63,18 @@ class CreateContactRequest extends JsonSerializableType #[JsonProperty('updateEnabled')] public ?bool $updateEnabled; + /** + * @var ?bool $forceMerge When true, if the contact being created shares an identifier (email, SMS, ext_id, whatsapp, landline) with an existing contact, the two contacts are force-merged. The contact with the most recent `last_modified` timestamp is retained; the other is deleted. When false (default), a 4xx error is returned on identifier conflict. + */ + #[JsonProperty('forceMerge')] + public ?bool $forceMerge; + + /** + * @var ?bool $getId When true, the response returns the `id` of the surviving contact after merge. + */ + #[JsonProperty('getId')] + public ?bool $getId; + /** * @param array{ * attributes?: ?array, * updateEnabled?: ?bool, + * forceMerge?: ?bool, + * getId?: ?bool, * } $values */ public function __construct( @@ -92,5 +106,7 @@ public function __construct( $this->smsBlacklisted = $values['smsBlacklisted'] ?? null; $this->smtpBlacklistSender = $values['smtpBlacklistSender'] ?? null; $this->updateEnabled = $values['updateEnabled'] ?? null; + $this->forceMerge = $values['forceMerge'] ?? null; + $this->getId = $values['getId'] ?? null; } } diff --git a/src/Contacts/Requests/GetContactInfoRequest.php b/src/Contacts/Requests/GetContactInfoRequest.php index 58709593..58f895eb 100644 --- a/src/Contacts/Requests/GetContactInfoRequest.php +++ b/src/Contacts/Requests/GetContactInfoRequest.php @@ -13,12 +13,12 @@ class GetContactInfoRequest extends JsonSerializableType public ?string $identifierType; /** - * @var ?string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate + * @var ?string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate. Must not be greater than the current date. */ public ?string $startDate; /** - * @var ?string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. + * @var ?string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Must not be greater than the current date. */ public ?string $endDate; diff --git a/src/Contacts/Requests/GetContactStatsRequest.php b/src/Contacts/Requests/GetContactStatsRequest.php index f6c37224..1bce5b15 100644 --- a/src/Contacts/Requests/GetContactStatsRequest.php +++ b/src/Contacts/Requests/GetContactStatsRequest.php @@ -7,12 +7,12 @@ class GetContactStatsRequest extends JsonSerializableType { /** - * @var ?string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate + * @var ?string $startDate **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate. Must not be greater than the current date. */ public ?string $startDate; /** - * @var ?string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Maximum difference between startDate and endDate should not be greater than 90 days + * @var ?string $endDate **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate. Must not be greater than the current date. Maximum difference between startDate and endDate should not be greater than 90 days. */ public ?string $endDate; diff --git a/src/Contacts/Requests/GetContactsRequest.php b/src/Contacts/Requests/GetContactsRequest.php index c5c230a3..ade25f01 100644 --- a/src/Contacts/Requests/GetContactsRequest.php +++ b/src/Contacts/Requests/GetContactsRequest.php @@ -33,7 +33,12 @@ class GetContactsRequest extends JsonSerializableType public ?string $sort; /** - * @var ?int $segmentId Id of the segment. **Either listIds or segmentId can be passed.** + * @var ?array $ids Filter by a list of contact IDs. You can pass a **maximum of 20 IDs**. All elements must be integers. + */ + public ?array $ids; + + /** + * @var ?int $segmentId Id of the segment. **Either listIds or segmentId can be passed.** Must be a positive integer (minimum value of 1). */ public ?int $segmentId; @@ -54,6 +59,7 @@ class GetContactsRequest extends JsonSerializableType * modifiedSince?: ?string, * createdSince?: ?string, * sort?: ?value-of, + * ids?: ?array, * segmentId?: ?int, * listIds?: ?array, * filter?: ?string, @@ -67,6 +73,7 @@ public function __construct( $this->modifiedSince = $values['modifiedSince'] ?? null; $this->createdSince = $values['createdSince'] ?? null; $this->sort = $values['sort'] ?? null; + $this->ids = $values['ids'] ?? null; $this->segmentId = $values['segmentId'] ?? null; $this->listIds = $values['listIds'] ?? null; $this->filter = $values['filter'] ?? null; diff --git a/src/Contacts/Requests/GetListRequest.php b/src/Contacts/Requests/GetListRequest.php index 6b8f8307..16f1276d 100644 --- a/src/Contacts/Requests/GetListRequest.php +++ b/src/Contacts/Requests/GetListRequest.php @@ -7,7 +7,7 @@ class GetListRequest extends JsonSerializableType { /** - * @var ?string $startDate **Mandatory if endDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** + * @var ?string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to aggregate the sent email campaigns for a specific list id. **Prefer to pass your timezone in date-time format for accurate result** */ public ?string $startDate; diff --git a/src/Contacts/Requests/UpdateContactRequest.php b/src/Contacts/Requests/UpdateContactRequest.php index 89b2de3e..3be5c6fe 100644 --- a/src/Contacts/Requests/UpdateContactRequest.php +++ b/src/Contacts/Requests/UpdateContactRequest.php @@ -11,7 +11,7 @@ class UpdateContactRequest extends JsonSerializableType { /** - * @var ?value-of $identifierType email_id for Email, 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 + * @var ?value-of $identifierType email_id for Email, 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_NUMBER attribute */ public ?string $identifierType; @@ -63,6 +63,12 @@ class UpdateContactRequest extends JsonSerializableType #[JsonProperty('unlinkListIds'), ArrayType(['integer'])] public ?array $unlinkListIds; + /** + * @var ?bool $forceMerge When true, if the contact being updated shares an identifier (email, SMS, ext_id, whatsapp, landline) with an existing contact, the two contacts are force-merged. The contact with the most recent `last_modified` timestamp is retained; the other is deleted. When false (default), a 4xx error is returned on identifier conflict. + */ + #[JsonProperty('forceMerge')] + public ?bool $forceMerge; + /** * @param array{ * identifierType?: ?value-of, @@ -79,6 +85,7 @@ class UpdateContactRequest extends JsonSerializableType * smsBlacklisted?: ?bool, * smtpBlacklistSender?: ?array, * unlinkListIds?: ?array, + * forceMerge?: ?bool, * } $values */ public function __construct( @@ -92,5 +99,6 @@ public function __construct( $this->smsBlacklisted = $values['smsBlacklisted'] ?? null; $this->smtpBlacklistSender = $values['smtpBlacklistSender'] ?? null; $this->unlinkListIds = $values['unlinkListIds'] ?? null; + $this->forceMerge = $values['forceMerge'] ?? null; } } diff --git a/src/Contacts/Types/GetAttributesResponseAttributesItemEnumerationItem.php b/src/Contacts/Types/GetAttributesResponseAttributesItemEnumerationItem.php index 46c7b25a..743aa7ef 100644 --- a/src/Contacts/Types/GetAttributesResponseAttributesItemEnumerationItem.php +++ b/src/Contacts/Types/GetAttributesResponseAttributesItemEnumerationItem.php @@ -14,15 +14,22 @@ class GetAttributesResponseAttributesItemEnumerationItem extends JsonSerializabl public string $label; /** - * @var int $value ID of Value of the "category" type attribute + * @var int $value Numeric ID of the "category" type attribute value. Set to 0 when the raw value cannot be converted to an integer (for example non-numeric values such as "en" or "fr"). Refer to `valueStr` for the original string representation. */ #[JsonProperty('value')] public int $value; + /** + * @var string $valueStr String representation of the "category" type attribute value. Always contains the original value as stored. Use this field when the attribute value is non-numeric (e.g. "en", "fr") or when you need the exact string form alongside the numeric `value`. + */ + #[JsonProperty('valueStr')] + public string $valueStr; + /** * @param array{ * label: string, * value: int, + * valueStr: string, * } $values */ public function __construct( @@ -30,6 +37,7 @@ public function __construct( ) { $this->label = $values['label']; $this->value = $values['value']; + $this->valueStr = $values['valueStr']; } /** diff --git a/src/Contacts/Types/GetContactInfoResponse.php b/src/Contacts/Types/GetContactInfoResponse.php index 73d85be5..6e78d37c 100644 --- a/src/Contacts/Types/GetContactInfoResponse.php +++ b/src/Contacts/Types/GetContactInfoResponse.php @@ -62,6 +62,12 @@ class GetContactInfoResponse extends JsonSerializableType #[JsonProperty('smsBlacklisted')] public bool $smsBlacklisted; + /** + * @var bool $whatsappBlacklisted Blacklist status for WhatsApp campaigns (true=blacklisted, false=not blacklisted) + */ + #[JsonProperty('whatsappBlacklisted')] + public bool $whatsappBlacklisted; + /** * @var GetContactInfoResponseStatistics $statistics Campaign statistics of the contact */ @@ -77,6 +83,7 @@ class GetContactInfoResponse extends JsonSerializableType * listIds: array, * modifiedAt: string, * smsBlacklisted: bool, + * whatsappBlacklisted: bool, * statistics: GetContactInfoResponseStatistics, * email?: ?string, * listUnsubscribed?: ?array, @@ -94,6 +101,7 @@ public function __construct( $this->listUnsubscribed = $values['listUnsubscribed'] ?? null; $this->modifiedAt = $values['modifiedAt']; $this->smsBlacklisted = $values['smsBlacklisted']; + $this->whatsappBlacklisted = $values['whatsappBlacklisted']; $this->statistics = $values['statistics']; } diff --git a/src/Contacts/Types/GetContactInfoResponseStatistics.php b/src/Contacts/Types/GetContactInfoResponseStatistics.php index ef4cee64..494d72b7 100644 --- a/src/Contacts/Types/GetContactInfoResponseStatistics.php +++ b/src/Contacts/Types/GetContactInfoResponseStatistics.php @@ -30,7 +30,7 @@ class GetContactInfoResponseStatistics extends JsonSerializableType public ?array $delivered; /** - * @var ?array $hardBounces Listing of the hardbounes generated by the contact + * @var ?array $hardBounces Listing of the hard bounces generated by the contact */ #[JsonProperty('hardBounces'), ArrayType([GetContactInfoResponseStatisticsHardBouncesItem::class])] public ?array $hardBounces; @@ -48,7 +48,7 @@ class GetContactInfoResponseStatistics extends JsonSerializableType public ?array $opened; /** - * @var ?array $softBounces Listing of the softbounes generated by the contact + * @var ?array $softBounces Listing of the soft bounces generated by the contact */ #[JsonProperty('softBounces'), ArrayType([GetContactInfoResponseStatisticsSoftBouncesItem::class])] public ?array $softBounces; diff --git a/src/Contacts/Types/GetSegmentsResponseSegmentsItem.php b/src/Contacts/Types/GetSegmentsResponseSegmentsItem.php index b9918d03..e4e8f8d5 100644 --- a/src/Contacts/Types/GetSegmentsResponseSegmentsItem.php +++ b/src/Contacts/Types/GetSegmentsResponseSegmentsItem.php @@ -14,7 +14,7 @@ class GetSegmentsResponseSegmentsItem extends JsonSerializableType public string $categoryName; /** - * @var int $id ID of the list + * @var int $id ID of the segment */ #[JsonProperty('id')] public int $id; @@ -26,7 +26,7 @@ class GetSegmentsResponseSegmentsItem extends JsonSerializableType public string $segmentName; /** - * @var ?string $updatedAt Updation UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ) + * @var ?string $updatedAt Last update UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ) */ #[JsonProperty('updatedAt')] public ?string $updatedAt; diff --git a/src/Conversations/ConversationsClient.php b/src/Conversations/ConversationsClient.php index 153f0593..d8ca8039 100644 --- a/src/Conversations/ConversationsClient.php +++ b/src/Conversations/ConversationsClient.php @@ -57,7 +57,7 @@ public function __construct( } /** - * We recommend pinging this endpoint every minute for as long as the agent has to be considered online. + * Sets the agent's status to online for 2-3 minutes. We recommend pinging this endpoint every minute for as long as the agent has to be considered online. You must provide either `agentId` alone, or all three of `agentEmail` + `agentName` + `receivedFrom`. * * @param PostConversationsAgentOnlinePingRequest $request * @param ?array{ @@ -99,6 +99,8 @@ public function setsAgentsStatusToOnlineFor23Minutes(PostConversationsAgentOnlin } /** + * Send a message as an agent to an existing visitor's conversation. You must provide either `agentId` alone, or all three of `agentEmail` + `agentName` + `receivedFrom` to identify the agent. + * * @param PostConversationsMessagesRequest $request * @param ?array{ * baseUrl?: string, @@ -146,6 +148,8 @@ public function sendAMessageAsAnAgent(PostConversationsMessagesRequest $request, } /** + * Retrieve a single message by its ID. + * * @param string $id ID of the message * @param ?array{ * baseUrl?: string, @@ -192,7 +196,7 @@ public function getAMessage(string $id, ?array $options = null): ?ConversationsM } /** - * Only agents’ messages can be edited. + * Update the text of a message sent by an agent. Only messages of type `agent` can be edited. The `text` and `html` fields of the message will be updated. * * @param string $id ID of the message * @param PutConversationsMessagesIdRequest $request @@ -242,7 +246,7 @@ public function updateAMessageSentByAnAgent(string $id, PutConversationsMessages } /** - * Only agents’ messages can be deleted. + * Delete a message sent by an agent. Only messages of type `agent` can be deleted. * * @param string $id ID of the message * @param ?array{ @@ -283,7 +287,7 @@ public function deleteAMessageSentByAnAgent(string $id, ?array $options = null): } /** - * Example of automated messages: order status, announce new features in your web app, etc. + * Send an automated (pushed) message to a visitor on behalf of an agent. Example use cases: order status updates, announcing new features in your web app, etc. * * @param PostConversationsPushedMessagesRequest $request * @param ?array{ @@ -332,6 +336,8 @@ public function sendAnAutomatedMessageToAVisitor(PostConversationsPushedMessages } /** + * Retrieve a single automated (pushed) message by its ID. + * * @param string $id ID of the message sent previously * @param ?array{ * baseUrl?: string, @@ -378,6 +384,8 @@ public function getAnAutomatedMessage(string $id, ?array $options = null): ?Conv } /** + * Update the text of an automated (pushed) message. The `text` and `html` fields of the message will be updated. + * * @param string $id ID of the message * @param PutConversationsPushedMessagesIdRequest $request * @param ?array{ @@ -426,6 +434,8 @@ public function updateAnAutomatedMessage(string $id, PutConversationsPushedMessa } /** + * Delete an automated (pushed) message by its ID. + * * @param string $id ID of the message * @param ?array{ * baseUrl?: string, diff --git a/src/Conversations/ConversationsClientInterface.php b/src/Conversations/ConversationsClientInterface.php index 2b878783..ad7e5e8d 100644 --- a/src/Conversations/ConversationsClientInterface.php +++ b/src/Conversations/ConversationsClientInterface.php @@ -14,7 +14,7 @@ interface ConversationsClientInterface { /** - * We recommend pinging this endpoint every minute for as long as the agent has to be considered online. + * Sets the agent's status to online for 2-3 minutes. We recommend pinging this endpoint every minute for as long as the agent has to be considered online. You must provide either `agentId` alone, or all three of `agentEmail` + `agentName` + `receivedFrom`. * * @param PostConversationsAgentOnlinePingRequest $request * @param ?array{ @@ -29,6 +29,8 @@ interface ConversationsClientInterface public function setsAgentsStatusToOnlineFor23Minutes(PostConversationsAgentOnlinePingRequest $request = new PostConversationsAgentOnlinePingRequest(), ?array $options = null): void; /** + * Send a message as an agent to an existing visitor's conversation. You must provide either `agentId` alone, or all three of `agentEmail` + `agentName` + `receivedFrom` to identify the agent. + * * @param PostConversationsMessagesRequest $request * @param ?array{ * baseUrl?: string, @@ -43,6 +45,8 @@ public function setsAgentsStatusToOnlineFor23Minutes(PostConversationsAgentOnlin public function sendAMessageAsAnAgent(PostConversationsMessagesRequest $request, ?array $options = null): ?ConversationsMessage; /** + * Retrieve a single message by its ID. + * * @param string $id ID of the message * @param ?array{ * baseUrl?: string, @@ -57,7 +61,7 @@ public function sendAMessageAsAnAgent(PostConversationsMessagesRequest $request, public function getAMessage(string $id, ?array $options = null): ?ConversationsMessage; /** - * Only agents’ messages can be edited. + * Update the text of a message sent by an agent. Only messages of type `agent` can be edited. The `text` and `html` fields of the message will be updated. * * @param string $id ID of the message * @param PutConversationsMessagesIdRequest $request @@ -74,7 +78,7 @@ public function getAMessage(string $id, ?array $options = null): ?ConversationsM public function updateAMessageSentByAnAgent(string $id, PutConversationsMessagesIdRequest $request, ?array $options = null): ?ConversationsMessage; /** - * Only agents’ messages can be deleted. + * Delete a message sent by an agent. Only messages of type `agent` can be deleted. * * @param string $id ID of the message * @param ?array{ @@ -89,7 +93,7 @@ public function updateAMessageSentByAnAgent(string $id, PutConversationsMessages public function deleteAMessageSentByAnAgent(string $id, ?array $options = null): void; /** - * Example of automated messages: order status, announce new features in your web app, etc. + * Send an automated (pushed) message to a visitor on behalf of an agent. Example use cases: order status updates, announcing new features in your web app, etc. * * @param PostConversationsPushedMessagesRequest $request * @param ?array{ @@ -105,6 +109,8 @@ public function deleteAMessageSentByAnAgent(string $id, ?array $options = null): public function sendAnAutomatedMessageToAVisitor(PostConversationsPushedMessagesRequest $request, ?array $options = null): ?ConversationsMessage; /** + * Retrieve a single automated (pushed) message by its ID. + * * @param string $id ID of the message sent previously * @param ?array{ * baseUrl?: string, @@ -119,6 +125,8 @@ public function sendAnAutomatedMessageToAVisitor(PostConversationsPushedMessages public function getAnAutomatedMessage(string $id, ?array $options = null): ?ConversationsMessage; /** + * Update the text of an automated (pushed) message. The `text` and `html` fields of the message will be updated. + * * @param string $id ID of the message * @param PutConversationsPushedMessagesIdRequest $request * @param ?array{ @@ -134,6 +142,8 @@ public function getAnAutomatedMessage(string $id, ?array $options = null): ?Conv public function updateAnAutomatedMessage(string $id, PutConversationsPushedMessagesIdRequest $request, ?array $options = null): ?ConversationsMessage; /** + * Delete an automated (pushed) message by its ID. + * * @param string $id ID of the message * @param ?array{ * baseUrl?: string, diff --git a/src/Conversations/Requests/PostConversationsAgentOnlinePingRequest.php b/src/Conversations/Requests/PostConversationsAgentOnlinePingRequest.php index cfcb20ea..40fec474 100644 --- a/src/Conversations/Requests/PostConversationsAgentOnlinePingRequest.php +++ b/src/Conversations/Requests/PostConversationsAgentOnlinePingRequest.php @@ -8,35 +8,35 @@ class PostConversationsAgentOnlinePingRequest extends JsonSerializableType { /** - * @var mixed $agentEmail agent email. When sending online pings from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there’s no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. + * @var ?string $agentEmail Agent's email address. When sending online pings from a standalone system, it's hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. If there's no agent with the specified email address in your Brevo organization, a dummy agent will be created automatically. */ #[JsonProperty('agentEmail')] - public mixed $agentEmail; + public ?string $agentEmail; /** - * @var mixed $agentId agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). + * @var ?string $agentId Agent ID. It can be found on the agent's page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). */ #[JsonProperty('agentId')] - public mixed $agentId; + public ?string $agentId; /** - * @var mixed $agentName agent name + * @var ?string $agentName Agent's name. */ #[JsonProperty('agentName')] - public mixed $agentName; + public ?string $agentName; /** - * @var mixed $receivedFrom mark your messages to distinguish messages created by you from the others. + * @var ?string $receivedFrom Mark your messages to distinguish messages created by you from the others. */ #[JsonProperty('receivedFrom')] - public mixed $receivedFrom; + public ?string $receivedFrom; /** * @param array{ - * agentEmail?: mixed, - * agentId?: mixed, - * agentName?: mixed, - * receivedFrom?: mixed, + * agentEmail?: ?string, + * agentId?: ?string, + * agentName?: ?string, + * receivedFrom?: ?string, * } $values */ public function __construct( diff --git a/src/Conversations/Requests/PostConversationsMessagesRequest.php b/src/Conversations/Requests/PostConversationsMessagesRequest.php index 1f3d886b..423d5c45 100644 --- a/src/Conversations/Requests/PostConversationsMessagesRequest.php +++ b/src/Conversations/Requests/PostConversationsMessagesRequest.php @@ -8,49 +8,49 @@ class PostConversationsMessagesRequest extends JsonSerializableType { /** - * @var mixed $agentEmail agent email. When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. + * @var ?string $agentEmail Agent's email address. When sending messages from a standalone system, it's hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address. */ #[JsonProperty('agentEmail')] - public mixed $agentEmail; + public ?string $agentEmail; /** - * @var mixed $agentId agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). + * @var ?string $agentId Agent ID. It can be found on the agent's page or received from a webhook. Alternatively, you can use `agentEmail` + `agentName` + `receivedFrom` instead (all 3 fields required). */ #[JsonProperty('agentId')] - public mixed $agentId; + public ?string $agentId; /** - * @var mixed $agentName agent name + * @var ?string $agentName Agent's name. */ #[JsonProperty('agentName')] - public mixed $agentName; + public ?string $agentName; /** - * @var mixed $receivedFrom mark your messages to distinguish messages created by you from the others. + * @var ?string $receivedFrom Mark your messages to distinguish messages created by you from the others. */ #[JsonProperty('receivedFrom')] - public mixed $receivedFrom; + public ?string $receivedFrom; /** - * @var mixed $text + * @var string $text Message text. */ #[JsonProperty('text')] - public mixed $text; + public string $text; /** - * @var mixed $visitorId + * @var string $visitorId Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations. */ #[JsonProperty('visitorId')] - public mixed $visitorId; + public string $visitorId; /** * @param array{ - * text: mixed, - * visitorId: mixed, - * agentEmail?: mixed, - * agentId?: mixed, - * agentName?: mixed, - * receivedFrom?: mixed, + * text: string, + * visitorId: string, + * agentEmail?: ?string, + * agentId?: ?string, + * agentName?: ?string, + * receivedFrom?: ?string, * } $values */ public function __construct( diff --git a/src/Conversations/Requests/PostConversationsPushedMessagesRequest.php b/src/Conversations/Requests/PostConversationsPushedMessagesRequest.php index 70a8a687..41052890 100644 --- a/src/Conversations/Requests/PostConversationsPushedMessagesRequest.php +++ b/src/Conversations/Requests/PostConversationsPushedMessagesRequest.php @@ -8,35 +8,35 @@ class PostConversationsPushedMessagesRequest extends JsonSerializableType { /** - * @var mixed $agentId agent ID. It can be found on agent’s page or received from a webhook. + * @var ?string $agentId Agent ID. It can be found on the agent's page or received from a webhook. */ #[JsonProperty('agentId')] - public mixed $agentId; + public ?string $agentId; /** - * @var mixed $groupId group ID. It can be found on group’s page. + * @var ?string $groupId Group ID. It can be found on the group's page. */ #[JsonProperty('groupId')] - public mixed $groupId; + public ?string $groupId; /** - * @var mixed $text + * @var string $text Message text. */ #[JsonProperty('text')] - public mixed $text; + public string $text; /** - * @var mixed $visitorId + * @var string $visitorId Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations. */ #[JsonProperty('visitorId')] - public mixed $visitorId; + public string $visitorId; /** * @param array{ - * text: mixed, - * visitorId: mixed, - * agentId?: mixed, - * groupId?: mixed, + * text: string, + * visitorId: string, + * agentId?: ?string, + * groupId?: ?string, * } $values */ public function __construct( diff --git a/src/Conversations/Requests/PutConversationsMessagesIdRequest.php b/src/Conversations/Requests/PutConversationsMessagesIdRequest.php index 467c3e8d..dfb0fc0c 100644 --- a/src/Conversations/Requests/PutConversationsMessagesIdRequest.php +++ b/src/Conversations/Requests/PutConversationsMessagesIdRequest.php @@ -8,7 +8,7 @@ class PutConversationsMessagesIdRequest extends JsonSerializableType { /** - * @var string $text edited message text + * @var string $text The new message text. */ #[JsonProperty('text')] public string $text; diff --git a/src/Conversations/Requests/PutConversationsPushedMessagesIdRequest.php b/src/Conversations/Requests/PutConversationsPushedMessagesIdRequest.php index 667277b7..152f8d83 100644 --- a/src/Conversations/Requests/PutConversationsPushedMessagesIdRequest.php +++ b/src/Conversations/Requests/PutConversationsPushedMessagesIdRequest.php @@ -8,7 +8,7 @@ class PutConversationsPushedMessagesIdRequest extends JsonSerializableType { /** - * @var string $text edited message text + * @var string $text The new message text. */ #[JsonProperty('text')] public string $text; diff --git a/src/Coupons/CouponsClient.php b/src/Coupons/CouponsClient.php index c305b3a0..92b9c9c8 100644 --- a/src/Coupons/CouponsClient.php +++ b/src/Coupons/CouponsClient.php @@ -56,6 +56,8 @@ public function __construct( } /** + * Retrieve a paginated list of all coupon collections in your Brevo account. Results can be sorted by creation date, remaining coupons count, or expiration date, in ascending or descending order. Pagination defaults to 50 collections per page (maximum 100). + * * @param GetCouponCollectionsRequest $request * @param ?array{ * baseUrl?: string, @@ -116,6 +118,8 @@ public function getCouponCollections(GetCouponCollectionsRequest $request = new } /** + * Create a new coupon collection with a name and a default coupon value. You can optionally set an expiration date in RFC3339 format and configure alert thresholds to receive email notifications when remaining coupons or remaining days before expiration fall below a specified number. The collection ID is auto-generated as a UUID and returned in the response. + * * @param CreateCouponCollectionRequest $request * @param ?array{ * baseUrl?: string, @@ -163,6 +167,8 @@ public function createCouponCollection(CreateCouponCollectionRequest $request, ? } /** + * Retrieve the details of a single coupon collection by its UUID. The response includes the collection name, default coupon value, total and remaining coupon counts, and creation timestamp. Returns a `404` error if no collection matches the provided ID. + * * @param string $id Id of the collection to return * @param ?array{ * baseUrl?: string, @@ -209,6 +215,8 @@ public function getCouponCollection(string $id, ?array $options = null): ?GetCou } /** + * Update an existing coupon collection by its UUID. You can modify the default coupon value, set or remove the expiration date (pass `null` to remove), and configure or disable alert thresholds for remaining coupons or remaining days. Only the fields included in the request body are updated; omitted fields remain unchanged. + * * @param string $id Id of the collection to update * @param UpdateCouponCollectionRequest $request * @param ?array{ @@ -257,6 +265,8 @@ public function updateCouponCollection(string $id, UpdateCouponCollectionRequest } /** + * Add coupons to an existing coupon collection. The `coupons` array must contain between 1 and 10,000 unique coupon code strings, all associated with the specified `collectionId`. Coupon creation is processed asynchronously and a `204` status is returned immediately upon acceptance. Returns a `404` error if the specified coupon collection does not exist. + * * @param CreateCouponsRequest $request * @param ?array{ * baseUrl?: string, diff --git a/src/Coupons/CouponsClientInterface.php b/src/Coupons/CouponsClientInterface.php index f0a9a725..4b9a2a3d 100644 --- a/src/Coupons/CouponsClientInterface.php +++ b/src/Coupons/CouponsClientInterface.php @@ -13,6 +13,8 @@ interface CouponsClientInterface { /** + * Retrieve a paginated list of all coupon collections in your Brevo account. Results can be sorted by creation date, remaining coupons count, or expiration date, in ascending or descending order. Pagination defaults to 50 collections per page (maximum 100). + * * @param GetCouponCollectionsRequest $request * @param ?array{ * baseUrl?: string, @@ -27,6 +29,8 @@ interface CouponsClientInterface public function getCouponCollections(GetCouponCollectionsRequest $request = new GetCouponCollectionsRequest(), ?array $options = null): ?GetCouponCollection; /** + * Create a new coupon collection with a name and a default coupon value. You can optionally set an expiration date in RFC3339 format and configure alert thresholds to receive email notifications when remaining coupons or remaining days before expiration fall below a specified number. The collection ID is auto-generated as a UUID and returned in the response. + * * @param CreateCouponCollectionRequest $request * @param ?array{ * baseUrl?: string, @@ -41,6 +45,8 @@ public function getCouponCollections(GetCouponCollectionsRequest $request = new public function createCouponCollection(CreateCouponCollectionRequest $request, ?array $options = null): ?CreateCouponCollectionResponse; /** + * Retrieve the details of a single coupon collection by its UUID. The response includes the collection name, default coupon value, total and remaining coupon counts, and creation timestamp. Returns a `404` error if no collection matches the provided ID. + * * @param string $id Id of the collection to return * @param ?array{ * baseUrl?: string, @@ -55,6 +61,8 @@ public function createCouponCollection(CreateCouponCollectionRequest $request, ? public function getCouponCollection(string $id, ?array $options = null): ?GetCouponCollection; /** + * Update an existing coupon collection by its UUID. You can modify the default coupon value, set or remove the expiration date (pass `null` to remove), and configure or disable alert thresholds for remaining coupons or remaining days. Only the fields included in the request body are updated; omitted fields remain unchanged. + * * @param string $id Id of the collection to update * @param UpdateCouponCollectionRequest $request * @param ?array{ @@ -70,6 +78,8 @@ public function getCouponCollection(string $id, ?array $options = null): ?GetCou public function updateCouponCollection(string $id, UpdateCouponCollectionRequest $request = new UpdateCouponCollectionRequest(), ?array $options = null): ?UpdateCouponCollectionResponse; /** + * Add coupons to an existing coupon collection. The `coupons` array must contain between 1 and 10,000 unique coupon code strings, all associated with the specified `collectionId`. Coupon creation is processed asynchronously and a `204` status is returned immediately upon acceptance. Returns a `404` error if the specified coupon collection does not exist. + * * @param CreateCouponsRequest $request * @param ?array{ * baseUrl?: string, diff --git a/src/CustomObjects/CustomObjectsClient.php b/src/CustomObjects/CustomObjectsClient.php index e7c08a9d..66857659 100644 --- a/src/CustomObjects/CustomObjectsClient.php +++ b/src/CustomObjects/CustomObjectsClient.php @@ -57,26 +57,53 @@ public function __construct( /** * 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 - * - Associations - * **Response:** - * The API processes the request asynchronously and returns a processId that you can use to track the background process status. - * **API and Schema Limitation:** - * - Size: - * - Max 1000 objects records per request - * - Max request body size: 1 MB - * - 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 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. + * Performs bulk create or update (upsert) operations for object records in a single asynchronous request. This endpoint is optimized for high-volume data imports and synchronization scenarios. + * + * **How Upsert Works:** + * - **Create**: Omit `identifiers`, or provide only `ext_id` (if it doesn't already exist). A new record is created with a Brevo-generated `id`. + * - **Update**: Provide `id` (Brevo internal ID) or an `ext_id` that already exists. The matching record is updated with the new attribute values. + * - **Important:** `id` is for **updates only**. Providing an `id` that does not belong to an existing record will fail during async processing (the HTTP response will still be 202, but the record will be rejected in the background). To create a new record with a stable external reference, use `ext_id` instead. + * + * **Request Structure:** + * Each object record in the `records` array can include: + * - `identifiers`: Either `id` (internal Brevo ID) or `ext_id` (your external system ID) β€” required for updates. **Note:** use `id` (singular), not `ids`. + * - `attributes`: Key-value pairs where each key is the attribute **key** (e.g., `company_name`), not the attribute label (e.g., "Company Name"). + * - `associations`: Controls linking and unlinking of associated records (optional). Each entry specifies: + * - `object_type`: The type of the associated object + * - `action`: `link` (default) to create the association, or `unlink` to remove it + * - `records`: The associated records to link or unlink (each identified by `ext_id` or `id`) + * - **Unlink is idempotent** β€” unlinking a non-existing association is a no-op (no error returned) + * - `link` and `unlink` actions can be submitted for the same `object_type` in a single record entry + * - Both associated records must already exist before a link can be created + * + * > **Common mistake:** Passing the attribute **label** (the display name you see in the UI) instead of the attribute **key** will cause the attribute to be silently ignored and the record may not be created as expected. + * + * **Asynchronous Processing:** + * - Returns immediately with a `processId` (HTTP 202 Accepted) + * - Use the processId to track status via the Get process API + * + * **API and Schema Limitations:** + * - Max 1000 object records per request + * - Max request body size: 1 MB + * - Max 500 attributes per object record (matches the schema limit of 500 attributes per object) + * - Unknown attribute keys are silently ignored (no error, no attribute creation) + * - Max 10 association records per associated object-type in each record of the request. If you need more, send multiple requests. + * + * **Important Behaviors:** + * - The object schema must be created before upserting records + * - Unknown attribute keys are silently ignored (no error, no creation) + * - Both associated object records must already exist before creating a link association + * - Unlink operations are idempotent: attempting to unlink a non-existing association returns success + * - `link` and `unlink` actions can be submitted for the same `object_type` in a single record entry + * - Contact objects cannot be created via this endpoint + * - For `category` and `multiple_category` attributes, pass the option **key** as the value (not the option label or option ID). + * - The `id` identifier (internal Brevo ID) can only be used for **updating** existing records. To create new records, either omit identifiers (Brevo auto-generates an ID) or provide an `ext_id`. + * * **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". + * - 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". * - * @param string $objectType object type for the attribute + * @param string $objectType Object type for the records to upsert. Must be a previously created custom object type. Only lowercase alphanumeric characters and underscores are allowed (max 32 characters). * @param UpsertrecordsRequest $request * @param ?array{ * baseUrl?: string, @@ -128,7 +155,7 @@ public function upsertrecords(string $objectType, UpsertrecordsRequest $request, * 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 + * @param string $objectType Object type for the records to retrieve. Must be a previously created custom object type. Contact as object type is not supported in this endpoint. * @param GetrecordsRequest $request * @param ?array{ * baseUrl?: string, @@ -186,8 +213,8 @@ public function getrecords(string $objectType, GetrecordsRequest $request, ?arra /** * Use this endpoint to delete multiple object records of the same object-type in one request. - * The request is accepted and processed asynchronously. You can track the status of the deletion process using the returned **processId**. - * **API and Schema Limitations:** - Each request can contain up to **1000** object record identifiers - If more records must be deleted β†’ send multiple batch requests + * The request is accepted and processed asynchronously. You can track the status of the deletion process using the returned **processId**. + * **Limitations:** - Each request can contain up to **1000** object record identifiers - Either `ids` or `ext_ids` must be provided, but **not both** in the same request - Deletion of Brevo standard object records is not supported via this endpoint - If more records must be deleted, send multiple batch requests * * @param string $objectType Object type for the records to delete * @param BatchDeleteObjectRecordsRequest $request diff --git a/src/CustomObjects/CustomObjectsClientInterface.php b/src/CustomObjects/CustomObjectsClientInterface.php index 76d9adba..43adcfd9 100644 --- a/src/CustomObjects/CustomObjectsClientInterface.php +++ b/src/CustomObjects/CustomObjectsClientInterface.php @@ -14,26 +14,53 @@ interface CustomObjectsClientInterface /** * 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 - * - Associations - * **Response:** - * The API processes the request asynchronously and returns a processId that you can use to track the background process status. - * **API and Schema Limitation:** - * - Size: - * - Max 1000 objects records per request - * - Max request body size: 1 MB - * - 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 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. + * Performs bulk create or update (upsert) operations for object records in a single asynchronous request. This endpoint is optimized for high-volume data imports and synchronization scenarios. + * + * **How Upsert Works:** + * - **Create**: Omit `identifiers`, or provide only `ext_id` (if it doesn't already exist). A new record is created with a Brevo-generated `id`. + * - **Update**: Provide `id` (Brevo internal ID) or an `ext_id` that already exists. The matching record is updated with the new attribute values. + * - **Important:** `id` is for **updates only**. Providing an `id` that does not belong to an existing record will fail during async processing (the HTTP response will still be 202, but the record will be rejected in the background). To create a new record with a stable external reference, use `ext_id` instead. + * + * **Request Structure:** + * Each object record in the `records` array can include: + * - `identifiers`: Either `id` (internal Brevo ID) or `ext_id` (your external system ID) β€” required for updates. **Note:** use `id` (singular), not `ids`. + * - `attributes`: Key-value pairs where each key is the attribute **key** (e.g., `company_name`), not the attribute label (e.g., "Company Name"). + * - `associations`: Controls linking and unlinking of associated records (optional). Each entry specifies: + * - `object_type`: The type of the associated object + * - `action`: `link` (default) to create the association, or `unlink` to remove it + * - `records`: The associated records to link or unlink (each identified by `ext_id` or `id`) + * - **Unlink is idempotent** β€” unlinking a non-existing association is a no-op (no error returned) + * - `link` and `unlink` actions can be submitted for the same `object_type` in a single record entry + * - Both associated records must already exist before a link can be created + * + * > **Common mistake:** Passing the attribute **label** (the display name you see in the UI) instead of the attribute **key** will cause the attribute to be silently ignored and the record may not be created as expected. + * + * **Asynchronous Processing:** + * - Returns immediately with a `processId` (HTTP 202 Accepted) + * - Use the processId to track status via the Get process API + * + * **API and Schema Limitations:** + * - Max 1000 object records per request + * - Max request body size: 1 MB + * - Max 500 attributes per object record (matches the schema limit of 500 attributes per object) + * - Unknown attribute keys are silently ignored (no error, no attribute creation) + * - Max 10 association records per associated object-type in each record of the request. If you need more, send multiple requests. + * + * **Important Behaviors:** + * - The object schema must be created before upserting records + * - Unknown attribute keys are silently ignored (no error, no creation) + * - Both associated object records must already exist before creating a link association + * - Unlink operations are idempotent: attempting to unlink a non-existing association returns success + * - `link` and `unlink` actions can be submitted for the same `object_type` in a single record entry + * - Contact objects cannot be created via this endpoint + * - For `category` and `multiple_category` attributes, pass the option **key** as the value (not the option label or option ID). + * - The `id` identifier (internal Brevo ID) can only be used for **updating** existing records. To create new records, either omit identifiers (Brevo auto-generates an ID) or provide an `ext_id`. + * * **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". + * - 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". * - * @param string $objectType object type for the attribute + * @param string $objectType Object type for the records to upsert. Must be a previously created custom object type. Only lowercase alphanumeric characters and underscores are allowed (max 32 characters). * @param UpsertrecordsRequest $request * @param ?array{ * baseUrl?: string, @@ -52,7 +79,7 @@ public function upsertrecords(string $objectType, UpsertrecordsRequest $request, * 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 + * @param string $objectType Object type for the records to retrieve. Must be a previously created custom object type. Contact as object type is not supported in this endpoint. * @param GetrecordsRequest $request * @param ?array{ * baseUrl?: string, @@ -68,8 +95,8 @@ public function getrecords(string $objectType, GetrecordsRequest $request, ?arra /** * Use this endpoint to delete multiple object records of the same object-type in one request. - * The request is accepted and processed asynchronously. You can track the status of the deletion process using the returned **processId**. - * **API and Schema Limitations:** - Each request can contain up to **1000** object record identifiers - If more records must be deleted β†’ send multiple batch requests + * The request is accepted and processed asynchronously. You can track the status of the deletion process using the returned **processId**. + * **Limitations:** - Each request can contain up to **1000** object record identifiers - Either `ids` or `ext_ids` must be provided, but **not both** in the same request - Deletion of Brevo standard object records is not supported via this endpoint - If more records must be deleted, send multiple batch requests * * @param string $objectType Object type for the records to delete * @param BatchDeleteObjectRecordsRequest $request diff --git a/src/CustomObjects/Requests/BatchDeleteObjectRecordsRequest.php b/src/CustomObjects/Requests/BatchDeleteObjectRecordsRequest.php index 62f540fa..685fb047 100644 --- a/src/CustomObjects/Requests/BatchDeleteObjectRecordsRequest.php +++ b/src/CustomObjects/Requests/BatchDeleteObjectRecordsRequest.php @@ -14,7 +14,7 @@ class BatchDeleteObjectRecordsRequest extends JsonSerializableType * @var ( * BatchDeleteObjectRecordsRequestIdentifiersIds * |BatchDeleteObjectRecordsRequestIdentifiersExtIds - * )|null $identifiers One of the below must be provided + * )|null $identifiers Either `ids` or `ext_ids` must be provided, but not both in the same request. */ #[JsonProperty('identifiers'), Union(BatchDeleteObjectRecordsRequestIdentifiersIds::class, BatchDeleteObjectRecordsRequestIdentifiersExtIds::class, 'null')] public BatchDeleteObjectRecordsRequestIdentifiersIds|BatchDeleteObjectRecordsRequestIdentifiersExtIds|null $identifiers; diff --git a/src/CustomObjects/Types/GetrecordsResponseRecordsItem.php b/src/CustomObjects/Types/GetrecordsResponseRecordsItem.php index 61d54489..0dfe47c5 100644 --- a/src/CustomObjects/Types/GetrecordsResponseRecordsItem.php +++ b/src/CustomObjects/Types/GetrecordsResponseRecordsItem.php @@ -21,7 +21,10 @@ class GetrecordsResponseRecordsItem 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. + * Key-value pairs of attribute data for the object record. Each key is the attribute **key** (e.g., `company_name`, `engine_type`), not the attribute label (e.g., "Company Name", "Engine Type"). Only attributes that already exist in the object schema will be present. + * For `category` or `multiple_category` attributes, the value is the option **key** (not the option label or option ID). + * + * @var ?array $attributes */ #[JsonProperty('attributes'), ArrayType(['string' => 'mixed'])] public ?array $attributes; @@ -33,7 +36,11 @@ class GetrecordsResponseRecordsItem extends JsonSerializableType public ?DateTime $createdAt; /** - * @var ?GetrecordsResponseRecordsItemIdentifiers $identifiers Identifiers attached with the object record. It can have id or ext_id. ext_id is ID of record in the external system that client want to store in the object system, id is an internal ID of object record generated by Brevo system. + * Identifiers for the object record. Supports `id` (singular, not `ids`) or `ext_id`. + * - `ext_id`: Your external system's identifier for this record. + * - `id`: Internal Brevo record ID. + * + * @var ?GetrecordsResponseRecordsItemIdentifiers $identifiers */ #[JsonProperty('identifiers')] public ?GetrecordsResponseRecordsItemIdentifiers $identifiers; diff --git a/src/CustomObjects/Types/GetrecordsResponseRecordsItemIdentifiers.php b/src/CustomObjects/Types/GetrecordsResponseRecordsItemIdentifiers.php index 800e57c6..402ba3c5 100644 --- a/src/CustomObjects/Types/GetrecordsResponseRecordsItemIdentifiers.php +++ b/src/CustomObjects/Types/GetrecordsResponseRecordsItemIdentifiers.php @@ -6,18 +6,20 @@ use Brevo\Core\Json\JsonProperty; /** - * Identifiers attached with the object record. It can have id or ext_id. ext_id is ID of record in the external system that client want to store in the object system, id is an internal ID of object record generated by Brevo system. + * Identifiers for the object record. Supports `id` (singular, not `ids`) or `ext_id`. + * - `ext_id`: Your external system's identifier for this record. + * - `id`: Internal Brevo record ID. */ class GetrecordsResponseRecordsItemIdentifiers extends JsonSerializableType { /** - * @var ?string $extId ext_id is ID of record in the external system that client_dev want to store in the object system. + * @var ?string $extId External ID of the record in your system. */ #[JsonProperty('ext_id')] public ?string $extId; /** - * @var ?int $id Internal ID of the object record generated by Brevo + * @var ?int $id Internal ID of the object record generated by Brevo. */ #[JsonProperty('id')] public ?int $id; diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItem.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItem.php index b92810e8..e01fdc76 100644 --- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItem.php +++ b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItem.php @@ -5,37 +5,45 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; use Brevo\Core\Types\ArrayType; -use Brevo\Core\Types\Union; class UpsertrecordsRequestRecordsItem extends JsonSerializableType { /** - * @var ?array<( - * UpsertrecordsRequestRecordsItemAssociationsItemZero - * |UpsertrecordsRequestRecordsItemAssociationsItemOne - * )> $associations + * @var ?array $associations List of associations for the object record. Maximum 20 total entries allowed, with a maximum of 10 link actions and 10 unlink actions. Each entry specifies an object_type and an action (link or unlink). Unlink is idempotent β€” removing a non-existing association does not return an error. Both associated records must already exist before creating a link. */ - #[JsonProperty('associations'), ArrayType([new Union(UpsertrecordsRequestRecordsItemAssociationsItemZero::class, UpsertrecordsRequestRecordsItemAssociationsItemOne::class)])] + #[JsonProperty('associations'), ArrayType([UpsertrecordsRequestRecordsItemAssociationsItem::class])] public ?array $associations; /** - * @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. + * Key-value pairs of attribute data for the object record. Each key must be the attribute **key** (e.g., `company_name`, `engine_type`), not the attribute label (e.g., "Company Name", "Engine Type"). Only attributes that already exist in the object schema will be accepted β€” unknown keys are silently ignored. Minimum 1 attribute is required. + * + * For `category` or `multiple_category` attributes, set the value to the option **key** (not the option label or option ID). You can find available option keys in the `options` array returned by the GET attributes endpoint, or in the frontend under each attribute's settings. + * + * For example, use the option key "hybrid" not the label "Hybrid" β€” using the label will be silently ignored. + * + * For `multiple_choice` type, pass an **array of option keys** (not display labels). For example, if options have keys `"sunroof"` and `"leather_seats"`, pass `["sunroof", "leather_seats"]`. + * + * @var ?array $attributes */ #[JsonProperty('attributes'), ArrayType(['string' => 'mixed'])] public ?array $attributes; /** - * @var ?UpsertrecordsRequestRecordsItemIdentifiers $identifiers Identifiers attached with the object record. It can have id or ext_id. ext_id is ID of record in the external system that client want to store in the object system, id is an internal ID of object record generated by Brevo system. NOTE: - Its an optional field, if identifier is not provided, then id of object records will be generated by Brevo. This id can be used for further operation with the object record. - Both ext_id and id cannot be provided in the same request. + * Identifiers for the object record. Supports `id` (singular, not `ids`) or `ext_id`. + * - `ext_id`: Your external system's identifier for this record. + * - `id`: Internal Brevo record ID β€” can only be used for **updating** existing records, not for creation. + * NOTE: + * - This is an optional field. If no identifier is provided, Brevo auto-generates an internal ID that you can use for future operations. + * - If both `ext_id` and `id` are provided, `id` takes precedence and the operation is treated as an update. It is recommended to provide only one identifier per record. + * + * @var ?UpsertrecordsRequestRecordsItemIdentifiers $identifiers */ #[JsonProperty('identifiers')] public ?UpsertrecordsRequestRecordsItemIdentifiers $identifiers; /** * @param array{ - * associations?: ?array<( - * UpsertrecordsRequestRecordsItemAssociationsItemZero - * |UpsertrecordsRequestRecordsItemAssociationsItemOne - * )>, + * associations?: ?array, * attributes?: ?array, * identifiers?: ?UpsertrecordsRequestRecordsItemIdentifiers, * } $values diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItem.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItem.php new file mode 100644 index 00000000..945eb724 --- /dev/null +++ b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItem.php @@ -0,0 +1,51 @@ + $action Action to perform on the association. - `link`: Create association between records (default if not provided) - `unlink`: Remove association between records. Idempotent β€” unlinking a non-existing association is a no-op success. + */ + #[JsonProperty('action')] + public ?string $action; + + /** + * @var array $records + */ + #[JsonProperty('records'), ArrayType([UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem::class])] + public array $records; + + /** + * @param array{ + * objectType: string, + * records: array, + * action?: ?value-of, + * } $values + */ + public function __construct( + array $values, + ) { + $this->objectType = $values['objectType']; + $this->action = $values['action'] ?? null; + $this->records = $values['records']; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemAction.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemAction.php new file mode 100644 index 00000000..255b488a --- /dev/null +++ b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemAction.php @@ -0,0 +1,9 @@ + $records - */ - #[JsonProperty('records'), ArrayType([new Union(UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero::class, UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne::class)])] - public ?array $records; - - /** - * @param array{ - * objectType?: ?string, - * records?: ?array<( - * UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero - * |UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne - * )>, - * } $values - */ - public function __construct( - array $values = [], - ) { - $this->objectType = $values['objectType'] ?? null; - $this->records = $values['records'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne.php deleted file mode 100644 index e398e4ef..00000000 --- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne.php +++ /dev/null @@ -1,35 +0,0 @@ - $identifiers - */ - #[JsonProperty('identifiers'), ArrayType(['string' => 'mixed'])] - public ?array $identifiers; - - /** - * @param array{ - * identifiers?: ?array, - * } $values - */ - public function __construct( - array $values = [], - ) { - $this->identifiers = $values['identifiers'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero.php deleted file mode 100644 index df0d792c..00000000 --- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero.php +++ /dev/null @@ -1,34 +0,0 @@ -identifiers = $values['identifiers'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers.php deleted file mode 100644 index 6204697e..00000000 --- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers.php +++ /dev/null @@ -1,45 +0,0 @@ -extId = $values['extId'] ?? null; - $this->id = $values['id'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem.php similarity index 58% rename from src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem.php rename to src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem.php index 141cb945..5cf2b756 100644 --- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem.php +++ b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem.php @@ -5,17 +5,17 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; -class UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem extends JsonSerializableType +class UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem extends JsonSerializableType { /** - * @var ?UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers $identifiers + * @var ?UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers $identifiers Identifiers for the associated object record. Provide either `ext_id` or `id`. */ #[JsonProperty('identifiers')] - public ?UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers $identifiers; + public ?UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers $identifiers; /** * @param array{ - * identifiers?: ?UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers, + * identifiers?: ?UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers, * } $values */ public function __construct( diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers.php similarity index 64% rename from src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers.php rename to src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers.php index e46d96b3..55174d3d 100644 --- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers.php +++ b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers.php @@ -5,16 +5,19 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; -class UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers extends JsonSerializableType +/** + * Identifiers for the associated object record. Provide either `ext_id` or `id`. + */ +class UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers extends JsonSerializableType { /** - * @var ?string $extId ext_id is ID of record in the external system that client_dev want to store in the object system. + * @var ?string $extId External ID of the associated record in your system. */ #[JsonProperty('ext_id')] public ?string $extId; /** - * @var ?int $id Internal ID of the object record generated by Brevo + * @var ?int $id Internal ID of the associated object record generated by Brevo. */ #[JsonProperty('id')] public ?int $id; diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZero.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZero.php deleted file mode 100644 index 63baeb0f..00000000 --- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemAssociationsItemZero.php +++ /dev/null @@ -1,43 +0,0 @@ - $records - */ - #[JsonProperty('records'), ArrayType([UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem::class])] - public ?array $records; - - /** - * @param array{ - * objectType?: ?string, - * records?: ?array, - * } $values - */ - public function __construct( - array $values = [], - ) { - $this->objectType = $values['objectType'] ?? null; - $this->records = $values['records'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemIdentifiers.php b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemIdentifiers.php index 13c2eca8..84bb02ea 100644 --- a/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemIdentifiers.php +++ b/src/CustomObjects/Types/UpsertrecordsRequestRecordsItemIdentifiers.php @@ -6,12 +6,17 @@ use Brevo\Core\Json\JsonProperty; /** - * Identifiers attached with the object record. It can have id or ext_id. ext_id is ID of record in the external system that client want to store in the object system, id is an internal ID of object record generated by Brevo system. NOTE: - Its an optional field, if identifier is not provided, then id of object records will be generated by Brevo. This id can be used for further operation with the object record. - Both ext_id and id cannot be provided in the same request. + * Identifiers for the object record. Supports `id` (singular, not `ids`) or `ext_id`. + * - `ext_id`: Your external system's identifier for this record. + * - `id`: Internal Brevo record ID β€” can only be used for **updating** existing records, not for creation. + * NOTE: + * - This is an optional field. If no identifier is provided, Brevo auto-generates an internal ID that you can use for future operations. + * - If both `ext_id` and `id` are provided, `id` takes precedence and the operation is treated as an update. It is recommended to provide only one identifier per record. */ class UpsertrecordsRequestRecordsItemIdentifiers extends JsonSerializableType { /** - * @var ?string $extId ext_id is ID of record in the external system that client_dev want to store in the object system. + * @var ?string $extId ext_id is ID of record in the external system that client wants to store in the object system. */ #[JsonProperty('ext_id')] public ?string $extId; diff --git a/src/Deals/DealsClient.php b/src/Deals/DealsClient.php index 737e82e0..b7be2d9e 100644 --- a/src/Deals/DealsClient.php +++ b/src/Deals/DealsClient.php @@ -64,6 +64,8 @@ public function __construct( } /** + * Retrieve the list of all attributes defined for deals, including both system-default and custom attributes. Each attribute includes its label, internal name, type, required status, and available options for select-type attributes. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -109,6 +111,8 @@ public function getDealAttributes(?array $options = null): ?array } /** + * Retrieve a paginated list of deals with optional filtering, sorting, and search capabilities. Results can be filtered by attributes such as deal name or owner, linked companies, linked contacts, or modification/creation timestamps. Default sort order is descending by creation date. + * * @param GetCrmDealsRequest $request * @param ?array{ * baseUrl?: string, @@ -150,6 +154,9 @@ public function getAllDeals(GetCrmDealsRequest $request = new GetCrmDealsRequest if ($request->sort != null) { $query['sort'] = $request->sort; } + if ($request->sortBy != null) { + $query['sortBy'] = $request->sortBy; + } try { $response = $this->client->sendRequest( new JsonApiRequest( @@ -181,6 +188,8 @@ public function getAllDeals(GetCrmDealsRequest $request = new GetCrmDealsRequest } /** + * Create a new deal in the CRM with the specified name, attributes, and optional associations to contacts and companies. You can assign the deal to a specific pipeline and stage by providing `pipeline` and `deal_stage` attribute IDs, which can be retrieved from the pipeline details endpoint. + * * @param PostCrmDealsRequest $request * @param ?array{ * baseUrl?: string, @@ -283,6 +292,8 @@ public function importDealsCreationAndUpdation(PostCrmDealsImportRequest $reques } /** + * Link or unlink contacts and companies with a specific deal in a single request. You can simultaneously link new contacts/companies and unlink existing ones by providing the respective ID arrays in the request body. + * * @param string $id * @param PatchCrmDealsLinkUnlinkIdRequest $request * @param ?array{ @@ -324,6 +335,8 @@ public function linkAndUnlinkADealWithContactsAndCompanies(string $id, PatchCrmD } /** + * Retrieve the full details of a single deal by its identifier, including its attributes, pipeline stage, linked contacts, and linked companies. Returns a 404 error if the deal does not exist. + * * @param string $id * @param ?array{ * baseUrl?: string, @@ -370,6 +383,8 @@ public function getADeal(string $id, ?array $options = null): ?Deal } /** + * Permanently delete a deal by its identifier. The requesting user must be the deal owner or have manage permission on deals; otherwise, a 403 Forbidden error is returned. + * * @param string $id * @param ?array{ * baseUrl?: string, @@ -409,6 +424,8 @@ public function deleteADeal(string $id, ?array $options = null): void } /** + * Update an existing deal''s attributes, name, linked contacts, or linked companies. Note that passing `linkedContactsIds` or `linkedCompaniesIds` replaces the entire list of associations, so omitted IDs will be removed. To move a deal to a different pipeline or stage, provide both the `pipeline` and `deal_stage` attribute IDs. + * * @param string $id * @param PatchCrmDealsIdRequest $request * @param ?array{ @@ -497,6 +514,8 @@ public function getPipelineStages(?array $options = null): ?Pipeline } /** + * Retrieve the list of all deal pipelines configured for your account, including each pipeline''s stages and settings. If no pipelines have been configured yet, a default pipeline is automatically created and returned. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -542,6 +561,8 @@ public function getAllPipelines(?array $options = null): ?array } /** + * Retrieve the details of a specific deal pipeline by its identifier, including its stages, stage ordering, and configuration. Use this endpoint to obtain the pipeline and stage IDs needed when creating or updating deals. + * * @param string $pipelineId * @param ?array{ * baseUrl?: string, diff --git a/src/Deals/DealsClientInterface.php b/src/Deals/DealsClientInterface.php index 9feb0a1b..9c1ce9e2 100644 --- a/src/Deals/DealsClientInterface.php +++ b/src/Deals/DealsClientInterface.php @@ -17,6 +17,8 @@ interface DealsClientInterface { /** + * Retrieve the list of all attributes defined for deals, including both system-default and custom attributes. Each attribute includes its label, internal name, type, required status, and available options for select-type attributes. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -30,6 +32,8 @@ interface DealsClientInterface public function getDealAttributes(?array $options = null): ?array; /** + * Retrieve a paginated list of deals with optional filtering, sorting, and search capabilities. Results can be filtered by attributes such as deal name or owner, linked companies, linked contacts, or modification/creation timestamps. Default sort order is descending by creation date. + * * @param GetCrmDealsRequest $request * @param ?array{ * baseUrl?: string, @@ -44,6 +48,8 @@ public function getDealAttributes(?array $options = null): ?array; public function getAllDeals(GetCrmDealsRequest $request = new GetCrmDealsRequest(), ?array $options = null): ?GetCrmDealsResponse; /** + * Create a new deal in the CRM with the specified name, attributes, and optional associations to contacts and companies. You can assign the deal to a specific pipeline and stage by providing `pipeline` and `deal_stage` attribute IDs, which can be retrieved from the pipeline details endpoint. + * * @param PostCrmDealsRequest $request * @param ?array{ * baseUrl?: string, @@ -73,6 +79,8 @@ public function createADeal(PostCrmDealsRequest $request, ?array $options = null public function importDealsCreationAndUpdation(PostCrmDealsImportRequest $request = new PostCrmDealsImportRequest(), ?array $options = null): ?PostCrmDealsImportResponse; /** + * Link or unlink contacts and companies with a specific deal in a single request. You can simultaneously link new contacts/companies and unlink existing ones by providing the respective ID arrays in the request body. + * * @param string $id * @param PatchCrmDealsLinkUnlinkIdRequest $request * @param ?array{ @@ -87,6 +95,8 @@ public function importDealsCreationAndUpdation(PostCrmDealsImportRequest $reques public function linkAndUnlinkADealWithContactsAndCompanies(string $id, PatchCrmDealsLinkUnlinkIdRequest $request = new PatchCrmDealsLinkUnlinkIdRequest(), ?array $options = null): void; /** + * Retrieve the full details of a single deal by its identifier, including its attributes, pipeline stage, linked contacts, and linked companies. Returns a 404 error if the deal does not exist. + * * @param string $id * @param ?array{ * baseUrl?: string, @@ -101,6 +111,8 @@ public function linkAndUnlinkADealWithContactsAndCompanies(string $id, PatchCrmD public function getADeal(string $id, ?array $options = null): ?Deal; /** + * Permanently delete a deal by its identifier. The requesting user must be the deal owner or have manage permission on deals; otherwise, a 403 Forbidden error is returned. + * * @param string $id * @param ?array{ * baseUrl?: string, @@ -114,6 +126,8 @@ public function getADeal(string $id, ?array $options = null): ?Deal; public function deleteADeal(string $id, ?array $options = null): void; /** + * Update an existing deal''s attributes, name, linked contacts, or linked companies. Note that passing `linkedContactsIds` or `linkedCompaniesIds` replaces the entire list of associations, so omitted IDs will be removed. To move a deal to a different pipeline or stage, provide both the `pipeline` and `deal_stage` attribute IDs. + * * @param string $id * @param PatchCrmDealsIdRequest $request * @param ?array{ @@ -143,6 +157,8 @@ public function updateADeal(string $id, PatchCrmDealsIdRequest $request = new Pa public function getPipelineStages(?array $options = null): ?Pipeline; /** + * Retrieve the list of all deal pipelines configured for your account, including each pipeline''s stages and settings. If no pipelines have been configured yet, a default pipeline is automatically created and returned. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -156,6 +172,8 @@ public function getPipelineStages(?array $options = null): ?Pipeline; public function getAllPipelines(?array $options = null): ?array; /** + * Retrieve the details of a specific deal pipeline by its identifier, including its stages, stage ordering, and configuration. Use this endpoint to obtain the pipeline and stage IDs needed when creating or updating deals. + * * @param string $pipelineId * @param ?array{ * baseUrl?: string, diff --git a/src/Deals/Requests/GetCrmDealsRequest.php b/src/Deals/Requests/GetCrmDealsRequest.php index 0c4ae8e0..85290314 100644 --- a/src/Deals/Requests/GetCrmDealsRequest.php +++ b/src/Deals/Requests/GetCrmDealsRequest.php @@ -18,17 +18,17 @@ class GetCrmDealsRequest extends JsonSerializableType public ?string $filtersLinkedCompaniesIds; /** - * @var ?string $filtersLinkedContactsIds Filter by linked companies ids + * @var ?string $filtersLinkedContactsIds Filter by linked contacts ids */ public ?string $filtersLinkedContactsIds; /** - * @var ?string $modifiedSince Filter (urlencoded) the contacts modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. + * @var ?string $modifiedSince Filter (urlencoded) the deals modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. */ public ?string $modifiedSince; /** - * @var ?string $createdSince Filter (urlencoded) the contacts created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. + * @var ?string $createdSince Filter (urlencoded) the deals created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). Prefer to pass your timezone in date-time format for accurate result. */ public ?string $createdSince; @@ -40,13 +40,18 @@ class GetCrmDealsRequest extends JsonSerializableType /** * @var ?int $limit Number of documents per page */ - public ?int $limit; + public ?int $limit = 50; /** * @var ?value-of $sort Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed */ public ?string $sort; + /** + * @var ?string $sortBy The field used to sort field names. + */ + public ?string $sortBy; + /** * @param array{ * filtersAttributesDealName?: ?string, @@ -57,6 +62,7 @@ class GetCrmDealsRequest extends JsonSerializableType * offset?: ?int, * limit?: ?int, * sort?: ?value-of, + * sortBy?: ?string, * } $values */ public function __construct( @@ -70,5 +76,6 @@ public function __construct( $this->offset = $values['offset'] ?? null; $this->limit = $values['limit'] ?? null; $this->sort = $values['sort'] ?? null; + $this->sortBy = $values['sortBy'] ?? null; } } diff --git a/src/Deals/Requests/PatchCrmDealsIdRequest.php b/src/Deals/Requests/PatchCrmDealsIdRequest.php index 86cb748c..83e6b9c7 100644 --- a/src/Deals/Requests/PatchCrmDealsIdRequest.php +++ b/src/Deals/Requests/PatchCrmDealsIdRequest.php @@ -15,7 +15,7 @@ class PatchCrmDealsIdRequest extends JsonSerializableType public ?array $attributes; /** - * @var ?array $linkedCompaniesIds Warning - Using PATCH on linkedCompaniesIds replaces the list of linked contacts. Omitted IDs will be removed. + * @var ?array $linkedCompaniesIds Warning - Using PATCH on linkedCompaniesIds replaces the list of linked companies. Omitted IDs will be removed. */ #[JsonProperty('linkedCompaniesIds'), ArrayType(['string'])] public ?array $linkedCompaniesIds; diff --git a/src/Deals/Requests/PostCrmDealsImportRequest.php b/src/Deals/Requests/PostCrmDealsImportRequest.php index a426e813..17f4fbdc 100644 --- a/src/Deals/Requests/PostCrmDealsImportRequest.php +++ b/src/Deals/Requests/PostCrmDealsImportRequest.php @@ -18,7 +18,7 @@ class PostCrmDealsImportRequest extends JsonSerializableType * The mapping options in JSON format. Here is an example of the JSON structure: ```json { * "link_entities": true, // Determines whether to link related entities during the import process * "unlink_entities": false, // Determines whether to unlink related entities during the import process - * "update_existing_records": true, // Determines whether to update based on company ID or treat every row as create + * "update_existing_records": true, // Determines whether to update based on deal ID or treat every row as create * "unset_empty_attributes": false // Determines whether to unset a specific attribute during update if the values input is blank * } ``` * diff --git a/src/Deals/Types/GetCrmAttributesDealsResponseItem.php b/src/Deals/Types/GetCrmAttributesDealsResponseItem.php index dbb63fbf..89174707 100644 --- a/src/Deals/Types/GetCrmAttributesDealsResponseItem.php +++ b/src/Deals/Types/GetCrmAttributesDealsResponseItem.php @@ -7,57 +7,65 @@ use Brevo\Core\Types\ArrayType; /** - * List of attributes + * Deal attribute details */ class GetCrmAttributesDealsResponseItem extends JsonSerializableType { /** - * @var ?array> $attributeOptions + * @var ?string $internalName Internal name of the attribute */ - #[JsonProperty('attributeOptions'), ArrayType([['string' => 'mixed']])] - public ?array $attributeOptions; + #[JsonProperty('internalName')] + public ?string $internalName; /** - * @var ?string $attributeTypeName + * @var ?string $attributeTypeName Type of the attribute */ #[JsonProperty('attributeTypeName')] public ?string $attributeTypeName; /** - * @var ?string $internalName + * @var ?string $label Display label of the attribute */ - #[JsonProperty('internalName')] - public ?string $internalName; + #[JsonProperty('label')] + public ?string $label; + + /** + * @var ?array $attributeOptions Options for single-select or multi-choice attributes + */ + #[JsonProperty('attributeOptions'), ArrayType([GetCrmAttributesDealsResponseItemAttributeOptionsItem::class])] + public ?array $attributeOptions; /** - * @var ?bool $isRequired + * @var ?bool $isRequired Whether this attribute is required */ #[JsonProperty('isRequired')] public ?bool $isRequired; /** - * @var ?string $label + * @var ?bool $isValueReadonly Whether this attribute value is read-only */ - #[JsonProperty('label')] - public ?string $label; + #[JsonProperty('isValueReadonly')] + public ?bool $isValueReadonly; /** * @param array{ - * attributeOptions?: ?array>, - * attributeTypeName?: ?string, * internalName?: ?string, - * isRequired?: ?bool, + * attributeTypeName?: ?string, * label?: ?string, + * attributeOptions?: ?array, + * isRequired?: ?bool, + * isValueReadonly?: ?bool, * } $values */ public function __construct( array $values = [], ) { - $this->attributeOptions = $values['attributeOptions'] ?? null; - $this->attributeTypeName = $values['attributeTypeName'] ?? null; $this->internalName = $values['internalName'] ?? null; - $this->isRequired = $values['isRequired'] ?? null; + $this->attributeTypeName = $values['attributeTypeName'] ?? null; $this->label = $values['label'] ?? null; + $this->attributeOptions = $values['attributeOptions'] ?? null; + $this->isRequired = $values['isRequired'] ?? null; + $this->isValueReadonly = $values['isValueReadonly'] ?? null; } /** diff --git a/src/Deals/Types/GetCrmAttributesDealsResponseItemAttributeOptionsItem.php b/src/Deals/Types/GetCrmAttributesDealsResponseItemAttributeOptionsItem.php new file mode 100644 index 00000000..02b34dfe --- /dev/null +++ b/src/Deals/Types/GetCrmAttributesDealsResponseItemAttributeOptionsItem.php @@ -0,0 +1,42 @@ +key = $values['key'] ?? null; + $this->value = $values['value'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Ecommerce/EcommerceClient.php b/src/Ecommerce/EcommerceClient.php index 94b00cf8..28a61832 100644 --- a/src/Ecommerce/EcommerceClient.php +++ b/src/Ecommerce/EcommerceClient.php @@ -79,6 +79,8 @@ public function __construct( } /** + * Retrieve a paginated list of all ecommerce categories stored in your Brevo account. Results are sorted by creation date in descending order by default, and can be filtered by category IDs, name, modification date, creation date, or deletion status. The response includes a `count` field with the total number of matching categories, and pagination defaults to 50 categories per page (maximum 100). + * * @param GetCategoriesRequest $request * @param ?array{ * baseUrl?: string, @@ -151,6 +153,8 @@ public function getCategories(GetCategoriesRequest $request = new GetCategoriesR } /** + * Create a new ecommerce category or update an existing one, identified by the mandatory `id` field. When `updateEnabled` is set to `false` (the default), the endpoint performs an insert and returns `201`; if the category ID already exists, a `400` error is returned. When `updateEnabled` is `true`, the endpoint performs an upsert, returning `201` for a new category or `204` when an existing category is updated. The `name` field is mandatory for creation but optional for updates. + * * @param CreateUpdateCategoryRequest $request * @param ?array{ * baseUrl?: string, @@ -198,6 +202,8 @@ public function createUpdateCategory(CreateUpdateCategoryRequest $request, ?arra } /** + * Create or update multiple ecommerce categories in a single request. The `categories` array accepts up to 100 category objects, each requiring a unique `id`. When `updateEnabled` is `false` (the default), all categories are inserted as new; if any ID already exists, a `400` error is returned. When `updateEnabled` is `true`, existing categories are updated and new ones are created via upsert. Duplicate IDs within the same request payload are rejected. The response returns the count of created and updated categories. + * * @param CreateUpdateBatchCategoryRequest $request * @param ?array{ * baseUrl?: string, @@ -245,6 +251,8 @@ public function createUpdateBatchCategory(CreateUpdateBatchCategoryRequest $requ } /** + * Retrieve the full details of a single ecommerce category by its unique ID. The response includes the category name, URL, creation and modification timestamps, and deletion status. Returns a `404` error if no category matches the provided ID. + * * @param string $id Category ID * @param ?array{ * baseUrl?: string, @@ -331,6 +339,8 @@ public function activateTheECommerceApp(?array $options = null): void } /** + * Retrieve aggregated ecommerce attribution metrics for one or more Brevo email campaigns, SMS campaigns, or automation workflows. You can optionally filter by a date range using `periodFrom` and `periodTo` in RFC3339 format. The response includes per-source metrics (orders count, revenue, and average basket) as well as aggregated totals across all requested sources. + * * @param GetEcommerceAttributionMetricsRequest $request * @param ?array{ * baseUrl?: string, @@ -397,6 +407,8 @@ public function getAttributionMetricsForOneOrMoreBrevoCampaignsOrWorkflows(GetEc } /** + * Retrieve detailed attribution metrics for a single Brevo campaign or automation workflow, identified by its conversion source type and ID. The response includes orders count, revenue, average basket value, and the number of new customers attributed to that specific campaign or workflow. + * * @param value-of $conversionSource The Brevo campaign type or workflow type for which data will be retrieved * @param string $conversionSourceId The Brevo campaign or automation workflow id for which data will be retrieved * @param ?array{ @@ -444,6 +456,8 @@ public function getDetailedAttributionMetricsForASingleBrevoCampaignOrWorkflow(s } /** + * Retrieve the list of products whose sales have been attributed to a specific Brevo campaign or automation workflow. Each product entry includes its ID, name, SKU, image URL, product URL, price, revenue, and orders count. The conversion source type must be one of `email_campaign`, `sms_campaign`, `automation_workflow_email`, or `automation_workflow_sms`. + * * @param value-of $conversionSource The Brevo campaign or automation workflow type for which data will be retrieved * @param string $conversionSourceId The Brevo campaign or automation workflow id for which data will be retrieved * @param ?array{ @@ -491,6 +505,8 @@ public function getAttributedProductSalesForASingleBrevoCampaignOrWorkflow(strin } /** + * Retrieve the ISO 4217 display currency code currently configured for your Brevo ecommerce account. This currency is used to display monetary values across the ecommerce dashboard and reports. Returns a `403` error if ecommerce is not activated on the account. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -536,6 +552,8 @@ public function getTheIso4217CompliantDisplayCurrencyCodeForYourBrevoAccount(?ar } /** + * Set or update the ISO 4217 display currency code for your Brevo ecommerce account. This currency determines how monetary values are displayed in the ecommerce dashboard and reports. The provided currency code must be a valid ISO 4217 code; invalid codes result in a `422` error. Returns a `403` error if ecommerce is not activated on the account. + * * @param SetConfigDisplayCurrencyRequest $request * @param ?array{ * baseUrl?: string, @@ -739,6 +757,8 @@ public function createBatchOrder(CreateBatchOrderRequest $request, ?array $optio } /** + * Retrieve a paginated list of all ecommerce products stored in your Brevo account. Results are sorted by creation date in descending order by default, and can be filtered by product IDs, name (minimum 3 characters), price range, category IDs, modification date, creation date, or deletion status. Use the `search` parameter to query across SKU, name, and ID simultaneously β€” results are prioritized as exact SKU match > SKU prefix match > name match > ID match. Pagination defaults to 50 products per page (maximum 1000), and the response includes a `count` field with the total number of matching products. + * * @param GetProductsRequest $request * @param ?array{ * baseUrl?: string, @@ -768,6 +788,9 @@ public function getProducts(GetProductsRequest $request = new GetProductsRequest if ($request->ids != null) { $query['ids'] = $request->ids; } + if ($request->search != null) { + $query['search'] = $request->search; + } if ($request->name != null) { $query['name'] = $request->name; } @@ -789,6 +812,24 @@ public function getProducts(GetProductsRequest $request = new GetProductsRequest if ($request->priceNe != null) { $query['price[ne]'] = $request->priceNe; } + if ($request->alternativePriceLte != null) { + $query['alternativePrice[lte]'] = $request->alternativePriceLte; + } + if ($request->alternativePriceGte != null) { + $query['alternativePrice[gte]'] = $request->alternativePriceGte; + } + if ($request->alternativePriceLt != null) { + $query['alternativePrice[lt]'] = $request->alternativePriceLt; + } + if ($request->alternativePriceGt != null) { + $query['alternativePrice[gt]'] = $request->alternativePriceGt; + } + if ($request->alternativePriceEq != null) { + $query['alternativePrice[eq]'] = $request->alternativePriceEq; + } + if ($request->alternativePriceNe != null) { + $query['alternativePrice[ne]'] = $request->alternativePriceNe; + } if ($request->categories != null) { $query['categories'] = $request->categories; } @@ -798,6 +839,9 @@ public function getProducts(GetProductsRequest $request = new GetProductsRequest if ($request->createdSince != null) { $query['createdSince'] = $request->createdSince; } + if ($request->sortByField != null) { + $query['sortByField'] = $request->sortByField; + } if ($request->isDeleted != null) { $query['isDeleted'] = $request->isDeleted; } @@ -832,6 +876,8 @@ public function getProducts(GetProductsRequest $request = new GetProductsRequest } /** + * Create a new ecommerce product or update an existing one, identified by the mandatory `id` field. When `updateEnabled` is `false` (the default), the endpoint inserts a new product and returns `201`; if the product ID already exists, a `400` error is returned. When `updateEnabled` is `true`, the endpoint performs an upsert, returning `201` for a new product or `204` for an update. The `name` field is mandatory for creation but optional for updates. Product images are downloaded, validated (max 5 MB, formats: jpeg, jpg, png, bmp, gif, webp), and re-hosted on S3. The `metaInfo` object supports up to 20 keys with a cumulative size limit of approximately 1000 KB. + * * @param CreateUpdateProductRequest $request * @param ?array{ * baseUrl?: string, @@ -879,6 +925,8 @@ public function createUpdateProduct(CreateUpdateProductRequest $request, ?array } /** + * Create or update multiple ecommerce products in a single request. The `products` array accepts up to 100 product objects for creation (or up to 1000 when `updateEnabled` is `true` and the account has an increased limit). Each product requires a unique `id` and `name` (name is mandatory for creation only). When `updateEnabled` is `false`, all products are inserted as new; if any ID already exists, a `400` error is returned. When `updateEnabled` is `true`, existing products are updated and new ones are created via upsert. Duplicate IDs within the same request payload are rejected. The response returns the count of created and updated products. + * * @param CreateUpdateBatchProductsRequest $request * @param ?array{ * baseUrl?: string, @@ -926,6 +974,8 @@ public function createUpdateBatchProducts(CreateUpdateBatchProductsRequest $requ } /** + * Retrieve the full details of a single ecommerce product by its unique ID. The response includes the product name, price, SKU, URL, image URLs (original and thumbnails), categories, stock level, meta information, creation and modification timestamps, and deletion status. Returns a `404` error if no product matches the provided ID. + * * @param string $id Product ID * @param ?array{ * baseUrl?: string, @@ -972,6 +1022,8 @@ public function getProductInfo(string $id, ?array $options = null): ?GetProductD } /** + * Register a contact to receive an alert for a specific product event, such as `back_in_stock`. At least one contact identifier (`ext_id`, `email`, or `sms`) must be provided; when multiple are given, priority is `ext_id` > `email` > `sms`. Returns a `404` error if the product ID does not exist, and a `403` error if product alerts are not enabled for the account. + * * @param string $id Product ID * @param 'back_in_stock' $type Alert type * @param CreateProductAlertRequest $request diff --git a/src/Ecommerce/EcommerceClientInterface.php b/src/Ecommerce/EcommerceClientInterface.php index bda45c2c..8b0ecc2a 100644 --- a/src/Ecommerce/EcommerceClientInterface.php +++ b/src/Ecommerce/EcommerceClientInterface.php @@ -34,6 +34,8 @@ interface EcommerceClientInterface { /** + * Retrieve a paginated list of all ecommerce categories stored in your Brevo account. Results are sorted by creation date in descending order by default, and can be filtered by category IDs, name, modification date, creation date, or deletion status. The response includes a `count` field with the total number of matching categories, and pagination defaults to 50 categories per page (maximum 100). + * * @param GetCategoriesRequest $request * @param ?array{ * baseUrl?: string, @@ -48,6 +50,8 @@ interface EcommerceClientInterface public function getCategories(GetCategoriesRequest $request = new GetCategoriesRequest(), ?array $options = null): ?GetCategoriesResponse; /** + * Create a new ecommerce category or update an existing one, identified by the mandatory `id` field. When `updateEnabled` is set to `false` (the default), the endpoint performs an insert and returns `201`; if the category ID already exists, a `400` error is returned. When `updateEnabled` is `true`, the endpoint performs an upsert, returning `201` for a new category or `204` when an existing category is updated. The `name` field is mandatory for creation but optional for updates. + * * @param CreateUpdateCategoryRequest $request * @param ?array{ * baseUrl?: string, @@ -62,6 +66,8 @@ public function getCategories(GetCategoriesRequest $request = new GetCategoriesR public function createUpdateCategory(CreateUpdateCategoryRequest $request, ?array $options = null): ?CreateUpdateCategoryResponse; /** + * Create or update multiple ecommerce categories in a single request. The `categories` array accepts up to 100 category objects, each requiring a unique `id`. When `updateEnabled` is `false` (the default), all categories are inserted as new; if any ID already exists, a `400` error is returned. When `updateEnabled` is `true`, existing categories are updated and new ones are created via upsert. Duplicate IDs within the same request payload are rejected. The response returns the count of created and updated categories. + * * @param CreateUpdateBatchCategoryRequest $request * @param ?array{ * baseUrl?: string, @@ -76,6 +82,8 @@ public function createUpdateCategory(CreateUpdateCategoryRequest $request, ?arra public function createUpdateBatchCategory(CreateUpdateBatchCategoryRequest $request, ?array $options = null): ?CreateUpdateBatchCategoryResponse; /** + * Retrieve the full details of a single ecommerce category by its unique ID. The response includes the category name, URL, creation and modification timestamps, and deletion status. Returns a `404` error if no category matches the provided ID. + * * @param string $id Category ID * @param ?array{ * baseUrl?: string, @@ -104,6 +112,8 @@ public function getCategoryInfo(string $id, ?array $options = null): ?GetCategor public function activateTheECommerceApp(?array $options = null): void; /** + * Retrieve aggregated ecommerce attribution metrics for one or more Brevo email campaigns, SMS campaigns, or automation workflows. You can optionally filter by a date range using `periodFrom` and `periodTo` in RFC3339 format. The response includes per-source metrics (orders count, revenue, and average basket) as well as aggregated totals across all requested sources. + * * @param GetEcommerceAttributionMetricsRequest $request * @param ?array{ * baseUrl?: string, @@ -118,6 +128,8 @@ public function activateTheECommerceApp(?array $options = null): void; public function getAttributionMetricsForOneOrMoreBrevoCampaignsOrWorkflows(GetEcommerceAttributionMetricsRequest $request = new GetEcommerceAttributionMetricsRequest(), ?array $options = null): ?GetEcommerceAttributionMetricsResponse; /** + * Retrieve detailed attribution metrics for a single Brevo campaign or automation workflow, identified by its conversion source type and ID. The response includes orders count, revenue, average basket value, and the number of new customers attributed to that specific campaign or workflow. + * * @param value-of $conversionSource The Brevo campaign type or workflow type for which data will be retrieved * @param string $conversionSourceId The Brevo campaign or automation workflow id for which data will be retrieved * @param ?array{ @@ -133,6 +145,8 @@ public function getAttributionMetricsForOneOrMoreBrevoCampaignsOrWorkflows(GetEc public function getDetailedAttributionMetricsForASingleBrevoCampaignOrWorkflow(string $conversionSource, string $conversionSourceId, ?array $options = null): ?GetEcommerceAttributionMetricsConversionSourceConversionSourceIdResponse; /** + * Retrieve the list of products whose sales have been attributed to a specific Brevo campaign or automation workflow. Each product entry includes its ID, name, SKU, image URL, product URL, price, revenue, and orders count. The conversion source type must be one of `email_campaign`, `sms_campaign`, `automation_workflow_email`, or `automation_workflow_sms`. + * * @param value-of $conversionSource The Brevo campaign or automation workflow type for which data will be retrieved * @param string $conversionSourceId The Brevo campaign or automation workflow id for which data will be retrieved * @param ?array{ @@ -148,6 +162,8 @@ public function getDetailedAttributionMetricsForASingleBrevoCampaignOrWorkflow(s public function getAttributedProductSalesForASingleBrevoCampaignOrWorkflow(string $conversionSource, string $conversionSourceId, ?array $options = null): ?GetEcommerceAttributionProductsConversionSourceConversionSourceIdResponse; /** + * Retrieve the ISO 4217 display currency code currently configured for your Brevo ecommerce account. This currency is used to display monetary values across the ecommerce dashboard and reports. Returns a `403` error if ecommerce is not activated on the account. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -161,6 +177,8 @@ public function getAttributedProductSalesForASingleBrevoCampaignOrWorkflow(strin public function getTheIso4217CompliantDisplayCurrencyCodeForYourBrevoAccount(?array $options = null): ?GetEcommerceConfigDisplayCurrencyResponse; /** + * Set or update the ISO 4217 display currency code for your Brevo ecommerce account. This currency determines how monetary values are displayed in the ecommerce dashboard and reports. The provided currency code must be a valid ISO 4217 code; invalid codes result in a `422` error. Returns a `403` error if ecommerce is not activated on the account. + * * @param SetConfigDisplayCurrencyRequest $request * @param ?array{ * baseUrl?: string, @@ -222,6 +240,8 @@ public function createOrder(Order $request, ?array $options = null): void; public function createBatchOrder(CreateBatchOrderRequest $request, ?array $options = null): ?CreateBatchOrderResponse; /** + * Retrieve a paginated list of all ecommerce products stored in your Brevo account. Results are sorted by creation date in descending order by default, and can be filtered by product IDs, name (minimum 3 characters), price range, category IDs, modification date, creation date, or deletion status. Use the `search` parameter to query across SKU, name, and ID simultaneously β€” results are prioritized as exact SKU match > SKU prefix match > name match > ID match. Pagination defaults to 50 products per page (maximum 1000), and the response includes a `count` field with the total number of matching products. + * * @param GetProductsRequest $request * @param ?array{ * baseUrl?: string, @@ -236,6 +256,8 @@ public function createBatchOrder(CreateBatchOrderRequest $request, ?array $optio public function getProducts(GetProductsRequest $request = new GetProductsRequest(), ?array $options = null): ?GetProductsResponse; /** + * Create a new ecommerce product or update an existing one, identified by the mandatory `id` field. When `updateEnabled` is `false` (the default), the endpoint inserts a new product and returns `201`; if the product ID already exists, a `400` error is returned. When `updateEnabled` is `true`, the endpoint performs an upsert, returning `201` for a new product or `204` for an update. The `name` field is mandatory for creation but optional for updates. Product images are downloaded, validated (max 5 MB, formats: jpeg, jpg, png, bmp, gif, webp), and re-hosted on S3. The `metaInfo` object supports up to 20 keys with a cumulative size limit of approximately 1000 KB. + * * @param CreateUpdateProductRequest $request * @param ?array{ * baseUrl?: string, @@ -250,6 +272,8 @@ public function getProducts(GetProductsRequest $request = new GetProductsRequest public function createUpdateProduct(CreateUpdateProductRequest $request, ?array $options = null): ?CreateUpdateProductResponse; /** + * Create or update multiple ecommerce products in a single request. The `products` array accepts up to 100 product objects for creation (or up to 1000 when `updateEnabled` is `true` and the account has an increased limit). Each product requires a unique `id` and `name` (name is mandatory for creation only). When `updateEnabled` is `false`, all products are inserted as new; if any ID already exists, a `400` error is returned. When `updateEnabled` is `true`, existing products are updated and new ones are created via upsert. Duplicate IDs within the same request payload are rejected. The response returns the count of created and updated products. + * * @param CreateUpdateBatchProductsRequest $request * @param ?array{ * baseUrl?: string, @@ -264,6 +288,8 @@ public function createUpdateProduct(CreateUpdateProductRequest $request, ?array public function createUpdateBatchProducts(CreateUpdateBatchProductsRequest $request, ?array $options = null): ?CreateUpdateBatchProductsResponse; /** + * Retrieve the full details of a single ecommerce product by its unique ID. The response includes the product name, price, SKU, URL, image URLs (original and thumbnails), categories, stock level, meta information, creation and modification timestamps, and deletion status. Returns a `404` error if no product matches the provided ID. + * * @param string $id Product ID * @param ?array{ * baseUrl?: string, @@ -278,6 +304,8 @@ public function createUpdateBatchProducts(CreateUpdateBatchProductsRequest $requ public function getProductInfo(string $id, ?array $options = null): ?GetProductDetails; /** + * Register a contact to receive an alert for a specific product event, such as `back_in_stock`. At least one contact identifier (`ext_id`, `email`, or `sms`) must be provided; when multiple are given, priority is `ext_id` > `email` > `sms`. Returns a `404` error if the product ID does not exist, and a `403` error if product alerts are not enabled for the account. + * * @param string $id Product ID * @param 'back_in_stock' $type Alert type * @param CreateProductAlertRequest $request diff --git a/src/Ecommerce/Requests/CreateBatchOrderRequest.php b/src/Ecommerce/Requests/CreateBatchOrderRequest.php index ac005696..548c7cd9 100644 --- a/src/Ecommerce/Requests/CreateBatchOrderRequest.php +++ b/src/Ecommerce/Requests/CreateBatchOrderRequest.php @@ -10,13 +10,13 @@ class CreateBatchOrderRequest extends JsonSerializableType { /** - * @var ?bool $historical Defines wether you want your orders to be considered as live data or as historical data (import of past data, synchronising data). True: orders will not trigger any automation workflows. False: orders will trigger workflows as usual. + * @var ?bool $historical Defines whether you want your orders to be considered as live data or as historical data (import of past data, synchronising data). True: orders will not trigger any automation workflows. False: orders will trigger workflows as usual. */ #[JsonProperty('historical')] public ?bool $historical; /** - * @var ?string $notifyUrl Notify Url provided by client_dev to get the status of batch request + * @var ?string $notifyUrl Webhook URL to receive the status of the batch request */ #[JsonProperty('notifyUrl')] public ?string $notifyUrl; diff --git a/src/Ecommerce/Requests/CreateUpdateBatchProductsRequest.php b/src/Ecommerce/Requests/CreateUpdateBatchProductsRequest.php index b41c5422..72190391 100644 --- a/src/Ecommerce/Requests/CreateUpdateBatchProductsRequest.php +++ b/src/Ecommerce/Requests/CreateUpdateBatchProductsRequest.php @@ -16,7 +16,7 @@ class CreateUpdateBatchProductsRequest extends JsonSerializableType public array $products; /** - * @var ?bool $updateEnabled Facilitate to update the existing categories in the same request (updateEnabled = true) + * @var ?bool $updateEnabled Facilitate to update the existing products in the same request (updateEnabled = true) */ #[JsonProperty('updateEnabled')] public ?bool $updateEnabled; diff --git a/src/Ecommerce/Requests/CreateUpdateProductRequest.php b/src/Ecommerce/Requests/CreateUpdateProductRequest.php index fc47fc6b..808a4667 100644 --- a/src/Ecommerce/Requests/CreateUpdateProductRequest.php +++ b/src/Ecommerce/Requests/CreateUpdateProductRequest.php @@ -61,7 +61,7 @@ class CreateUpdateProductRequest extends JsonSerializableType public ?array $metaInfo; /** - * @var string $name Mandatory in case of creation**. Name of the product for which you requested the details + * @var string $name **Mandatory in case of creation**. Name of the product, as displayed in the shop */ #[JsonProperty('name')] public string $name; @@ -78,6 +78,12 @@ class CreateUpdateProductRequest extends JsonSerializableType #[JsonProperty('price')] public ?float $price; + /** + * @var ?float $alternativePrice Alternative price of the product + */ + #[JsonProperty('alternativePrice')] + public ?float $alternativePrice; + /** * @var ?string $sku Product identifier from the shop */ @@ -91,7 +97,7 @@ class CreateUpdateProductRequest extends JsonSerializableType public ?float $stock; /** - * @var ?bool $updateEnabled Facilitate to update the existing category in the same request (updateEnabled = true) + * @var ?bool $updateEnabled Facilitate to update the existing product in the same request (updateEnabled = true) */ #[JsonProperty('updateEnabled')] public ?bool $updateEnabled; @@ -118,6 +124,7 @@ class CreateUpdateProductRequest extends JsonSerializableType * )>, * parentId?: ?string, * price?: ?float, + * alternativePrice?: ?float, * sku?: ?string, * stock?: ?float, * updateEnabled?: ?bool, @@ -138,6 +145,7 @@ public function __construct( $this->name = $values['name']; $this->parentId = $values['parentId'] ?? null; $this->price = $values['price'] ?? null; + $this->alternativePrice = $values['alternativePrice'] ?? null; $this->sku = $values['sku'] ?? null; $this->stock = $values['stock'] ?? null; $this->updateEnabled = $values['updateEnabled'] ?? null; diff --git a/src/Ecommerce/Requests/GetProductsRequest.php b/src/Ecommerce/Requests/GetProductsRequest.php index cecbee31..a4b8332a 100644 --- a/src/Ecommerce/Requests/GetProductsRequest.php +++ b/src/Ecommerce/Requests/GetProductsRequest.php @@ -4,6 +4,7 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Ecommerce\Types\GetProductsRequestSort; +use Brevo\Ecommerce\Types\GetProductsRequestSortByField; class GetProductsRequest extends JsonSerializableType { @@ -27,6 +28,11 @@ class GetProductsRequest extends JsonSerializableType */ public ?array $ids; + /** + * @var ?string $search Search products simultaneously across SKU, name, and ID fields. Results are returned in the following priority order: **exact SKU match** > **SKU prefix match** > **name match** > **ID match**. For example, `?search=123` on products with `{sku: "123"}` and `{sku: "123456"}` returns the exact SKU match first. + */ + public ?string $search; + /** * @var ?string $name Filter by product name, minimum 3 characters should be present for search. */ @@ -62,21 +68,56 @@ class GetProductsRequest extends JsonSerializableType */ public ?float $priceNe; + /** + * @var ?float $alternativePriceLte Alternative price filter for products less than and equals to particular amount + */ + public ?float $alternativePriceLte; + + /** + * @var ?float $alternativePriceGte Alternative price filter for products greater than and equals to particular amount + */ + public ?float $alternativePriceGte; + + /** + * @var ?float $alternativePriceLt Alternative price filter for products less than particular amount + */ + public ?float $alternativePriceLt; + + /** + * @var ?float $alternativePriceGt Alternative price filter for products greater than particular amount + */ + public ?float $alternativePriceGt; + + /** + * @var ?float $alternativePriceEq Alternative price filter for products equals to particular amount + */ + public ?float $alternativePriceEq; + + /** + * @var ?float $alternativePriceNe Alternative price filter for products not equals to particular amount + */ + public ?float $alternativePriceNe; + /** * @var ?array $categories Filter by categories ids */ public ?array $categories; /** - * @var ?string $modifiedSince Filter (urlencoded) the orders modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + * @var ?string $modifiedSince Filter (urlencoded) the products modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** */ public ?string $modifiedSince; /** - * @var ?string $createdSince Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** + * @var ?string $createdSince Filter (urlencoded) the products created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** */ public ?string $createdSince; + /** + * @var ?value-of $sortByField Sort the results by a specific field. Default sort field is `created_at` when not passed. + */ + public ?string $sortByField; + /** * @var ?string $isDeleted Filter products by their deletion status. If `false` is passed, only products that are not deleted will be returned. */ @@ -88,6 +129,7 @@ class GetProductsRequest extends JsonSerializableType * offset?: ?int, * sort?: ?value-of, * ids?: ?array, + * search?: ?string, * name?: ?string, * priceLte?: ?float, * priceGte?: ?float, @@ -95,9 +137,16 @@ class GetProductsRequest extends JsonSerializableType * priceGt?: ?float, * priceEq?: ?float, * priceNe?: ?float, + * alternativePriceLte?: ?float, + * alternativePriceGte?: ?float, + * alternativePriceLt?: ?float, + * alternativePriceGt?: ?float, + * alternativePriceEq?: ?float, + * alternativePriceNe?: ?float, * categories?: ?array, * modifiedSince?: ?string, * createdSince?: ?string, + * sortByField?: ?value-of, * isDeleted?: ?string, * } $values */ @@ -108,6 +157,7 @@ public function __construct( $this->offset = $values['offset'] ?? null; $this->sort = $values['sort'] ?? null; $this->ids = $values['ids'] ?? null; + $this->search = $values['search'] ?? null; $this->name = $values['name'] ?? null; $this->priceLte = $values['priceLte'] ?? null; $this->priceGte = $values['priceGte'] ?? null; @@ -115,9 +165,16 @@ public function __construct( $this->priceGt = $values['priceGt'] ?? null; $this->priceEq = $values['priceEq'] ?? null; $this->priceNe = $values['priceNe'] ?? null; + $this->alternativePriceLte = $values['alternativePriceLte'] ?? null; + $this->alternativePriceGte = $values['alternativePriceGte'] ?? null; + $this->alternativePriceLt = $values['alternativePriceLt'] ?? null; + $this->alternativePriceGt = $values['alternativePriceGt'] ?? null; + $this->alternativePriceEq = $values['alternativePriceEq'] ?? null; + $this->alternativePriceNe = $values['alternativePriceNe'] ?? null; $this->categories = $values['categories'] ?? null; $this->modifiedSince = $values['modifiedSince'] ?? null; $this->createdSince = $values['createdSince'] ?? null; + $this->sortByField = $values['sortByField'] ?? null; $this->isDeleted = $values['isDeleted'] ?? null; } } diff --git a/src/Ecommerce/Types/CreateUpdateBatchProductsRequestProductsItem.php b/src/Ecommerce/Types/CreateUpdateBatchProductsRequestProductsItem.php index 0d51b15e..f56c668a 100644 --- a/src/Ecommerce/Types/CreateUpdateBatchProductsRequestProductsItem.php +++ b/src/Ecommerce/Types/CreateUpdateBatchProductsRequestProductsItem.php @@ -61,7 +61,7 @@ class CreateUpdateBatchProductsRequestProductsItem extends JsonSerializableType public ?array $metaInfo; /** - * @var string $name Mandatory in case of creation**. Name of the product for which you requested the details + * @var string $name **Mandatory in case of creation**. Name of the product, as displayed in the shop */ #[JsonProperty('name')] public string $name; @@ -78,6 +78,12 @@ class CreateUpdateBatchProductsRequestProductsItem extends JsonSerializableType #[JsonProperty('price')] public ?float $price; + /** + * @var ?float $alternativePrice Alternative price of the product + */ + #[JsonProperty('alternativePrice')] + public ?float $alternativePrice; + /** * @var ?string $sku Product identifier from the shop */ @@ -112,6 +118,7 @@ class CreateUpdateBatchProductsRequestProductsItem extends JsonSerializableType * )>, * parentId?: ?string, * price?: ?float, + * alternativePrice?: ?float, * sku?: ?string, * stock?: ?float, * url?: ?string, @@ -131,6 +138,7 @@ public function __construct( $this->name = $values['name']; $this->parentId = $values['parentId'] ?? null; $this->price = $values['price'] ?? null; + $this->alternativePrice = $values['alternativePrice'] ?? null; $this->sku = $values['sku'] ?? null; $this->stock = $values['stock'] ?? null; $this->url = $values['url'] ?? null; diff --git a/src/Ecommerce/Types/CreateUpdateCategoryResponse.php b/src/Ecommerce/Types/CreateUpdateCategoryResponse.php index a29d315a..afed793e 100644 --- a/src/Ecommerce/Types/CreateUpdateCategoryResponse.php +++ b/src/Ecommerce/Types/CreateUpdateCategoryResponse.php @@ -8,14 +8,14 @@ class CreateUpdateCategoryResponse extends JsonSerializableType { /** - * @var ?int $id ID of the category when a new category is created + * @var ?string $id ID of the category when a new category is created */ #[JsonProperty('id')] - public ?int $id; + public ?string $id; /** * @param array{ - * id?: ?int, + * id?: ?string, * } $values */ public function __construct( diff --git a/src/Ecommerce/Types/CreateUpdateProductResponse.php b/src/Ecommerce/Types/CreateUpdateProductResponse.php index 31f8cbcc..1b0ebd7b 100644 --- a/src/Ecommerce/Types/CreateUpdateProductResponse.php +++ b/src/Ecommerce/Types/CreateUpdateProductResponse.php @@ -8,14 +8,14 @@ class CreateUpdateProductResponse extends JsonSerializableType { /** - * @var ?int $id ID of the Product when a new product is created + * @var ?string $id ID of the product when a new product is created */ #[JsonProperty('id')] - public ?int $id; + public ?string $id; /** * @param array{ - * id?: ?int, + * id?: ?string, * } $values */ public function __construct( diff --git a/src/Ecommerce/Types/GetProductsRequestSortByField.php b/src/Ecommerce/Types/GetProductsRequestSortByField.php new file mode 100644 index 00000000..a47672b4 --- /dev/null +++ b/src/Ecommerce/Types/GetProductsRequestSortByField.php @@ -0,0 +1,11 @@ +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). + * 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/2023/2/7). * * @param GetEmailCampaignsRequest $request * @param ?array{ @@ -112,6 +112,9 @@ public function getEmailCampaigns(GetEmailCampaignsRequest $request = new GetEma if ($request->excludeHtmlContent != null) { $query['excludeHtmlContent'] = $request->excludeHtmlContent; } + if ($request->excludePdfAttachment != null) { + $query['excludePdfAttachment'] = $request->excludePdfAttachment; + } try { $response = $this->client->sendRequest( new JsonApiRequest( @@ -143,6 +146,8 @@ public function getEmailCampaigns(GetEmailCampaignsRequest $request = new GetEma } /** + * Create a new email campaign. The campaign requires at minimum a name and sender details, and is created in draft status by default. You must provide email content via one of three mutually exclusive options: htmlContent (inline HTML), htmlUrl (remote URL), or templateId (existing template); additionally, A/B testing can be enabled by setting abTesting to true with subjectA and subjectB, but this is incompatible with sendAtBestTime. + * * @param CreateEmailCampaignRequest $request * @param ?array{ * baseUrl?: string, @@ -190,6 +195,8 @@ public function createEmailCampaign(CreateEmailCampaignRequest $request, ?array } /** + * Upload an image to your account''s image gallery by providing an absolute URL to the image. The maximum allowed image size is 2MB and supported formats are jpeg, jpg, png, bmp, and gif; local file uploads are not supported. + * * @param UploadImageToGalleryRequest $request * @param ?array{ * baseUrl?: string, @@ -237,6 +244,8 @@ public function uploadImageToGallery(UploadImageToGalleryRequest $request, ?arra } /** + * Retrieve detailed information about a specific email campaign by its ID, including recipients, statistics, and HTML content. Use the statistics query parameter to select which statistics to include (globalStats, linksStats, statsByDomain, statsByDevice, or statsByBrowser); statsByDevice and statsByBrowser are only available on this single-campaign endpoint. You can exclude HTML content from the response by setting excludeHtmlContent to true. + * * @param int $campaignId Id of the campaign * @param GetEmailCampaignRequest $request * @param ?array{ @@ -292,6 +301,8 @@ public function getEmailCampaign(int $campaignId, GetEmailCampaignRequest $reque } /** + * Update an existing email campaign''s properties such as name, subject, content, sender, recipients, schedule, and A/B testing configuration. The campaign must exist and the request body must contain at least one valid field to update. Only draft or scheduled campaigns can be modified; if sendAtBestTime is enabled, IP warmup will be automatically disabled. + * * @param int $campaignId Id of the campaign * @param UpdateEmailCampaignRequest $request * @param ?array{ @@ -333,6 +344,8 @@ public function updateEmailCampaign(int $campaignId, UpdateEmailCampaignRequest } /** + * Delete an email campaign by its campaign ID. Only campaigns that have not been scheduled can be deleted; attempting to delete a campaign that has already been scheduled will return a 403 permission denied error. Related data in templates, newsletter builder, and schedule collections is also cleaned up. + * * @param int $campaignId id of the campaign * @param ?array{ * baseUrl?: string, @@ -420,6 +433,8 @@ public function getAbTestCampaignResult(int $campaignId, ?array $options = null) } /** + * Export the recipients of a sent email campaign as an asynchronous process, filtered by recipient type (e.g. openers, clickers, hardBounces). The recipientsType field is required and determines which subset of recipients to export. An optional notifyURL webhook will be called once the export is complete, and the response returns a processId to track the export status. + * * @param int $campaignId Id of the campaign * @param EmailExportRecipientsRequest $request * @param ?array{ @@ -468,6 +483,8 @@ public function emailExportRecipients(int $campaignId, EmailExportRecipientsRequ } /** + * Send an existing email campaign immediately by scheduling it for the current time. The campaign must have valid recipients and content configured before sending. The system verifies your account''s send limit and credit balance before dispatching; if credits are insufficient, a 402 error is returned. + * * @param int $campaignId Id of the campaign * @param ?array{ * baseUrl?: string, @@ -550,6 +567,8 @@ public function sendReport(int $campaignId, SendReportRequest $request, ?array $ } /** + * Send a test version of an email campaign to specified email addresses or your entire test list. If the emailTo array is left empty, the test mail will be sent to all addresses in your test list. You can send a maximum of 50 test emails per day. + * * @param int $campaignId Id of the campaign * @param SendTestEmailRequest $request * @param ?array{ @@ -639,6 +658,8 @@ public function getSharedTemplateUrl(int $campaignId, ?array $options = null): ? } /** + * Update the status of an email campaign, such as suspending, archiving, or replicating it. Available status values include suspended, archive, darchive, sent, queued, replicate, replicateTemplate, cancel, and draft. Note that the replicateTemplate status is only available for template type campaigns. + * * @param int $campaignId Id of the campaign * @param UpdateCampaignStatusRequest $request * @param ?array{ diff --git a/src/EmailCampaigns/EmailCampaignsClientInterface.php b/src/EmailCampaigns/EmailCampaignsClientInterface.php index dd31a0b9..f68b5fc8 100644 --- a/src/EmailCampaigns/EmailCampaignsClientInterface.php +++ b/src/EmailCampaigns/EmailCampaignsClientInterface.php @@ -23,7 +23,7 @@ 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). + * 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/2023/2/7). * * @param GetEmailCampaignsRequest $request * @param ?array{ @@ -39,6 +39,8 @@ interface EmailCampaignsClientInterface public function getEmailCampaigns(GetEmailCampaignsRequest $request = new GetEmailCampaignsRequest(), ?array $options = null): ?GetEmailCampaignsResponse; /** + * Create a new email campaign. The campaign requires at minimum a name and sender details, and is created in draft status by default. You must provide email content via one of three mutually exclusive options: htmlContent (inline HTML), htmlUrl (remote URL), or templateId (existing template); additionally, A/B testing can be enabled by setting abTesting to true with subjectA and subjectB, but this is incompatible with sendAtBestTime. + * * @param CreateEmailCampaignRequest $request * @param ?array{ * baseUrl?: string, @@ -53,6 +55,8 @@ public function getEmailCampaigns(GetEmailCampaignsRequest $request = new GetEma public function createEmailCampaign(CreateEmailCampaignRequest $request, ?array $options = null): ?CreateEmailCampaignResponse; /** + * Upload an image to your account''s image gallery by providing an absolute URL to the image. The maximum allowed image size is 2MB and supported formats are jpeg, jpg, png, bmp, and gif; local file uploads are not supported. + * * @param UploadImageToGalleryRequest $request * @param ?array{ * baseUrl?: string, @@ -67,6 +71,8 @@ public function createEmailCampaign(CreateEmailCampaignRequest $request, ?array public function uploadImageToGallery(UploadImageToGalleryRequest $request, ?array $options = null): ?UploadImageToGalleryResponse; /** + * Retrieve detailed information about a specific email campaign by its ID, including recipients, statistics, and HTML content. Use the statistics query parameter to select which statistics to include (globalStats, linksStats, statsByDomain, statsByDevice, or statsByBrowser); statsByDevice and statsByBrowser are only available on this single-campaign endpoint. You can exclude HTML content from the response by setting excludeHtmlContent to true. + * * @param int $campaignId Id of the campaign * @param GetEmailCampaignRequest $request * @param ?array{ @@ -82,6 +88,8 @@ public function uploadImageToGallery(UploadImageToGalleryRequest $request, ?arra public function getEmailCampaign(int $campaignId, GetEmailCampaignRequest $request = new GetEmailCampaignRequest(), ?array $options = null): ?GetEmailCampaignResponse; /** + * Update an existing email campaign''s properties such as name, subject, content, sender, recipients, schedule, and A/B testing configuration. The campaign must exist and the request body must contain at least one valid field to update. Only draft or scheduled campaigns can be modified; if sendAtBestTime is enabled, IP warmup will be automatically disabled. + * * @param int $campaignId Id of the campaign * @param UpdateEmailCampaignRequest $request * @param ?array{ @@ -96,6 +104,8 @@ public function getEmailCampaign(int $campaignId, GetEmailCampaignRequest $reque public function updateEmailCampaign(int $campaignId, UpdateEmailCampaignRequest $request = new UpdateEmailCampaignRequest(), ?array $options = null): void; /** + * Delete an email campaign by its campaign ID. Only campaigns that have not been scheduled can be deleted; attempting to delete a campaign that has already been scheduled will return a 403 permission denied error. Related data in templates, newsletter builder, and schedule collections is also cleaned up. + * * @param int $campaignId id of the campaign * @param ?array{ * baseUrl?: string, @@ -125,6 +135,8 @@ public function deleteEmailCampaign(int $campaignId, ?array $options = null): vo public function getAbTestCampaignResult(int $campaignId, ?array $options = null): ?GetAbTestCampaignResultResponse; /** + * Export the recipients of a sent email campaign as an asynchronous process, filtered by recipient type (e.g. openers, clickers, hardBounces). The recipientsType field is required and determines which subset of recipients to export. An optional notifyURL webhook will be called once the export is complete, and the response returns a processId to track the export status. + * * @param int $campaignId Id of the campaign * @param EmailExportRecipientsRequest $request * @param ?array{ @@ -140,6 +152,8 @@ public function getAbTestCampaignResult(int $campaignId, ?array $options = null) public function emailExportRecipients(int $campaignId, EmailExportRecipientsRequest $request, ?array $options = null): ?EmailExportRecipientsResponse; /** + * Send an existing email campaign immediately by scheduling it for the current time. The campaign must have valid recipients and content configured before sending. The system verifies your account''s send limit and credit balance before dispatching; if credits are insufficient, a 402 error is returned. + * * @param int $campaignId Id of the campaign * @param ?array{ * baseUrl?: string, @@ -169,6 +183,8 @@ public function sendEmailCampaignNow(int $campaignId, ?array $options = null): v public function sendReport(int $campaignId, SendReportRequest $request, ?array $options = null): void; /** + * Send a test version of an email campaign to specified email addresses or your entire test list. If the emailTo array is left empty, the test mail will be sent to all addresses in your test list. You can send a maximum of 50 test emails per day. + * * @param int $campaignId Id of the campaign * @param SendTestEmailRequest $request * @param ?array{ @@ -199,6 +215,8 @@ public function sendTestEmail(int $campaignId, SendTestEmailRequest $request, ?a public function getSharedTemplateUrl(int $campaignId, ?array $options = null): ?GetSharedTemplateUrlResponse; /** + * Update the status of an email campaign, such as suspending, archiving, or replicating it. Available status values include suspended, archive, darchive, sent, queued, replicate, replicateTemplate, cancel, and draft. Note that the replicateTemplate status is only available for template type campaigns. + * * @param int $campaignId Id of the campaign * @param UpdateCampaignStatusRequest $request * @param ?array{ diff --git a/src/EmailCampaigns/Requests/CreateEmailCampaignRequest.php b/src/EmailCampaigns/Requests/CreateEmailCampaignRequest.php index 6e40299e..9f073b95 100644 --- a/src/EmailCampaigns/Requests/CreateEmailCampaignRequest.php +++ b/src/EmailCampaigns/Requests/CreateEmailCampaignRequest.php @@ -43,13 +43,13 @@ class CreateEmailCampaignRequest extends JsonSerializableType public ?string $header; /** - * @var ?string $htmlContent Mandatory if htmlUrl and templateId are empty. Body of the message (HTML). + * @var ?string $htmlContent **Mandatory if htmlUrl and templateId are empty.** Body of the message (HTML). Must have more than 10 characters and be less than 1MB in size. Cannot be used together with `htmlUrl` or `templateId`. */ #[JsonProperty('htmlContent')] public ?string $htmlContent; /** - * @var ?string $htmlUrl **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: **https://html.domain.com** + * @var ?string $htmlUrl **Mandatory if htmlContent and templateId are empty.** URL to the message (HTML). Cannot be used together with `htmlContent` or `templateId`. For example: **https://html.domain.com** */ #[JsonProperty('htmlUrl')] public ?string $htmlUrl; @@ -127,7 +127,7 @@ class CreateEmailCampaignRequest extends JsonSerializableType public ?bool $sendAtBestTime; /** - * @var CreateEmailCampaignRequestSender $sender Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{"name":"xyz", "email":"example@abc.com"}** **{"name":"xyz", "id":123}** + * @var CreateEmailCampaignRequestSender $sender Sender details including id or email and name (optional). Only one of either Sender’s email or Sender’s ID shall be passed in one request at a time. Passing both `email` and `id` will result in an error. For example: **{"name":"xyz", "email":"example@abc.com"}** or **{"name":"xyz", "id":123}** */ #[JsonProperty('sender')] public CreateEmailCampaignRequestSender $sender; @@ -163,7 +163,7 @@ class CreateEmailCampaignRequest extends JsonSerializableType public ?string $tag; /** - * @var ?int $templateId **Mandatory if htmlContent and htmlUrl are empty**. Id of the transactional email template with status _active_. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature. + * @var ?int $templateId **Mandatory if htmlContent and htmlUrl are empty.** Id of the transactional email template with status _active_. Used to copy only its content fetched from htmlContent/htmlUrl to an email campaign for RSS feature. Cannot be used together with `htmlContent` or `htmlUrl`. */ #[JsonProperty('templateId')] public ?int $templateId; diff --git a/src/EmailCampaigns/Requests/GetEmailCampaignRequest.php b/src/EmailCampaigns/Requests/GetEmailCampaignRequest.php index 58c1a8db..6b057cac 100644 --- a/src/EmailCampaigns/Requests/GetEmailCampaignRequest.php +++ b/src/EmailCampaigns/Requests/GetEmailCampaignRequest.php @@ -8,7 +8,7 @@ class GetEmailCampaignRequest extends JsonSerializableType { /** - * @var ?value-of $statistics Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response. + * @var ?value-of $statistics Filter on the type of statistics required. Example: **globalStats** value will only fetch globalStats info of the campaign in the returned response. `statsByDevice` and `statsByBrowser` are only available when retrieving a single campaign (not in the list endpoint). */ public ?string $statistics; diff --git a/src/EmailCampaigns/Requests/GetEmailCampaignsRequest.php b/src/EmailCampaigns/Requests/GetEmailCampaignsRequest.php index e8dbcbd6..78002279 100644 --- a/src/EmailCampaigns/Requests/GetEmailCampaignsRequest.php +++ b/src/EmailCampaigns/Requests/GetEmailCampaignsRequest.php @@ -21,17 +21,17 @@ class GetEmailCampaignsRequest extends JsonSerializableType public ?string $status; /** - * @var ?value-of $statistics Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.This option only returns data for events occurred in the last 6 months.For older campaigns, it’s advisable to use the **Get Campaign Report** endpoint. + * @var ?value-of $statistics Filter on the type of statistics required. Example: **globalStats** value will only fetch globalStats info of the campaign in the returned response. This option only returns data for events that occurred in the last 6 months. For older campaigns, it is advisable to use the **Get Campaign Report** endpoint. */ public ?string $statistics; /** - * @var ?string $startDate **Mandatory if endDate is used**. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + * @var ?string $startDate **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result.** Only available if `status` is not passed or is set to `sent`. The date range between `startDate` and `endDate` must not exceed 2 years. `startDate` must not be in the future. */ public ?string $startDate; /** - * @var ?string $endDate **Mandatory if startDate is used**. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + * @var ?string $endDate **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent email campaigns. **Prefer to pass your timezone in date-time format for accurate result.** Only available if `status` is not passed or is set to `sent`. The date range between `startDate` and `endDate` must not exceed 2 years. `endDate` must not be in the future. */ public ?string $endDate; @@ -51,10 +51,15 @@ class GetEmailCampaignsRequest extends JsonSerializableType public ?string $sort; /** - * @var ?bool $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, htmlContent field will be returned as empty string in the response body + * @var ?bool $excludeHtmlContent Use this flag to exclude htmlContent from the response body. If set to **true**, the htmlContent field will be returned as an empty string in the response body. */ public ?bool $excludeHtmlContent; + /** + * @var ?bool $excludePdfAttachment Use this flag to filter out campaigns that have a PDF attachment. If set to **true**, only campaigns without a PDF attachment (or with no attachment at all) will be returned. + */ + public ?bool $excludePdfAttachment; + /** * @param array{ * type?: ?value-of, @@ -66,6 +71,7 @@ class GetEmailCampaignsRequest extends JsonSerializableType * offset?: ?int, * sort?: ?value-of, * excludeHtmlContent?: ?bool, + * excludePdfAttachment?: ?bool, * } $values */ public function __construct( @@ -80,5 +86,6 @@ public function __construct( $this->offset = $values['offset'] ?? null; $this->sort = $values['sort'] ?? null; $this->excludeHtmlContent = $values['excludeHtmlContent'] ?? null; + $this->excludePdfAttachment = $values['excludePdfAttachment'] ?? null; } } diff --git a/src/EmailCampaigns/Types/CreateEmailCampaignRequestSender.php b/src/EmailCampaigns/Types/CreateEmailCampaignRequestSender.php index 745b87b6..2ec9b738 100644 --- a/src/EmailCampaigns/Types/CreateEmailCampaignRequestSender.php +++ b/src/EmailCampaigns/Types/CreateEmailCampaignRequestSender.php @@ -6,18 +6,18 @@ use Brevo\Core\Json\JsonProperty; /** - * Sender details including id or email and name (_optional_). Only one of either Sender's email or Sender's ID shall be passed in one request at a time. For example: **{"name":"xyz", "email":"example@abc.com"}** **{"name":"xyz", "id":123}** + * Sender details including id or email and name (optional). Only one of either Sender’s email or Sender’s ID shall be passed in one request at a time. Passing both `email` and `id` will result in an error. For example: **{"name":"xyz", "email":"example@abc.com"}** or **{"name":"xyz", "id":123}** */ class CreateEmailCampaignRequestSender extends JsonSerializableType { /** - * @var ?string $email Sender email + * @var ?string $email Sender email. Must be a valid email address. Cannot be used together with `id` in the same request. */ #[JsonProperty('email')] public ?string $email; /** - * @var ?int $id Select the sender for the campaign on the basis of sender id. _In order to select a sender with specific pool of IP’s, dedicated ip users shall pass id (instead of email)_. + * @var ?int $id Select the sender for the campaign on the basis of sender id. Cannot be used together with `email` in the same request. _In order to select a sender with a specific pool of IPs, dedicated IP users shall pass id (instead of email)._ */ #[JsonProperty('id')] public ?int $id; diff --git a/src/EmailCampaigns/Types/GetEmailCampaignResponse.php b/src/EmailCampaigns/Types/GetEmailCampaignResponse.php index 14d380c8..a9b00bdb 100644 --- a/src/EmailCampaigns/Types/GetEmailCampaignResponse.php +++ b/src/EmailCampaigns/Types/GetEmailCampaignResponse.php @@ -100,12 +100,24 @@ class GetEmailCampaignResponse extends JsonSerializableType #[JsonProperty('winnerDelay')] public ?int $winnerDelay; + /** + * @var ?string $attachmentUrl URL of the attachment file associated with the campaign. Empty string if no attachment is present. + */ + #[JsonProperty('attachmentUrl')] + public ?string $attachmentUrl; + /** * @var string $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) */ #[JsonProperty('createdAt')] public string $createdAt; + /** + * @var ?GetEmailCampaignResponseEmailExpirationDate $emailExpirationDate Expiration date configuration for the email campaign, if set. Contains the duration and unit of the email expiry. + */ + #[JsonProperty('emailExpirationDate')] + public ?GetEmailCampaignResponseEmailExpirationDate $emailExpirationDate; + /** * @var string $footer Footer of the campaign */ @@ -173,7 +185,7 @@ class GetEmailCampaignResponse extends JsonSerializableType public ?string $sentDate; /** - * @var ?string $shareLink Link to share the campaign on social medias + * @var ?string $shareLink Link to share the campaign on social media. For trigger campaigns, this returns a descriptive message instead of a URL. For classic campaigns that have not been sent, this also returns a descriptive message. */ #[JsonProperty('shareLink')] public ?string $shareLink; @@ -203,25 +215,25 @@ class GetEmailCampaignResponse extends JsonSerializableType public ?string $toField; /** - * @var ?string $utmCampaignValue utm parameter associated with campaign + * @var ?string $utmCampaignValue The utm_campaign value associated with the campaign. Only present if a UTM campaign value was set. */ #[JsonProperty('utmCampaignValue')] public ?string $utmCampaignValue; /** - * @var ?bool $utmIdActive utm id active + * @var ?int $utmId The campaign ID used as utm_id parameter. Only present if UTM campaign tracking with ID is enabled. */ - #[JsonProperty('utmIDActive')] - public ?bool $utmIdActive; + #[JsonProperty('utmID')] + public ?int $utmId; /** - * @var ?string $utmMedium + * @var ?string $utmMedium The utm_medium value. Set to "EMAIL" when UTM campaign tracking is enabled. */ #[JsonProperty('utmMedium')] public ?string $utmMedium; /** - * @var ?string $utmSource source of utm + * @var ?string $utmSource The utm_source value. Set to "Brevo" when UTM campaign tracking is enabled. */ #[JsonProperty('utmSource')] public ?string $utmSource; @@ -265,6 +277,8 @@ class GetEmailCampaignResponse extends JsonSerializableType * subjectB?: ?string, * winnerCriteria?: ?string, * winnerDelay?: ?int, + * attachmentUrl?: ?string, + * emailExpirationDate?: ?GetEmailCampaignResponseEmailExpirationDate, * inlineImageActivation?: ?bool, * mirrorActive?: ?bool, * recurring?: ?bool, @@ -275,7 +289,7 @@ class GetEmailCampaignResponse extends JsonSerializableType * tags?: ?array, * toField?: ?string, * utmCampaignValue?: ?string, - * utmIdActive?: ?bool, + * utmId?: ?int, * utmMedium?: ?string, * utmSource?: ?string, * } $values @@ -298,7 +312,9 @@ public function __construct( $this->type = $values['type']; $this->winnerCriteria = $values['winnerCriteria'] ?? null; $this->winnerDelay = $values['winnerDelay'] ?? null; + $this->attachmentUrl = $values['attachmentUrl'] ?? null; $this->createdAt = $values['createdAt']; + $this->emailExpirationDate = $values['emailExpirationDate'] ?? null; $this->footer = $values['footer']; $this->header = $values['header']; $this->htmlContent = $values['htmlContent']; @@ -316,7 +332,7 @@ public function __construct( $this->testSent = $values['testSent']; $this->toField = $values['toField'] ?? null; $this->utmCampaignValue = $values['utmCampaignValue'] ?? null; - $this->utmIdActive = $values['utmIdActive'] ?? null; + $this->utmId = $values['utmId'] ?? null; $this->utmMedium = $values['utmMedium'] ?? null; $this->utmSource = $values['utmSource'] ?? null; $this->recipients = $values['recipients']; diff --git a/src/EmailCampaigns/Types/GetEmailCampaignResponseEmailExpirationDate.php b/src/EmailCampaigns/Types/GetEmailCampaignResponseEmailExpirationDate.php new file mode 100644 index 00000000..88c45887 --- /dev/null +++ b/src/EmailCampaigns/Types/GetEmailCampaignResponseEmailExpirationDate.php @@ -0,0 +1,45 @@ + $unit Unit of the duration + */ + #[JsonProperty('unit')] + public ?string $unit; + + /** + * @param array{ + * duration?: ?int, + * unit?: ?value-of, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->duration = $values['duration'] ?? null; + $this->unit = $values['unit'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/EmailCampaigns/Types/GetEmailCampaignResponseEmailExpirationDateUnit.php b/src/EmailCampaigns/Types/GetEmailCampaignResponseEmailExpirationDateUnit.php new file mode 100644 index 00000000..3767dc59 --- /dev/null +++ b/src/EmailCampaigns/Types/GetEmailCampaignResponseEmailExpirationDateUnit.php @@ -0,0 +1,10 @@ +, * toField?: ?string, * utmCampaignValue?: ?string, - * utmIdActive?: ?bool, + * utmId?: ?int, * utmMedium?: ?string, * utmSource?: ?string, * } $values @@ -298,7 +312,9 @@ public function __construct( $this->type = $values['type']; $this->winnerCriteria = $values['winnerCriteria'] ?? null; $this->winnerDelay = $values['winnerDelay'] ?? null; + $this->attachmentUrl = $values['attachmentUrl'] ?? null; $this->createdAt = $values['createdAt']; + $this->emailExpirationDate = $values['emailExpirationDate'] ?? null; $this->footer = $values['footer']; $this->header = $values['header']; $this->htmlContent = $values['htmlContent']; @@ -316,7 +332,7 @@ public function __construct( $this->testSent = $values['testSent']; $this->toField = $values['toField'] ?? null; $this->utmCampaignValue = $values['utmCampaignValue'] ?? null; - $this->utmIdActive = $values['utmIdActive'] ?? null; + $this->utmId = $values['utmId'] ?? null; $this->utmMedium = $values['utmMedium'] ?? null; $this->utmSource = $values['utmSource'] ?? null; $this->recipients = $values['recipients']; diff --git a/src/EmailCampaigns/Types/GetEmailCampaignsResponseCampaignsItemEmailExpirationDate.php b/src/EmailCampaigns/Types/GetEmailCampaignsResponseCampaignsItemEmailExpirationDate.php new file mode 100644 index 00000000..eb20bda7 --- /dev/null +++ b/src/EmailCampaigns/Types/GetEmailCampaignsResponseCampaignsItemEmailExpirationDate.php @@ -0,0 +1,45 @@ + $unit Unit of the duration + */ + #[JsonProperty('unit')] + public ?string $unit; + + /** + * @param array{ + * duration?: ?int, + * unit?: ?value-of, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->duration = $values['duration'] ?? null; + $this->unit = $values['unit'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/EmailCampaigns/Types/GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit.php b/src/EmailCampaigns/Types/GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit.php new file mode 100644 index 00000000..3ef7388c --- /dev/null +++ b/src/EmailCampaigns/Types/GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit.php @@ -0,0 +1,10 @@ + $request + * @param CreateBatchEventsRequest $request * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -187,7 +186,7 @@ public function createEvent(CreateEventRequest $request, ?array $options = null) * @throws BrevoException * @throws BrevoApiException */ - public function createBatchEvents(array $request, ?array $options = null): ?BatchAcceptedResponse + public function createBatchEvents(CreateBatchEventsRequest $request, ?array $options = null): ?BatchAcceptedResponse { $options = array_merge($this->options, $options ?? []); try { @@ -196,7 +195,7 @@ public function createBatchEvents(array $request, ?array $options = null): ?Batc baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value, path: "events/batch", method: HttpMethod::POST, - body: JsonSerializer::serializeArray($request, [CreateBatchEventsRequestItem::class]), + body: $request, ), $options, ); diff --git a/src/Event/EventClientInterface.php b/src/Event/EventClientInterface.php index eb63f203..eef5f794 100644 --- a/src/Event/EventClientInterface.php +++ b/src/Event/EventClientInterface.php @@ -5,7 +5,7 @@ use Brevo\Event\Requests\GetEventsRequest; use Brevo\Types\GetEventsList; use Brevo\Event\Requests\CreateEventRequest; -use Brevo\Event\Types\CreateBatchEventsRequestItem; +use Brevo\Event\Requests\CreateBatchEventsRequest; use Brevo\Types\BatchAcceptedResponse; interface EventClientInterface @@ -48,7 +48,7 @@ public function createEvent(CreateEventRequest $request, ?array $options = null) /** * Create multiple events to track contacts' interactions in a single request. * - * @param array $request + * @param CreateBatchEventsRequest $request * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -59,5 +59,5 @@ public function createEvent(CreateEventRequest $request, ?array $options = null) * } $options * @return ?BatchAcceptedResponse */ - public function createBatchEvents(array $request, ?array $options = null): ?BatchAcceptedResponse; + public function createBatchEvents(CreateBatchEventsRequest $request, ?array $options = null): ?BatchAcceptedResponse; } diff --git a/src/Event/Requests/CreateBatchEventsRequest.php b/src/Event/Requests/CreateBatchEventsRequest.php new file mode 100644 index 00000000..da3eaa50 --- /dev/null +++ b/src/Event/Requests/CreateBatchEventsRequest.php @@ -0,0 +1,28 @@ + $events + */ + #[JsonProperty('events'), ArrayType([CreateBatchEventsRequestEventsItem::class])] + public array $events; + + /** + * @param array{ + * events: array, + * } $values + */ + public function __construct( + array $values, + ) { + $this->events = $values['events']; + } +} diff --git a/src/Event/Requests/CreateEventRequest.php b/src/Event/Requests/CreateEventRequest.php index b773dda8..e1ead207 100644 --- a/src/Event/Requests/CreateEventRequest.php +++ b/src/Event/Requests/CreateEventRequest.php @@ -6,6 +6,8 @@ use Brevo\Core\Json\JsonProperty; use Brevo\Core\Types\ArrayType; use Brevo\Core\Types\Union; +use DateTime; +use Brevo\Core\Types\Date; use Brevo\Event\Types\CreateEventRequestIdentifiers; use Brevo\Event\Types\CreateEventRequestObject; @@ -22,13 +24,13 @@ class CreateEventRequest extends JsonSerializableType public ?array $contactProperties; /** - * @var ?string $eventDate Timestamp of when the event occurred (e.g. "2024-01-24T17:39:57+01:00"). If no value is passed, the timestamp of the event creation is used. + * @var ?DateTime $eventDate ISO 8601 timestamp of when the event occurred (e.g. "2024-01-24T17:39:57+01:00"). If no value is passed, the timestamp of the event creation is used. */ - #[JsonProperty('event_date')] - public ?string $eventDate; + #[JsonProperty('event_date'), Date(Date::TYPE_DATETIME)] + public ?DateTime $eventDate; /** - * @var string $eventName The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only. + * @var string $eventName The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters; only alphanumeric characters, hyphens (-), and underscores (_) are allowed. */ #[JsonProperty('event_name')] public string $eventName; @@ -40,7 +42,7 @@ class CreateEventRequest extends JsonSerializableType * |bool * |array * |array - * )> $eventProperties Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. "2024-01-24T17:39:57+01:00"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb. + * )> $eventProperties Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field types are supported: string, number, boolean (true/false), date (Timestamp e.g. "2024-01-24T17:39:57+01:00"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50KB. */ #[JsonProperty('event_properties'), ArrayType(['string' => new Union('string', 'integer', 'bool', ['string' => 'mixed'], ['mixed'])])] public ?array $eventProperties; @@ -66,7 +68,7 @@ class CreateEventRequest extends JsonSerializableType * |int * |bool * )>, - * eventDate?: ?string, + * eventDate?: ?DateTime, * eventProperties?: ?array $contactProperties Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **"FIRSTNAME": "Jane" , "AGE": 37** */ - #[JsonProperty('contact_properties'), ArrayType(['string' => new Union('string', 'integer', 'bool')])] + #[JsonProperty('contact_properties'), ArrayType(['string' => new Union('string', 'integer')])] public ?array $contactProperties; /** @@ -35,44 +34,41 @@ class CreateBatchEventsRequestItem extends JsonSerializableType * @var ?array * |array * )> $eventProperties Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. "2024-01-24T17:39:57+01:00"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb. */ - #[JsonProperty('event_properties'), ArrayType(['string' => new Union('string', 'integer', 'bool', ['string' => 'mixed'], ['mixed'])])] + #[JsonProperty('event_properties'), ArrayType(['string' => new Union('string', 'integer', ['string' => 'mixed'], ['mixed'])])] public ?array $eventProperties; /** - * @var CreateBatchEventsRequestItemIdentifiers $identifiers Identifies the contact associated with the event. At least one identifier is required. + * @var CreateBatchEventsRequestEventsItemIdentifiers $identifiers Identifies the contact associated with the event. At least one identifier is required. */ #[JsonProperty('identifiers')] - public CreateBatchEventsRequestItemIdentifiers $identifiers; + public CreateBatchEventsRequestEventsItemIdentifiers $identifiers; /** - * @var ?CreateBatchEventsRequestItemObject $object Identifiers of the object record associated with this event. Ignored if the object type or identifier for this record does not exist on the account. + * @var ?CreateBatchEventsRequestEventsItemObject $object Identifiers of the object record associated with this event. Ignored if the object type or identifier for this record does not exist on the account. */ #[JsonProperty('object')] - public ?CreateBatchEventsRequestItemObject $object; + public ?CreateBatchEventsRequestEventsItemObject $object; /** * @param array{ * eventName: string, - * identifiers: CreateBatchEventsRequestItemIdentifiers, + * identifiers: CreateBatchEventsRequestEventsItemIdentifiers, * contactProperties?: ?array, * eventDate?: ?string, * eventProperties?: ?array * |array * )>, - * object?: ?CreateBatchEventsRequestItemObject, + * object?: ?CreateBatchEventsRequestEventsItemObject, * } $values */ public function __construct( diff --git a/src/Event/Types/CreateBatchEventsRequestItemIdentifiers.php b/src/Event/Types/CreateBatchEventsRequestEventsItemIdentifiers.php similarity index 96% rename from src/Event/Types/CreateBatchEventsRequestItemIdentifiers.php rename to src/Event/Types/CreateBatchEventsRequestEventsItemIdentifiers.php index 64f57e4e..75aec608 100644 --- a/src/Event/Types/CreateBatchEventsRequestItemIdentifiers.php +++ b/src/Event/Types/CreateBatchEventsRequestEventsItemIdentifiers.php @@ -8,7 +8,7 @@ /** * Identifies the contact associated with the event. At least one identifier is required. */ -class CreateBatchEventsRequestItemIdentifiers extends JsonSerializableType +class CreateBatchEventsRequestEventsItemIdentifiers extends JsonSerializableType { /** * @var ?int $contactId Internal unique contact ID. When present, this takes priority over all other identifiers for event attribution and contact resolution. diff --git a/src/Event/Types/CreateBatchEventsRequestItemObject.php b/src/Event/Types/CreateBatchEventsRequestEventsItemObject.php similarity index 71% rename from src/Event/Types/CreateBatchEventsRequestItemObject.php rename to src/Event/Types/CreateBatchEventsRequestEventsItemObject.php index f84a8c91..bc70d2ba 100644 --- a/src/Event/Types/CreateBatchEventsRequestItemObject.php +++ b/src/Event/Types/CreateBatchEventsRequestEventsItemObject.php @@ -8,13 +8,13 @@ /** * Identifiers of the object record associated with this event. Ignored if the object type or identifier for this record does not exist on the account. */ -class CreateBatchEventsRequestItemObject extends JsonSerializableType +class CreateBatchEventsRequestEventsItemObject extends JsonSerializableType { /** - * @var ?CreateBatchEventsRequestItemObjectIdentifiers $identifiers Identifiers for the object. + * @var ?CreateBatchEventsRequestEventsItemObjectIdentifiers $identifiers Identifiers for the object. */ #[JsonProperty('identifiers')] - public ?CreateBatchEventsRequestItemObjectIdentifiers $identifiers; + public ?CreateBatchEventsRequestEventsItemObjectIdentifiers $identifiers; /** * @var ?string $type Type of object (e.g., subscription, vehicle, etc.) @@ -24,7 +24,7 @@ class CreateBatchEventsRequestItemObject extends JsonSerializableType /** * @param array{ - * identifiers?: ?CreateBatchEventsRequestItemObjectIdentifiers, + * identifiers?: ?CreateBatchEventsRequestEventsItemObjectIdentifiers, * type?: ?string, * } $values */ diff --git a/src/Event/Types/CreateBatchEventsRequestItemObjectIdentifiers.php b/src/Event/Types/CreateBatchEventsRequestEventsItemObjectIdentifiers.php similarity index 89% rename from src/Event/Types/CreateBatchEventsRequestItemObjectIdentifiers.php rename to src/Event/Types/CreateBatchEventsRequestEventsItemObjectIdentifiers.php index e6ae056e..c2ea5127 100644 --- a/src/Event/Types/CreateBatchEventsRequestItemObjectIdentifiers.php +++ b/src/Event/Types/CreateBatchEventsRequestEventsItemObjectIdentifiers.php @@ -8,7 +8,7 @@ /** * Identifiers for the object. */ -class CreateBatchEventsRequestItemObjectIdentifiers extends JsonSerializableType +class CreateBatchEventsRequestEventsItemObjectIdentifiers extends JsonSerializableType { /** * @var ?string $extId External object ID diff --git a/src/ExternalFeeds/Types/GetAllExternalFeedsResponseFeedsItem.php b/src/ExternalFeeds/Types/GetAllExternalFeedsResponseFeedsItem.php index c8d90a56..80f6d537 100644 --- a/src/ExternalFeeds/Types/GetAllExternalFeedsResponseFeedsItem.php +++ b/src/ExternalFeeds/Types/GetAllExternalFeedsResponseFeedsItem.php @@ -22,12 +22,6 @@ class GetAllExternalFeedsResponseFeedsItem extends JsonSerializableType #[JsonProperty('name')] public string $name; - /** - * @var string $alias URL-friendly alias for the feed - */ - #[JsonProperty('alias')] - public string $alias; - /** * @var string $url URL of the external data source */ @@ -41,19 +35,19 @@ class GetAllExternalFeedsResponseFeedsItem extends JsonSerializableType public string $authType; /** - * @var ?string $username Username for basic authentication + * @var ?string $username Username for basic authentication. Only returned when authType is 'basic'. Excluded when authType is 'token'. */ #[JsonProperty('username')] public ?string $username; /** - * @var ?string $password Password for basic authentication + * @var ?string $password Password for basic authentication. Only returned when authType is 'basic'. Excluded when authType is 'token'. */ #[JsonProperty('password')] public ?string $password; /** - * @var ?string $token Token for token-based authentication + * @var ?string $token Token for token-based authentication. Only returned when authType is 'token'. Excluded when authType is 'basic' or 'noAuth'. */ #[JsonProperty('token')] public ?string $token; @@ -70,12 +64,6 @@ class GetAllExternalFeedsResponseFeedsItem extends JsonSerializableType #[JsonProperty('cache')] public bool $cache; - /** - * @var bool $isInternal Whether this is an internal Brevo system feed - */ - #[JsonProperty('isInternal')] - public bool $isInternal; - /** * @var ?array $headers Custom HTTP headers for the feed request */ @@ -98,12 +86,10 @@ class GetAllExternalFeedsResponseFeedsItem extends JsonSerializableType * @param array{ * id: string, * name: string, - * alias: string, * url: string, * authType: value-of, * maxRetries: int, * cache: bool, - * isInternal: bool, * createdAt: DateTime, * modifiedAt: DateTime, * username?: ?string, @@ -117,7 +103,6 @@ public function __construct( ) { $this->id = $values['id']; $this->name = $values['name']; - $this->alias = $values['alias']; $this->url = $values['url']; $this->authType = $values['authType']; $this->username = $values['username'] ?? null; @@ -125,7 +110,6 @@ public function __construct( $this->token = $values['token'] ?? null; $this->maxRetries = $values['maxRetries']; $this->cache = $values['cache']; - $this->isInternal = $values['isInternal']; $this->headers = $values['headers'] ?? null; $this->createdAt = $values['createdAt']; $this->modifiedAt = $values['modifiedAt']; diff --git a/src/ExternalFeeds/Types/GetExternalFeedByUuidResponse.php b/src/ExternalFeeds/Types/GetExternalFeedByUuidResponse.php index f494fbc7..f7f4d673 100644 --- a/src/ExternalFeeds/Types/GetExternalFeedByUuidResponse.php +++ b/src/ExternalFeeds/Types/GetExternalFeedByUuidResponse.php @@ -35,41 +35,23 @@ class GetExternalFeedByUuidResponse extends JsonSerializableType public string $authType; /** - * @var ?string $username Username for basic authentication (null if not using basic auth) + * @var ?string $username Username for basic authentication. Only returned when authType is 'basic'. Excluded from response when authType is 'token'. */ #[JsonProperty('username')] public ?string $username; /** - * @var ?string $password Password for basic authentication (null if not using basic auth) + * @var ?string $password Password for basic authentication. Only returned when authType is 'basic'. Excluded from response when authType is 'token'. */ #[JsonProperty('password')] public ?string $password; /** - * @var ?string $token Token for token-based authentication (null if not using token auth) + * @var ?string $token Token for token-based authentication. Only returned when authType is 'token'. Excluded from response when authType is 'basic' or 'noAuth'. */ #[JsonProperty('token')] public ?string $token; - /** - * @var bool $personalization Whether personalization is enabled for this feed - */ - #[JsonProperty('personalization')] - public bool $personalization; - - /** - * @var string $defaultAttr Default attribute name for personalization fallback (empty string if not set) - */ - #[JsonProperty('defaultAttr')] - public string $defaultAttr; - - /** - * @var string $defaultContact Default contact email for personalization fallback (empty string if not set) - */ - #[JsonProperty('defaultContact')] - public string $defaultContact; - /** * @var ?array $headers Custom HTTP headers for the feed request */ @@ -106,9 +88,6 @@ class GetExternalFeedByUuidResponse extends JsonSerializableType * name: string, * url: string, * authType: value-of, - * personalization: bool, - * defaultAttr: string, - * defaultContact: string, * maxRetries: int, * cache: bool, * createdAt: DateTime, @@ -129,9 +108,6 @@ public function __construct( $this->username = $values['username'] ?? null; $this->password = $values['password'] ?? null; $this->token = $values['token'] ?? null; - $this->personalization = $values['personalization']; - $this->defaultAttr = $values['defaultAttr']; - $this->defaultContact = $values['defaultContact']; $this->headers = $values['headers'] ?? null; $this->maxRetries = $values['maxRetries']; $this->cache = $values['cache']; diff --git a/src/Files/FilesClient.php b/src/Files/FilesClient.php index a019d440..1a058096 100644 --- a/src/Files/FilesClient.php +++ b/src/Files/FilesClient.php @@ -56,6 +56,8 @@ public function __construct( } /** + * Retrieve a paginated list of CRM files with optional filtering by entity type, entity IDs, and date range. Results are sorted by creation date in descending order by default, with a default limit of 50 files per page. + * * @param GetCrmFilesRequest $request * @param ?array{ * baseUrl?: string, @@ -125,6 +127,8 @@ public function getAllFiles(GetCrmFilesRequest $request = new GetCrmFilesRequest } /** + * Upload a file and associate it with a contact, company, or deal. The file must be sent as multipart form data with a maximum size of 10 MB. You can optionally link the file to a specific entity by providing the corresponding entity ID. + * * @param PostCrmFilesRequest $request * @param ?array{ * baseUrl?: string, @@ -182,6 +186,8 @@ public function uploadAFile(PostCrmFilesRequest $request, ?array $options = null } /** + * Get a temporary download URL for a CRM file by its identifier. The returned URL is valid for 5 minutes only and provides direct access to the file content. + * * @param string $id File id to download. * @param ?array{ * baseUrl?: string, @@ -228,6 +234,8 @@ public function downloadAFile(string $id, ?array $options = null): ?GetCrmFilesI } /** + * Permanently delete a CRM file by its identifier. This removes the file from storage and unlinks it from any associated contacts, companies, or deals. + * * @param string $id File id to delete. * @param ?array{ * baseUrl?: string, @@ -267,6 +275,8 @@ public function deleteAFile(string $id, ?array $options = null): void } /** + * Retrieve the metadata and details of a specific CRM file by its identifier. This returns information such as the file name, size, type, creation date, and associated entities, but does not include the file content itself. + * * @param string $id File id to get file data. * @param ?array{ * baseUrl?: string, diff --git a/src/Files/FilesClientInterface.php b/src/Files/FilesClientInterface.php index e5749d6b..82c6e6e0 100644 --- a/src/Files/FilesClientInterface.php +++ b/src/Files/FilesClientInterface.php @@ -10,6 +10,8 @@ interface FilesClientInterface { /** + * Retrieve a paginated list of CRM files with optional filtering by entity type, entity IDs, and date range. Results are sorted by creation date in descending order by default, with a default limit of 50 files per page. + * * @param GetCrmFilesRequest $request * @param ?array{ * baseUrl?: string, @@ -24,6 +26,8 @@ interface FilesClientInterface public function getAllFiles(GetCrmFilesRequest $request = new GetCrmFilesRequest(), ?array $options = null): ?array; /** + * Upload a file and associate it with a contact, company, or deal. The file must be sent as multipart form data with a maximum size of 10 MB. You can optionally link the file to a specific entity by providing the corresponding entity ID. + * * @param PostCrmFilesRequest $request * @param ?array{ * baseUrl?: string, @@ -37,6 +41,8 @@ public function getAllFiles(GetCrmFilesRequest $request = new GetCrmFilesRequest public function uploadAFile(PostCrmFilesRequest $request, ?array $options = null): ?FileData; /** + * Get a temporary download URL for a CRM file by its identifier. The returned URL is valid for 5 minutes only and provides direct access to the file content. + * * @param string $id File id to download. * @param ?array{ * baseUrl?: string, @@ -51,6 +57,8 @@ public function uploadAFile(PostCrmFilesRequest $request, ?array $options = null public function downloadAFile(string $id, ?array $options = null): ?GetCrmFilesIdResponse; /** + * Permanently delete a CRM file by its identifier. This removes the file from storage and unlinks it from any associated contacts, companies, or deals. + * * @param string $id File id to delete. * @param ?array{ * baseUrl?: string, @@ -64,6 +72,8 @@ public function downloadAFile(string $id, ?array $options = null): ?GetCrmFilesI public function deleteAFile(string $id, ?array $options = null): void; /** + * Retrieve the metadata and details of a specific CRM file by its identifier. This returns information such as the file name, size, type, creation date, and associated entities, but does not include the file content itself. + * * @param string $id File id to get file data. * @param ?array{ * baseUrl?: string, diff --git a/src/InboundParsing/InboundParsingClient.php b/src/InboundParsing/InboundParsingClient.php index cfbc1800..a87480d6 100644 --- a/src/InboundParsing/InboundParsingClient.php +++ b/src/InboundParsing/InboundParsingClient.php @@ -52,7 +52,7 @@ public function __construct( } /** - * This endpoint will show the list of all the events for the received emails. + * This endpoint will show the list of all the events for the received emails. When no date range is provided, the last 30 days of events are returned by default. * * @param GetInboundEmailEventsRequest $request * @param ?array{ diff --git a/src/InboundParsing/InboundParsingClientInterface.php b/src/InboundParsing/InboundParsingClientInterface.php index 42939a71..e971fab5 100644 --- a/src/InboundParsing/InboundParsingClientInterface.php +++ b/src/InboundParsing/InboundParsingClientInterface.php @@ -9,7 +9,7 @@ interface InboundParsingClientInterface { /** - * This endpoint will show the list of all the events for the received emails. + * This endpoint will show the list of all the events for the received emails. When no date range is provided, the last 30 days of events are returned by default. * * @param GetInboundEmailEventsRequest $request * @param ?array{ diff --git a/src/InboundParsing/Requests/GetInboundEmailEventsRequest.php b/src/InboundParsing/Requests/GetInboundEmailEventsRequest.php index 423d4a53..9b1eaef3 100644 --- a/src/InboundParsing/Requests/GetInboundEmailEventsRequest.php +++ b/src/InboundParsing/Requests/GetInboundEmailEventsRequest.php @@ -13,12 +13,12 @@ class GetInboundEmailEventsRequest extends JsonSerializableType public ?string $sender; /** - * @var ?string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is one month. + * @var ?string $startDate Mandatory if endDate is used. Starting date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) from which you want to fetch the list. Maximum time period that can be selected is 30 days. Must not be in the future. */ public ?string $startDate; /** - * @var ?string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is one month. + * @var ?string $endDate Mandatory if startDate is used. Ending date (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.SSSZ) till which you want to fetch the list. Maximum time period that can be selected is 30 days. Must not be in the future. */ public ?string $endDate; diff --git a/src/InboundParsing/Types/GetInboundEmailEventsByUuidResponse.php b/src/InboundParsing/Types/GetInboundEmailEventsByUuidResponse.php index 3ae08177..b2dec401 100644 --- a/src/InboundParsing/Types/GetInboundEmailEventsByUuidResponse.php +++ b/src/InboundParsing/Types/GetInboundEmailEventsByUuidResponse.php @@ -17,13 +17,13 @@ class GetInboundEmailEventsByUuidResponse extends JsonSerializableType public ?array $attachments; /** - * @var ?DateTime $deliveredAt Date when email was delivered successfully to client_dev’s webhook + * @var ?DateTime $deliveredAt Date when email was delivered successfully to the client’s webhook */ #[JsonProperty('deliveredAt'), Date(Date::TYPE_DATETIME)] public ?DateTime $deliveredAt; /** - * @var ?array $logs List of events/logs that describe the lifecycle of the email on SIB platform + * @var ?array $logs List of events/logs that describe the lifecycle of the email on the Brevo platform */ #[JsonProperty('logs'), ArrayType([GetInboundEmailEventsByUuidResponseLogsItem::class])] public ?array $logs; diff --git a/src/MasterAccount/MasterAccountClient.php b/src/MasterAccount/MasterAccountClient.php index d9a46779..876b054c 100644 --- a/src/MasterAccount/MasterAccountClient.php +++ b/src/MasterAccount/MasterAccountClient.php @@ -906,6 +906,8 @@ public function getSubAccountDetails(int $id, ?array $options = null): ?GetCorpo } /** + * Permanently deletes a sub-account from the corporate master account. Once deleted, all data associated with the sub-account organization is removed and cannot be recovered, so ensure the sub-account is no longer needed before proceeding. + * * @param int $id Id of the sub-account organization to be deleted * @param ?array{ * baseUrl?: string, diff --git a/src/MasterAccount/MasterAccountClientInterface.php b/src/MasterAccount/MasterAccountClientInterface.php index cc5fface..ef020493 100644 --- a/src/MasterAccount/MasterAccountClientInterface.php +++ b/src/MasterAccount/MasterAccountClientInterface.php @@ -318,6 +318,8 @@ public function generateSsoTokenToAccessSubAccount(PostCorporateSubAccountSsoTok public function getSubAccountDetails(int $id, ?array $options = null): ?GetCorporateSubAccountIdResponse; /** + * Permanently deletes a sub-account from the corporate master account. Once deleted, all data associated with the sub-account organization is removed and cannot be recovered, so ensure the sub-account is no longer needed before proceeding. + * * @param int $id Id of the sub-account organization to be deleted * @param ?array{ * baseUrl?: string, diff --git a/src/Notes/NotesClient.php b/src/Notes/NotesClient.php index 3c6053b8..64931f71 100644 --- a/src/Notes/NotesClient.php +++ b/src/Notes/NotesClient.php @@ -55,6 +55,8 @@ public function __construct( } /** + * Retrieve a paginated list of CRM notes with optional filtering by entity type, entity IDs, and date range. Results are sorted by creation date in descending order by default, with a default limit of 50 notes per page. + * * @param GetCrmNotesRequest $request * @param ?array{ * baseUrl?: string, @@ -124,6 +126,8 @@ public function getAllNotes(GetCrmNotesRequest $request = new GetCrmNotesRequest } /** + * Create a new CRM note and optionally associate it with contacts, companies, or deals. The note text content is required, and you can link the note to multiple entities simultaneously during creation. + * * @param NoteData $request * @param ?array{ * baseUrl?: string, @@ -171,6 +175,8 @@ public function createANote(NoteData $request, ?array $options = null): ?PostCrm } /** + * Retrieve the full details of a single CRM note by its identifier. The response includes the note''s text content, creation date, author, and any associated contacts, companies, or deals. + * * @param string $id Note ID to get * @param ?array{ * baseUrl?: string, @@ -217,6 +223,8 @@ public function getANote(string $id, ?array $options = null): ?Note } /** + * Permanently delete a CRM note by its identifier. This removes the note and unlinks it from any associated contacts, companies, or deals. + * * @param string $id Note ID to delete * @param ?array{ * baseUrl?: string, @@ -256,6 +264,8 @@ public function deleteANote(string $id, ?array $options = null): void } /** + * Update an existing CRM note''s text content and its associations with contacts, companies, or deals. You can modify the note text, change the pinned status, or update the linked entities. + * * @param string $id Note ID to update * @param PatchCrmNotesIdRequest $request * @param ?array{ diff --git a/src/Notes/NotesClientInterface.php b/src/Notes/NotesClientInterface.php index 32ffaaa9..a6923245 100644 --- a/src/Notes/NotesClientInterface.php +++ b/src/Notes/NotesClientInterface.php @@ -11,6 +11,8 @@ interface NotesClientInterface { /** + * Retrieve a paginated list of CRM notes with optional filtering by entity type, entity IDs, and date range. Results are sorted by creation date in descending order by default, with a default limit of 50 notes per page. + * * @param GetCrmNotesRequest $request * @param ?array{ * baseUrl?: string, @@ -25,6 +27,8 @@ interface NotesClientInterface public function getAllNotes(GetCrmNotesRequest $request = new GetCrmNotesRequest(), ?array $options = null): ?array; /** + * Create a new CRM note and optionally associate it with contacts, companies, or deals. The note text content is required, and you can link the note to multiple entities simultaneously during creation. + * * @param NoteData $request * @param ?array{ * baseUrl?: string, @@ -39,6 +43,8 @@ public function getAllNotes(GetCrmNotesRequest $request = new GetCrmNotesRequest public function createANote(NoteData $request, ?array $options = null): ?PostCrmNotesResponse; /** + * Retrieve the full details of a single CRM note by its identifier. The response includes the note''s text content, creation date, author, and any associated contacts, companies, or deals. + * * @param string $id Note ID to get * @param ?array{ * baseUrl?: string, @@ -53,6 +59,8 @@ public function createANote(NoteData $request, ?array $options = null): ?PostCrm public function getANote(string $id, ?array $options = null): ?Note; /** + * Permanently delete a CRM note by its identifier. This removes the note and unlinks it from any associated contacts, companies, or deals. + * * @param string $id Note ID to delete * @param ?array{ * baseUrl?: string, @@ -66,6 +74,8 @@ public function getANote(string $id, ?array $options = null): ?Note; public function deleteANote(string $id, ?array $options = null): void; /** + * Update an existing CRM note''s text content and its associations with contacts, companies, or deals. You can modify the note text, change the pinned status, or update the linked entities. + * * @param string $id Note ID to update * @param PatchCrmNotesIdRequest $request * @param ?array{ diff --git a/src/Notes/Types/PostCrmNotesResponse.php b/src/Notes/Types/PostCrmNotesResponse.php index 60b95542..cec017ce 100644 --- a/src/Notes/Types/PostCrmNotesResponse.php +++ b/src/Notes/Types/PostCrmNotesResponse.php @@ -6,7 +6,7 @@ use Brevo\Core\Json\JsonProperty; /** - * Updated Note ID + * Created Note ID */ class PostCrmNotesResponse extends JsonSerializableType { diff --git a/src/Payments/PaymentsClient.php b/src/Payments/PaymentsClient.php index b586d896..b1e82b31 100644 --- a/src/Payments/PaymentsClient.php +++ b/src/Payments/PaymentsClient.php @@ -52,6 +52,8 @@ public function __construct( } /** + * Create a new payment request for a Brevo contact. The request requires a reference (displayed on the payment page), a contact ID, and a cart with currency and amount in cents. You can optionally configure a custom success redirect URL and enable email notifications with reminders. Returns the payment request ID and its public payment URL. A `403` error is returned if Brevo Payments is not activated or the account is not validated. + * * @param CreatePaymentRequestRequest $request * @param ?array{ * baseUrl?: string, @@ -99,6 +101,8 @@ public function createPaymentRequest(CreatePaymentRequestRequest $request, ?arra } /** + * Retrieve the details of a specific payment request by its ID. The response includes the reference, status (created, sent, reminderSent, or paid), cart details, notification configuration, contact ID, and the number of reminders sent. Returns a `404` error if no payment request matches the provided ID. + * * @param string $id Id of the payment Request * @param ?array{ * baseUrl?: string, @@ -145,6 +149,8 @@ public function getPaymentRequest(string $id, ?array $options = null): ?GetPayme } /** + * Delete a payment request by its UUID. Once deleted, the payment request can no longer be accessed or paid. Returns a `404` error if no payment request matches the provided ID, and a `403` error if Brevo Payments is not activated or the account is not validated. + * * @param string $id ID of the payment request. * @param ?array{ * baseUrl?: string, diff --git a/src/Payments/PaymentsClientInterface.php b/src/Payments/PaymentsClientInterface.php index cc98b653..03e9bcf5 100644 --- a/src/Payments/PaymentsClientInterface.php +++ b/src/Payments/PaymentsClientInterface.php @@ -9,6 +9,8 @@ interface PaymentsClientInterface { /** + * Create a new payment request for a Brevo contact. The request requires a reference (displayed on the payment page), a contact ID, and a cart with currency and amount in cents. You can optionally configure a custom success redirect URL and enable email notifications with reminders. Returns the payment request ID and its public payment URL. A `403` error is returned if Brevo Payments is not activated or the account is not validated. + * * @param CreatePaymentRequestRequest $request * @param ?array{ * baseUrl?: string, @@ -23,6 +25,8 @@ interface PaymentsClientInterface public function createPaymentRequest(CreatePaymentRequestRequest $request, ?array $options = null): ?CreatePaymentRequestResponse; /** + * Retrieve the details of a specific payment request by its ID. The response includes the reference, status (created, sent, reminderSent, or paid), cart details, notification configuration, contact ID, and the number of reminders sent. Returns a `404` error if no payment request matches the provided ID. + * * @param string $id Id of the payment Request * @param ?array{ * baseUrl?: string, @@ -37,6 +41,8 @@ public function createPaymentRequest(CreatePaymentRequestRequest $request, ?arra public function getPaymentRequest(string $id, ?array $options = null): ?GetPaymentRequestResponse; /** + * Delete a payment request by its UUID. Once deleted, the payment request can no longer be accessed or paid. Returns a `404` error if no payment request matches the provided ID, and a `403` error if Brevo Payments is not activated or the account is not validated. + * * @param string $id ID of the payment request. * @param ?array{ * baseUrl?: string, diff --git a/src/Process/ProcessClient.php b/src/Process/ProcessClient.php index bc8a2e92..c8b314e3 100644 --- a/src/Process/ProcessClient.php +++ b/src/Process/ProcessClient.php @@ -62,20 +62,19 @@ public function __construct( * - Identify failed or stuck processes for troubleshooting * * **Key information returned:** - * - Process details (ID, name, type, status) - * - Process creation and completion timestamps - * - Process progress and completion status - * - Error information for failed processes - * - Process result data and download links + * - Process details (ID, name, status) + * - Export download URLs for completed export processes + * - Import details with CSV report URLs for completed import processes + * - Total count of processes for pagination * * **Important considerations:** * - Background processes handle long-running operations like imports and exports - * - Process status indicates current state (queued, processing, completed, failed, cancelled) + * - Process status indicates current state (queued, processing, completed) * - Export processes provide download URLs when completed - * - Failed processes include error messages for troubleshooting + * - Import processes provide CSV report URLs with details about problematic records * - Use pagination for accounts with many historical processes * - Sort options available for creation order (ascending or descending) - * - Different process types handle specific operations (imports, exports, calculations) + * - Default limit is 10 results per page, maximum is 50 * * @param GetProcessesRequest $request * @param ?array{ @@ -144,18 +143,14 @@ public function getProcesses(GetProcessesRequest $request = new GetProcessesRequ * - Track process execution times * * **Key information returned:** - * - Complete process details and status - * - Import/export statistics and results - * - Error information for troubleshooting - * - Download URLs for export processes - * - Process timing and performance data + * - Complete process details (ID, name, status) + * - Download URLs for completed export processes + * - Import details with CSV report URLs for completed import processes * * **Important considerations:** - * - Process ID must exist in your account - * - Completed processes provide detailed statistics and results - * - Export processes include download URLs when successful - * - Failed processes contain error messages for debugging - * - Timing information helps with performance analysis + * - Process ID must exist in your account and not be deleted + * - Completed export processes include download URLs + * - Completed import processes include CSV report URLs with details about problematic records * - Different process types return different result structures * * @param int $processId Id of the process diff --git a/src/Process/ProcessClientInterface.php b/src/Process/ProcessClientInterface.php index 69edd15d..b93c89dc 100644 --- a/src/Process/ProcessClientInterface.php +++ b/src/Process/ProcessClientInterface.php @@ -19,20 +19,19 @@ interface ProcessClientInterface * - Identify failed or stuck processes for troubleshooting * * **Key information returned:** - * - Process details (ID, name, type, status) - * - Process creation and completion timestamps - * - Process progress and completion status - * - Error information for failed processes - * - Process result data and download links + * - Process details (ID, name, status) + * - Export download URLs for completed export processes + * - Import details with CSV report URLs for completed import processes + * - Total count of processes for pagination * * **Important considerations:** * - Background processes handle long-running operations like imports and exports - * - Process status indicates current state (queued, processing, completed, failed, cancelled) + * - Process status indicates current state (queued, processing, completed) * - Export processes provide download URLs when completed - * - Failed processes include error messages for troubleshooting + * - Import processes provide CSV report URLs with details about problematic records * - Use pagination for accounts with many historical processes * - Sort options available for creation order (ascending or descending) - * - Different process types handle specific operations (imports, exports, calculations) + * - Default limit is 10 results per page, maximum is 50 * * @param GetProcessesRequest $request * @param ?array{ @@ -58,18 +57,14 @@ public function getProcesses(GetProcessesRequest $request = new GetProcessesRequ * - Track process execution times * * **Key information returned:** - * - Complete process details and status - * - Import/export statistics and results - * - Error information for troubleshooting - * - Download URLs for export processes - * - Process timing and performance data + * - Complete process details (ID, name, status) + * - Download URLs for completed export processes + * - Import details with CSV report URLs for completed import processes * * **Important considerations:** - * - Process ID must exist in your account - * - Completed processes provide detailed statistics and results - * - Export processes include download URLs when successful - * - Failed processes contain error messages for debugging - * - Timing information helps with performance analysis + * - Process ID must exist in your account and not be deleted + * - Completed export processes include download URLs + * - Completed import processes include CSV report URLs with details about problematic records * - Different process types return different result structures * * @param int $processId Id of the process diff --git a/src/Process/Types/GetProcessResponse.php b/src/Process/Types/GetProcessResponse.php index 5030ae3f..26ad3b7b 100644 --- a/src/Process/Types/GetProcessResponse.php +++ b/src/Process/Types/GetProcessResponse.php @@ -4,8 +4,6 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; -use DateTime; -use Brevo\Core\Types\Date; class GetProcessResponse extends JsonSerializableType { @@ -28,35 +26,17 @@ class GetProcessResponse extends JsonSerializableType public string $status; /** - * @var ?GetProcessResponseInfo $info Additional process information (for completed processes) + * @var ?GetProcessResponseInfo $info Additional process information, only returned for completed IMPORTUSER processes. Contains URLs to CSV files with details about problematic records. */ #[JsonProperty('info')] public ?GetProcessResponseInfo $info; /** - * @var ?string $exportUrl Download URL for completed export processes + * @var ?string $exportUrl Download URL for completed export processes (returned for SEARCH_EXPORT_USERS, SEARCH_EXPORT_USERS_API, CAMPAIGN_USER_DETAILS, and EXPORT_WEBHOOK process types) */ #[JsonProperty('export_url')] public ?string $exportUrl; - /** - * @var ?string $error Error message for failed processes - */ - #[JsonProperty('error')] - public ?string $error; - - /** - * @var ?DateTime $createdAt Process creation timestamp - */ - #[JsonProperty('created_at'), Date(Date::TYPE_DATETIME)] - public ?DateTime $createdAt; - - /** - * @var ?DateTime $completedAt Process completion timestamp - */ - #[JsonProperty('completed_at'), Date(Date::TYPE_DATETIME)] - public ?DateTime $completedAt; - /** * @param array{ * id: int, @@ -64,9 +44,6 @@ class GetProcessResponse extends JsonSerializableType * status: value-of, * info?: ?GetProcessResponseInfo, * exportUrl?: ?string, - * error?: ?string, - * createdAt?: ?DateTime, - * completedAt?: ?DateTime, * } $values */ public function __construct( @@ -77,9 +54,6 @@ public function __construct( $this->status = $values['status']; $this->info = $values['info'] ?? null; $this->exportUrl = $values['exportUrl'] ?? null; - $this->error = $values['error'] ?? null; - $this->createdAt = $values['createdAt'] ?? null; - $this->completedAt = $values['completedAt'] ?? null; } /** diff --git a/src/Process/Types/GetProcessResponseInfo.php b/src/Process/Types/GetProcessResponseInfo.php index 6286d378..83a7f1f7 100644 --- a/src/Process/Types/GetProcessResponseInfo.php +++ b/src/Process/Types/GetProcessResponseInfo.php @@ -6,33 +6,25 @@ use Brevo\Core\Json\JsonProperty; /** - * Additional process information (for completed processes) + * Additional process information, only returned for completed IMPORTUSER processes. Contains URLs to CSV files with details about problematic records. */ class GetProcessResponseInfo extends JsonSerializableType { /** - * @var ?GetProcessResponseInfoImport $import Import process details + * @var ?GetProcessResponseInfoImport $import Import process details with URLs to CSV reports */ #[JsonProperty('import')] public ?GetProcessResponseInfoImport $import; - /** - * @var ?GetProcessResponseInfoExport $export Export process details - */ - #[JsonProperty('export')] - public ?GetProcessResponseInfoExport $export; - /** * @param array{ * import?: ?GetProcessResponseInfoImport, - * export?: ?GetProcessResponseInfoExport, * } $values */ public function __construct( array $values = [], ) { $this->import = $values['import'] ?? null; - $this->export = $values['export'] ?? null; } /** diff --git a/src/Process/Types/GetProcessResponseInfoExport.php b/src/Process/Types/GetProcessResponseInfoExport.php deleted file mode 100644 index d7b1407b..00000000 --- a/src/Process/Types/GetProcessResponseInfoExport.php +++ /dev/null @@ -1,45 +0,0 @@ -totalRecords = $values['totalRecords'] ?? null; - $this->fileSize = $values['fileSize'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Process/Types/GetProcessResponseInfoImport.php b/src/Process/Types/GetProcessResponseInfoImport.php index 55dcc78c..b3779d92 100644 --- a/src/Process/Types/GetProcessResponseInfoImport.php +++ b/src/Process/Types/GetProcessResponseInfoImport.php @@ -6,27 +6,27 @@ use Brevo\Core\Json\JsonProperty; /** - * Import process details + * Import process details with URLs to CSV reports */ class GetProcessResponseInfoImport extends JsonSerializableType { /** - * @var ?int $invalidEmails Number of invalid email addresses + * @var ?string $invalidEmails URL to CSV file containing invalid email addresses, or null if none */ #[JsonProperty('invalid_emails')] - public ?int $invalidEmails; + public ?string $invalidEmails; /** - * @var ?int $duplicateContactId Number of duplicate contact IDs + * @var ?string $duplicateContactId URL to CSV file containing duplicate contact IDs, or null if none */ #[JsonProperty('duplicate_contact_id')] - public ?int $duplicateContactId; + public ?string $duplicateContactId; /** - * @var ?int $duplicateExtId Number of duplicate external IDs + * @var ?string $duplicateExtId URL to CSV file containing duplicate external IDs, or null if none */ #[JsonProperty('duplicate_ext_id')] - public ?int $duplicateExtId; + public ?string $duplicateExtId; /** * @var ?string $duplicateEmailId URL to CSV file containing duplicate email IDs, or null if none @@ -35,32 +35,32 @@ class GetProcessResponseInfoImport extends JsonSerializableType public ?string $duplicateEmailId; /** - * @var ?int $duplicatePhoneId Number of duplicate phone numbers + * @var ?string $duplicatePhoneId URL to CSV file containing duplicate phone numbers, or null if none */ #[JsonProperty('duplicate_phone_id')] - public ?int $duplicatePhoneId; + public ?string $duplicatePhoneId; /** - * @var ?int $duplicateWhatsappId Number of duplicate WhatsApp numbers + * @var ?string $duplicateWhatsappId URL to CSV file containing duplicate WhatsApp numbers, or null if none */ #[JsonProperty('duplicate_whatsapp_id')] - public ?int $duplicateWhatsappId; + public ?string $duplicateWhatsappId; /** - * @var ?int $duplicateLandlineNumberId Number of duplicate landline numbers + * @var ?string $duplicateLandlineNumberId URL to CSV file containing duplicate landline numbers, or null if none */ #[JsonProperty('duplicate_landline_number_id')] - public ?int $duplicateLandlineNumberId; + public ?string $duplicateLandlineNumberId; /** * @param array{ - * invalidEmails?: ?int, - * duplicateContactId?: ?int, - * duplicateExtId?: ?int, + * invalidEmails?: ?string, + * duplicateContactId?: ?string, + * duplicateExtId?: ?string, * duplicateEmailId?: ?string, - * duplicatePhoneId?: ?int, - * duplicateWhatsappId?: ?int, - * duplicateLandlineNumberId?: ?int, + * duplicatePhoneId?: ?string, + * duplicateWhatsappId?: ?string, + * duplicateLandlineNumberId?: ?string, * } $values */ public function __construct( diff --git a/src/Process/Types/GetProcessesResponseProcessesItem.php b/src/Process/Types/GetProcessesResponseProcessesItem.php index 217bf5e7..a267cb84 100644 --- a/src/Process/Types/GetProcessesResponseProcessesItem.php +++ b/src/Process/Types/GetProcessesResponseProcessesItem.php @@ -4,8 +4,6 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; -use DateTime; -use Brevo\Core\Types\Date; class GetProcessesResponseProcessesItem extends JsonSerializableType { @@ -28,35 +26,17 @@ class GetProcessesResponseProcessesItem extends JsonSerializableType public string $status; /** - * @var ?GetProcessesResponseProcessesItemInfo $info Additional process information (for completed processes) + * @var ?GetProcessesResponseProcessesItemInfo $info Additional process information, only returned for completed IMPORTUSER processes. Contains URLs to CSV files with details about problematic records. */ #[JsonProperty('info')] public ?GetProcessesResponseProcessesItemInfo $info; /** - * @var ?string $exportUrl Download URL for completed export processes + * @var ?string $exportUrl Download URL for completed export processes (returned for SEARCH_EXPORT_USERS, SEARCH_EXPORT_USERS_API, CAMPAIGN_USER_DETAILS, and EXPORT_WEBHOOK process types) */ #[JsonProperty('export_url')] public ?string $exportUrl; - /** - * @var ?string $error Error message for failed processes - */ - #[JsonProperty('error')] - public ?string $error; - - /** - * @var ?DateTime $createdAt Process creation timestamp - */ - #[JsonProperty('created_at'), Date(Date::TYPE_DATETIME)] - public ?DateTime $createdAt; - - /** - * @var ?DateTime $completedAt Process completion timestamp - */ - #[JsonProperty('completed_at'), Date(Date::TYPE_DATETIME)] - public ?DateTime $completedAt; - /** * @param array{ * id: int, @@ -64,9 +44,6 @@ class GetProcessesResponseProcessesItem extends JsonSerializableType * status: value-of, * info?: ?GetProcessesResponseProcessesItemInfo, * exportUrl?: ?string, - * error?: ?string, - * createdAt?: ?DateTime, - * completedAt?: ?DateTime, * } $values */ public function __construct( @@ -77,9 +54,6 @@ public function __construct( $this->status = $values['status']; $this->info = $values['info'] ?? null; $this->exportUrl = $values['exportUrl'] ?? null; - $this->error = $values['error'] ?? null; - $this->createdAt = $values['createdAt'] ?? null; - $this->completedAt = $values['completedAt'] ?? null; } /** diff --git a/src/Process/Types/GetProcessesResponseProcessesItemInfo.php b/src/Process/Types/GetProcessesResponseProcessesItemInfo.php index 5bd460d4..0055b48f 100644 --- a/src/Process/Types/GetProcessesResponseProcessesItemInfo.php +++ b/src/Process/Types/GetProcessesResponseProcessesItemInfo.php @@ -6,33 +6,25 @@ use Brevo\Core\Json\JsonProperty; /** - * Additional process information (for completed processes) + * Additional process information, only returned for completed IMPORTUSER processes. Contains URLs to CSV files with details about problematic records. */ class GetProcessesResponseProcessesItemInfo extends JsonSerializableType { /** - * @var ?GetProcessesResponseProcessesItemInfoImport $import Import process details + * @var ?GetProcessesResponseProcessesItemInfoImport $import Import process details with URLs to CSV reports */ #[JsonProperty('import')] public ?GetProcessesResponseProcessesItemInfoImport $import; - /** - * @var ?GetProcessesResponseProcessesItemInfoExport $export Export process details - */ - #[JsonProperty('export')] - public ?GetProcessesResponseProcessesItemInfoExport $export; - /** * @param array{ * import?: ?GetProcessesResponseProcessesItemInfoImport, - * export?: ?GetProcessesResponseProcessesItemInfoExport, * } $values */ public function __construct( array $values = [], ) { $this->import = $values['import'] ?? null; - $this->export = $values['export'] ?? null; } /** diff --git a/src/Process/Types/GetProcessesResponseProcessesItemInfoExport.php b/src/Process/Types/GetProcessesResponseProcessesItemInfoExport.php deleted file mode 100644 index 8231dba4..00000000 --- a/src/Process/Types/GetProcessesResponseProcessesItemInfoExport.php +++ /dev/null @@ -1,45 +0,0 @@ -totalRecords = $values['totalRecords'] ?? null; - $this->fileSize = $values['fileSize'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Process/Types/GetProcessesResponseProcessesItemInfoImport.php b/src/Process/Types/GetProcessesResponseProcessesItemInfoImport.php index 64a9a589..a210a846 100644 --- a/src/Process/Types/GetProcessesResponseProcessesItemInfoImport.php +++ b/src/Process/Types/GetProcessesResponseProcessesItemInfoImport.php @@ -6,27 +6,27 @@ use Brevo\Core\Json\JsonProperty; /** - * Import process details + * Import process details with URLs to CSV reports */ class GetProcessesResponseProcessesItemInfoImport extends JsonSerializableType { /** - * @var ?int $invalidEmails Number of invalid email addresses + * @var ?string $invalidEmails URL to CSV file containing invalid email addresses, or null if none */ #[JsonProperty('invalid_emails')] - public ?int $invalidEmails; + public ?string $invalidEmails; /** - * @var ?int $duplicateContactId Number of duplicate contact IDs + * @var ?string $duplicateContactId URL to CSV file containing duplicate contact IDs, or null if none */ #[JsonProperty('duplicate_contact_id')] - public ?int $duplicateContactId; + public ?string $duplicateContactId; /** - * @var ?int $duplicateExtId Number of duplicate external IDs + * @var ?string $duplicateExtId URL to CSV file containing duplicate external IDs, or null if none */ #[JsonProperty('duplicate_ext_id')] - public ?int $duplicateExtId; + public ?string $duplicateExtId; /** * @var ?string $duplicateEmailId URL to CSV file containing duplicate email IDs, or null if none @@ -35,32 +35,32 @@ class GetProcessesResponseProcessesItemInfoImport extends JsonSerializableType public ?string $duplicateEmailId; /** - * @var ?int $duplicatePhoneId Number of duplicate phone numbers + * @var ?string $duplicatePhoneId URL to CSV file containing duplicate phone numbers, or null if none */ #[JsonProperty('duplicate_phone_id')] - public ?int $duplicatePhoneId; + public ?string $duplicatePhoneId; /** - * @var ?int $duplicateWhatsappId Number of duplicate WhatsApp numbers + * @var ?string $duplicateWhatsappId URL to CSV file containing duplicate WhatsApp numbers, or null if none */ #[JsonProperty('duplicate_whatsapp_id')] - public ?int $duplicateWhatsappId; + public ?string $duplicateWhatsappId; /** - * @var ?int $duplicateLandlineNumberId Number of duplicate landline numbers + * @var ?string $duplicateLandlineNumberId URL to CSV file containing duplicate landline numbers, or null if none */ #[JsonProperty('duplicate_landline_number_id')] - public ?int $duplicateLandlineNumberId; + public ?string $duplicateLandlineNumberId; /** * @param array{ - * invalidEmails?: ?int, - * duplicateContactId?: ?int, - * duplicateExtId?: ?int, + * invalidEmails?: ?string, + * duplicateContactId?: ?string, + * duplicateExtId?: ?string, * duplicateEmailId?: ?string, - * duplicatePhoneId?: ?int, - * duplicateWhatsappId?: ?int, - * duplicateLandlineNumberId?: ?int, + * duplicatePhoneId?: ?string, + * duplicateWhatsappId?: ?string, + * duplicateLandlineNumberId?: ?string, * } $values */ public function __construct( diff --git a/src/Program/Requests/GetLpListRequest.php b/src/Program/Requests/GetLpListRequest.php index afe933de..712c6c68 100644 --- a/src/Program/Requests/GetLpListRequest.php +++ b/src/Program/Requests/GetLpListRequest.php @@ -4,6 +4,7 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Program\Types\GetLpListRequestSortField; +use Brevo\Program\Types\GetLpListRequestSort; class GetLpListRequest extends JsonSerializableType { @@ -23,7 +24,7 @@ class GetLpListRequest extends JsonSerializableType public ?string $sortField; /** - * @var ?string $sort Sort documents by field + * @var ?value-of $sort Sort order */ public ?string $sort; @@ -32,7 +33,7 @@ class GetLpListRequest extends JsonSerializableType * limit?: ?int, * offset?: ?int, * sortField?: ?value-of, - * sort?: ?string, + * sort?: ?value-of, * } $values */ public function __construct( diff --git a/src/Program/Requests/SubscribeToLoyaltyProgramRequest.php b/src/Program/Requests/SubscribeToLoyaltyProgramRequest.php index 51e5c434..858aa40d 100644 --- a/src/Program/Requests/SubscribeToLoyaltyProgramRequest.php +++ b/src/Program/Requests/SubscribeToLoyaltyProgramRequest.php @@ -4,6 +4,9 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; +use DateTime; +use Brevo\Core\Types\Date; +use Brevo\Core\Types\ArrayType; class SubscribeToLoyaltyProgramRequest extends JsonSerializableType { @@ -13,30 +16,38 @@ class SubscribeToLoyaltyProgramRequest extends JsonSerializableType #[JsonProperty('contactId')] public int $contactId; - /** - * @var ?string $creationDate Optional custom date-time format. - */ - #[JsonProperty('creationDate')] - public ?string $creationDate; - /** * @var ?string $loyaltySubscriptionId Optional subscription ID (max length 64). */ #[JsonProperty('loyaltySubscriptionId')] public ?string $loyaltySubscriptionId; + /** + * @var ?DateTime $creationDate Optional creation date in ISO 8601 format (YYYY-MM-DDThh:mm:ss.ffffff+HH:MM). Must be in the past. + */ + #[JsonProperty('creationDate'), Date(Date::TYPE_DATETIME)] + public ?DateTime $creationDate; + + /** + * @var ?array $meta Optional metadata associated with the subscription. + */ + #[JsonProperty('meta'), ArrayType(['string' => 'mixed'])] + public ?array $meta; + /** * @param array{ * contactId: int, - * creationDate?: ?string, * loyaltySubscriptionId?: ?string, + * creationDate?: ?DateTime, + * meta?: ?array, * } $values */ public function __construct( array $values, ) { $this->contactId = $values['contactId']; - $this->creationDate = $values['creationDate'] ?? null; $this->loyaltySubscriptionId = $values['loyaltySubscriptionId'] ?? null; + $this->creationDate = $values['creationDate'] ?? null; + $this->meta = $values['meta'] ?? null; } } diff --git a/src/Program/Types/GetLpListRequestSort.php b/src/Program/Types/GetLpListRequestSort.php new file mode 100644 index 00000000..81b6a6c8 --- /dev/null +++ b/src/Program/Types/GetLpListRequestSort.php @@ -0,0 +1,9 @@ +, * rewardId?: ?string, - * updatedAt?: ?string, + * updatedAt?: ?DateTime, + * validFrom?: ?DateTime, * } $values */ public function __construct( @@ -87,6 +96,7 @@ public function __construct( $this->meta = $values['meta'] ?? null; $this->rewardId = $values['rewardId'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; + $this->validFrom = $values['validFrom'] ?? null; } /** diff --git a/src/Program/Types/SubscribeMemberToASubscriptionResponse.php b/src/Program/Types/SubscribeMemberToASubscriptionResponse.php index 452a9f40..02b4d3b4 100644 --- a/src/Program/Types/SubscribeMemberToASubscriptionResponse.php +++ b/src/Program/Types/SubscribeMemberToASubscriptionResponse.php @@ -5,21 +5,11 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; use Brevo\Core\Types\ArrayType; +use DateTime; +use Brevo\Core\Types\Date; class SubscribeMemberToASubscriptionResponse extends JsonSerializableType { - /** - * @var ?string $createdAt Timestamp when the subscription member was created. - */ - #[JsonProperty('createdAt')] - public ?string $createdAt; - - /** - * @var ?array $memberContactIds List of unique member contact IDs. - */ - #[JsonProperty('memberContactIds'), ArrayType(['integer'])] - public ?array $memberContactIds; - /** * @var ?int $organizationId Unique identifier of the organization. */ @@ -33,27 +23,39 @@ class SubscribeMemberToASubscriptionResponse extends JsonSerializableType public ?int $ownerContactId; /** - * @var ?string $updatedAt Timestamp when the subscription member was last updated. + * @var ?array $memberContactIds List of unique member contact IDs. + */ + #[JsonProperty('memberContactIds'), ArrayType(['integer'])] + public ?array $memberContactIds; + + /** + * @var ?DateTime $createdAt Timestamp when the subscription member was created. + */ + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; + + /** + * @var ?DateTime $updatedAt Timestamp when the subscription member was last updated. */ - #[JsonProperty('updatedAt')] - public ?string $updatedAt; + #[JsonProperty('updatedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $updatedAt; /** * @param array{ - * createdAt?: ?string, - * memberContactIds?: ?array, * organizationId?: ?int, * ownerContactId?: ?int, - * updatedAt?: ?string, + * memberContactIds?: ?array, + * createdAt?: ?DateTime, + * updatedAt?: ?DateTime, * } $values */ public function __construct( array $values = [], ) { - $this->createdAt = $values['createdAt'] ?? null; - $this->memberContactIds = $values['memberContactIds'] ?? null; $this->organizationId = $values['organizationId'] ?? null; $this->ownerContactId = $values['ownerContactId'] ?? null; + $this->memberContactIds = $values['memberContactIds'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; } diff --git a/src/Program/Types/SubscribeToLoyaltyProgramResponse.php b/src/Program/Types/SubscribeToLoyaltyProgramResponse.php index 31cb441c..40da5c46 100644 --- a/src/Program/Types/SubscribeToLoyaltyProgramResponse.php +++ b/src/Program/Types/SubscribeToLoyaltyProgramResponse.php @@ -4,20 +4,17 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; +use Brevo\Core\Types\ArrayType; +use DateTime; +use Brevo\Core\Types\Date; class SubscribeToLoyaltyProgramResponse extends JsonSerializableType { /** - * @var ?int $contactId Unique identifier of the contact. - */ - #[JsonProperty('contactId')] - public ?int $contactId; - - /** - * @var ?string $createdAt Timestamp when the subscription was created. + * @var ?int $organizationId Unique identifier of the organization. */ - #[JsonProperty('createdAt')] - public ?string $createdAt; + #[JsonProperty('organizationId')] + public ?int $organizationId; /** * @var ?string $loyaltyProgramId Unique identifier of the loyalty program. @@ -25,6 +22,18 @@ class SubscribeToLoyaltyProgramResponse extends JsonSerializableType #[JsonProperty('loyaltyProgramId')] public ?string $loyaltyProgramId; + /** + * @var ?int $versionId Version number of the subscription. + */ + #[JsonProperty('versionId')] + public ?int $versionId; + + /** + * @var ?int $contactId Unique identifier of the contact. + */ + #[JsonProperty('contactId')] + public ?int $contactId; + /** * @var ?string $loyaltySubscriptionId Unique identifier of the subscription. */ @@ -32,44 +41,46 @@ class SubscribeToLoyaltyProgramResponse extends JsonSerializableType public ?string $loyaltySubscriptionId; /** - * @var ?int $organizationId Unique identifier of the organization. + * @var ?array $meta Metadata associated with the subscription. */ - #[JsonProperty('organizationId')] - public ?int $organizationId; + #[JsonProperty('meta'), ArrayType(['string' => 'mixed'])] + public ?array $meta; /** - * @var ?string $updatedAt Timestamp when the subscription was last updated. + * @var ?DateTime $createdAt Timestamp when the subscription was created. */ - #[JsonProperty('updatedAt')] - public ?string $updatedAt; + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; /** - * @var ?int $versionId Version number of the subscription. + * @var ?DateTime $updatedAt Timestamp when the subscription was last updated. */ - #[JsonProperty('versionId')] - public ?int $versionId; + #[JsonProperty('updatedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $updatedAt; /** * @param array{ - * contactId?: ?int, - * createdAt?: ?string, - * loyaltyProgramId?: ?string, - * loyaltySubscriptionId?: ?string, * organizationId?: ?int, - * updatedAt?: ?string, + * loyaltyProgramId?: ?string, * versionId?: ?int, + * contactId?: ?int, + * loyaltySubscriptionId?: ?string, + * meta?: ?array, + * createdAt?: ?DateTime, + * updatedAt?: ?DateTime, * } $values */ public function __construct( array $values = [], ) { - $this->contactId = $values['contactId'] ?? null; - $this->createdAt = $values['createdAt'] ?? null; + $this->organizationId = $values['organizationId'] ?? null; $this->loyaltyProgramId = $values['loyaltyProgramId'] ?? null; + $this->versionId = $values['versionId'] ?? null; + $this->contactId = $values['contactId'] ?? null; $this->loyaltySubscriptionId = $values['loyaltySubscriptionId'] ?? null; - $this->organizationId = $values['organizationId'] ?? null; + $this->meta = $values['meta'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; - $this->versionId = $values['versionId'] ?? null; } /** diff --git a/src/Reward/Requests/CreateVoucherRequest.php b/src/Reward/Requests/CreateVoucherRequest.php index 26e12360..d061effb 100644 --- a/src/Reward/Requests/CreateVoucherRequest.php +++ b/src/Reward/Requests/CreateVoucherRequest.php @@ -50,6 +50,12 @@ class CreateVoucherRequest extends JsonSerializableType #[JsonProperty('value')] public ?float $value; + /** + * @var ?string $validFrom Date from which the voucher becomes valid. Accepts RFC 3339 or DD/MM/YYYY HH:MM AM/PM format. Converted to UTC using the organization's timezone. + */ + #[JsonProperty('validFrom')] + public ?string $validFrom; + /** * @param array{ * rewardId: string, @@ -59,6 +65,7 @@ class CreateVoucherRequest extends JsonSerializableType * loyaltySubscriptionId?: ?string, * meta?: ?array, * value?: ?float, + * validFrom?: ?string, * } $values */ public function __construct( @@ -71,5 +78,6 @@ public function __construct( $this->meta = $values['meta'] ?? null; $this->rewardId = $values['rewardId']; $this->value = $values['value'] ?? null; + $this->validFrom = $values['validFrom'] ?? null; } } diff --git a/src/Reward/Requests/RedeemVoucherRequest.php b/src/Reward/Requests/RedeemVoucherRequest.php index d76a9039..e65782fa 100644 --- a/src/Reward/Requests/RedeemVoucherRequest.php +++ b/src/Reward/Requests/RedeemVoucherRequest.php @@ -57,6 +57,12 @@ class RedeemVoucherRequest extends JsonSerializableType #[JsonProperty('ttl')] public ?int $ttl; + /** + * @var ?bool $autoComplete Whether the redemption should be automatically completed + */ + #[JsonProperty('autoComplete')] + public ?bool $autoComplete; + /** * @param array{ * attributedRewardId?: ?string, @@ -67,6 +73,7 @@ class RedeemVoucherRequest extends JsonSerializableType * order?: ?RedeemVoucherRequestOrder, * rewardId?: ?string, * ttl?: ?int, + * autoComplete?: ?bool, * } $values */ public function __construct( @@ -80,5 +87,6 @@ public function __construct( $this->order = $values['order'] ?? null; $this->rewardId = $values['rewardId'] ?? null; $this->ttl = $values['ttl'] ?? null; + $this->autoComplete = $values['autoComplete'] ?? null; } } diff --git a/src/Reward/Types/CreateRewardResponse.php b/src/Reward/Types/CreateRewardResponse.php index cb125965..f9d7d22b 100644 --- a/src/Reward/Types/CreateRewardResponse.php +++ b/src/Reward/Types/CreateRewardResponse.php @@ -3,18 +3,12 @@ namespace Brevo\Reward\Types; use Brevo\Core\Json\JsonSerializableType; -use DateTime; use Brevo\Core\Json\JsonProperty; +use DateTime; use Brevo\Core\Types\Date; class CreateRewardResponse extends JsonSerializableType { - /** - * @var ?DateTime $createdAt Timestamp when the reward was created - */ - #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] - public ?DateTime $createdAt; - /** * @var ?string $id Unique identifier for the reward */ @@ -22,7 +16,7 @@ class CreateRewardResponse extends JsonSerializableType public ?string $id; /** - * @var ?string $loyaltyProgramId Id of the loyalty program to which the current reward belongs to + * @var ?string $loyaltyProgramId Loyalty program to which the reward belongs */ #[JsonProperty('loyaltyProgramId')] public ?string $loyaltyProgramId; @@ -34,51 +28,57 @@ class CreateRewardResponse extends JsonSerializableType public ?string $name; /** - * @var ?string $publicDescription Public description for the reward + * @var ?string $publicDescription Public description of the reward */ #[JsonProperty('publicDescription')] public ?string $publicDescription; /** - * @var ?string $publicImage Public Image for the reward + * @var ?string $publicImage Public image URL of the reward */ #[JsonProperty('publicImage')] public ?string $publicImage; /** - * @var ?string $publicName Public name for the reward + * @var ?string $publicName Public name of the reward */ #[JsonProperty('publicName')] public ?string $publicName; /** - * @var ?string $updatedAt Timestamp for when this reward was last updated. + * @var ?DateTime $createdAt Timestamp when the reward was created + */ + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; + + /** + * @var ?DateTime $updatedAt Timestamp when the reward was last updated */ - #[JsonProperty('updatedAt')] - public ?string $updatedAt; + #[JsonProperty('updatedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $updatedAt; /** * @param array{ - * createdAt?: ?DateTime, * id?: ?string, * loyaltyProgramId?: ?string, * name?: ?string, * publicDescription?: ?string, * publicImage?: ?string, * publicName?: ?string, - * updatedAt?: ?string, + * createdAt?: ?DateTime, + * updatedAt?: ?DateTime, * } $values */ public function __construct( array $values = [], ) { - $this->createdAt = $values['createdAt'] ?? null; $this->id = $values['id'] ?? null; $this->loyaltyProgramId = $values['loyaltyProgramId'] ?? null; $this->name = $values['name'] ?? null; $this->publicDescription = $values['publicDescription'] ?? null; $this->publicImage = $values['publicImage'] ?? null; $this->publicName = $values['publicName'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; } diff --git a/src/Reward/Types/CreateVoucherResponse.php b/src/Reward/Types/CreateVoucherResponse.php index 96dd3d02..17a6c5ce 100644 --- a/src/Reward/Types/CreateVoucherResponse.php +++ b/src/Reward/Types/CreateVoucherResponse.php @@ -76,6 +76,12 @@ class CreateVoucherResponse extends JsonSerializableType #[JsonProperty('value')] public ?float $value; + /** + * @var ?DateTime $validFrom Date from which the voucher becomes valid + */ + #[JsonProperty('validFrom'), Date(Date::TYPE_DATETIME)] + public ?DateTime $validFrom; + /** * @param array{ * code?: ?string, @@ -89,6 +95,7 @@ class CreateVoucherResponse extends JsonSerializableType * rewardId?: ?string, * updatedAt?: ?DateTime, * value?: ?float, + * validFrom?: ?DateTime, * } $values */ public function __construct( @@ -105,6 +112,7 @@ public function __construct( $this->rewardId = $values['rewardId'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; $this->value = $values['value'] ?? null; + $this->validFrom = $values['validFrom'] ?? null; } /** diff --git a/src/Reward/Types/GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem.php b/src/Reward/Types/GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem.php index 439177e8..fb735285 100644 --- a/src/Reward/Types/GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem.php +++ b/src/Reward/Types/GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem.php @@ -5,6 +5,8 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; use Brevo\Core\Types\ArrayType; +use DateTime; +use Brevo\Core\Types\Date; class GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem extends JsonSerializableType { @@ -68,6 +70,12 @@ class GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem extends JsonS #[JsonProperty('value')] public ?float $value; + /** + * @var ?DateTime $validFrom Date from which the voucher becomes valid + */ + #[JsonProperty('validFrom'), Date(Date::TYPE_DATETIME)] + public ?DateTime $validFrom; + /** * @param array{ * code?: ?string, @@ -80,6 +88,7 @@ class GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem extends JsonS * unit?: ?string, * updatedAt?: ?string, * value?: ?float, + * validFrom?: ?DateTime, * } $values */ public function __construct( @@ -95,6 +104,7 @@ public function __construct( $this->unit = $values['unit'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; $this->value = $values['value'] ?? null; + $this->validFrom = $values['validFrom'] ?? null; } /** diff --git a/src/Senders/Types/GetIpsResponseIpsItem.php b/src/Senders/Types/GetIpsResponseIpsItem.php index d18da041..ba453376 100644 --- a/src/Senders/Types/GetIpsResponseIpsItem.php +++ b/src/Senders/Types/GetIpsResponseIpsItem.php @@ -7,6 +7,12 @@ class GetIpsResponseIpsItem extends JsonSerializableType { + /** + * @var int $id ID of the dedicated IP + */ + #[JsonProperty('id')] + public int $id; + /** * @var bool $active Status of the IP (true=active, false=inactive) */ @@ -19,12 +25,6 @@ class GetIpsResponseIpsItem extends JsonSerializableType #[JsonProperty('domain')] public string $domain; - /** - * @var int $id ID of the dedicated IP - */ - #[JsonProperty('id')] - public int $id; - /** * @var string $ip Dedicated IP address */ @@ -33,18 +33,18 @@ class GetIpsResponseIpsItem extends JsonSerializableType /** * @param array{ + * id: int, * active: bool, * domain: string, - * id: int, * ip: string, * } $values */ public function __construct( array $values, ) { + $this->id = $values['id']; $this->active = $values['active']; $this->domain = $values['domain']; - $this->id = $values['id']; $this->ip = $values['ip']; } diff --git a/src/SmsCampaigns/Requests/GetSmsCampaignsRequest.php b/src/SmsCampaigns/Requests/GetSmsCampaignsRequest.php index fca79b28..41b31cbc 100644 --- a/src/SmsCampaigns/Requests/GetSmsCampaignsRequest.php +++ b/src/SmsCampaigns/Requests/GetSmsCampaignsRequest.php @@ -14,17 +14,17 @@ class GetSmsCampaignsRequest extends JsonSerializableType public ?string $status; /** - * @var ?string $startDate **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + * @var ?string $startDate **Mandatory if endDate is used.** Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent SMS campaigns. **Prefer to pass your timezone in date-time format for accurate result.** Only available if `status` is not passed or is set to `sent`. `startDate` must not be in the future. */ public ?string $startDate; /** - * @var ?string $endDate **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. **Prefer to pass your timezone in date-time format for accurate result** ( only available if either 'status' not passed and if passed is set to 'sent' ) + * @var ?string $endDate **Mandatory if startDate is used.** Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent SMS campaigns. **Prefer to pass your timezone in date-time format for accurate result.** Only available if `status` is not passed or is set to `sent`. `endDate` must not be in the future. */ public ?string $endDate; /** - * @var ?int $limit Number limitation for the result returned + * @var ?int $limit Number of documents per page */ public ?int $limit = 500; diff --git a/src/SmsCampaigns/SmsCampaignsClient.php b/src/SmsCampaigns/SmsCampaignsClient.php index da375445..9fb9d8e0 100644 --- a/src/SmsCampaigns/SmsCampaignsClient.php +++ b/src/SmsCampaigns/SmsCampaignsClient.php @@ -60,6 +60,8 @@ public function __construct( } /** + * Retrieve a paginated list of all your SMS campaigns with their statistics and recipient information. Results can be filtered by status and date range, with a default limit of 500 and maximum of 1000 per page. The sort order defaults to descending by creation date; date filters are only available when status is not passed or is set to sent. + * * @param GetSmsCampaignsRequest $request * @param ?array{ * baseUrl?: string, @@ -126,6 +128,8 @@ public function getSmsCampaigns(GetSmsCampaignsRequest $request = new GetSmsCamp } /** + * Create a new SMS campaign with the required name, sender, and content fields. The sender name is limited to 11 alphanumeric characters or 15 numeric characters, and the content should stay within 160 characters per SMS segment. If a scheduledAt date is provided, listIds in recipients become mandatory; accounts under validation are limited to 4 total campaigns and campaigns with more than 10 recipients will be saved as draft. + * * @param CreateSmsCampaignRequest $request * @param ?array{ * baseUrl?: string, @@ -173,6 +177,8 @@ public function createSmsCampaign(CreateSmsCampaignRequest $request, ?array $opt } /** + * Retrieve detailed information about a specific SMS campaign by its ID, including campaign content, sender, recipients with list names, statistics (delivered, sent, bounces, unsubscriptions, answered), and tags. Unlike the list endpoint, recipients are returned as objects with id and name fields rather than plain IDs. + * * @param int $campaignId id of the SMS campaign * @param ?array{ * baseUrl?: string, @@ -219,6 +225,8 @@ public function getSmsCampaign(int $campaignId, ?array $options = null): ?GetSms } /** + * Update an existing SMS campaign''s properties such as name, sender, content, recipients, scheduled date, organisation prefix, and unsubscribe instructions. The request body must contain at least one valid field to update. The campaign must exist and must be of type SMS; if a scheduledAt is provided, valid recipients must be present either in the request or already configured on the campaign. + * * @param int $campaignId id of the SMS campaign * @param UpdateSmsCampaignRequest $request * @param ?array{ @@ -260,6 +268,8 @@ public function updateSmsCampaign(int $campaignId, UpdateSmsCampaignRequest $req } /** + * Delete an SMS campaign by its campaign ID. Only campaigns that have not been scheduled or sent can be deleted; attempting to delete a campaign that is queued, in process, or has been sent with recipients will return a 403 permission denied error. + * * @param int $campaignId id of the SMS campaign * @param ?array{ * baseUrl?: string, @@ -349,6 +359,8 @@ public function requestSmsRecipientExport(int $campaignId, RequestSmsRecipientEx } /** + * Send an existing SMS campaign immediately by scheduling it for the current time. The system verifies your account''s SMS credit balance before dispatching; if credits are insufficient or the remaining credit is less than the number of recipients, a 402 error is returned. The campaign must have valid recipients and content already configured. + * * @param int $campaignId id of the campaign * @param ?array{ * baseUrl?: string, @@ -431,6 +443,8 @@ public function sendSmsReport(int $campaignId, SendSmsReportRequest $request, ?a } /** + * Send a test SMS to a specified phone number to preview the campaign before sending it to all recipients. The phone number must belong to one of your existing contacts in your Brevo account and must not be blacklisted. The number should include the country code (e.g. 33689965433). + * * @param int $campaignId Id of the SMS campaign * @param SendTestSmsRequest $request * @param ?array{ @@ -472,6 +486,8 @@ public function sendTestSms(int $campaignId, SendTestSmsRequest $request = new S } /** + * Update the status of an SMS campaign, such as suspending, archiving, or replicating it. Available status values include suspended, archive, darchive, sent, queued, replicate, replicateTemplate, cancel, and draft. Note that the replicateTemplate status is only available for template type campaigns. + * * @param int $campaignId id of the campaign * @param UpdateSmsCampaignStatusRequest $request * @param ?array{ diff --git a/src/SmsCampaigns/SmsCampaignsClientInterface.php b/src/SmsCampaigns/SmsCampaignsClientInterface.php index 0f9f07f7..b7d779fd 100644 --- a/src/SmsCampaigns/SmsCampaignsClientInterface.php +++ b/src/SmsCampaigns/SmsCampaignsClientInterface.php @@ -17,6 +17,8 @@ interface SmsCampaignsClientInterface { /** + * Retrieve a paginated list of all your SMS campaigns with their statistics and recipient information. Results can be filtered by status and date range, with a default limit of 500 and maximum of 1000 per page. The sort order defaults to descending by creation date; date filters are only available when status is not passed or is set to sent. + * * @param GetSmsCampaignsRequest $request * @param ?array{ * baseUrl?: string, @@ -31,6 +33,8 @@ interface SmsCampaignsClientInterface public function getSmsCampaigns(GetSmsCampaignsRequest $request = new GetSmsCampaignsRequest(), ?array $options = null): ?GetSmsCampaignsResponse; /** + * Create a new SMS campaign with the required name, sender, and content fields. The sender name is limited to 11 alphanumeric characters or 15 numeric characters, and the content should stay within 160 characters per SMS segment. If a scheduledAt date is provided, listIds in recipients become mandatory; accounts under validation are limited to 4 total campaigns and campaigns with more than 10 recipients will be saved as draft. + * * @param CreateSmsCampaignRequest $request * @param ?array{ * baseUrl?: string, @@ -45,6 +49,8 @@ public function getSmsCampaigns(GetSmsCampaignsRequest $request = new GetSmsCamp public function createSmsCampaign(CreateSmsCampaignRequest $request, ?array $options = null): ?CreateSmsCampaignResponse; /** + * Retrieve detailed information about a specific SMS campaign by its ID, including campaign content, sender, recipients with list names, statistics (delivered, sent, bounces, unsubscriptions, answered), and tags. Unlike the list endpoint, recipients are returned as objects with id and name fields rather than plain IDs. + * * @param int $campaignId id of the SMS campaign * @param ?array{ * baseUrl?: string, @@ -59,6 +65,8 @@ public function createSmsCampaign(CreateSmsCampaignRequest $request, ?array $opt public function getSmsCampaign(int $campaignId, ?array $options = null): ?GetSmsCampaignResponse; /** + * Update an existing SMS campaign''s properties such as name, sender, content, recipients, scheduled date, organisation prefix, and unsubscribe instructions. The request body must contain at least one valid field to update. The campaign must exist and must be of type SMS; if a scheduledAt is provided, valid recipients must be present either in the request or already configured on the campaign. + * * @param int $campaignId id of the SMS campaign * @param UpdateSmsCampaignRequest $request * @param ?array{ @@ -73,6 +81,8 @@ public function getSmsCampaign(int $campaignId, ?array $options = null): ?GetSms public function updateSmsCampaign(int $campaignId, UpdateSmsCampaignRequest $request = new UpdateSmsCampaignRequest(), ?array $options = null): void; /** + * Delete an SMS campaign by its campaign ID. Only campaigns that have not been scheduled or sent can be deleted; attempting to delete a campaign that is queued, in process, or has been sent with recipients will return a 403 permission denied error. + * * @param int $campaignId id of the SMS campaign * @param ?array{ * baseUrl?: string, @@ -103,6 +113,8 @@ public function deleteSmsCampaign(int $campaignId, ?array $options = null): void public function requestSmsRecipientExport(int $campaignId, RequestSmsRecipientExportRequest $request, ?array $options = null): ?RequestSmsRecipientExportResponse; /** + * Send an existing SMS campaign immediately by scheduling it for the current time. The system verifies your account''s SMS credit balance before dispatching; if credits are insufficient or the remaining credit is less than the number of recipients, a 402 error is returned. The campaign must have valid recipients and content already configured. + * * @param int $campaignId id of the campaign * @param ?array{ * baseUrl?: string, @@ -132,6 +144,8 @@ public function sendSmsCampaignNow(int $campaignId, ?array $options = null): voi public function sendSmsReport(int $campaignId, SendSmsReportRequest $request, ?array $options = null): void; /** + * Send a test SMS to a specified phone number to preview the campaign before sending it to all recipients. The phone number must belong to one of your existing contacts in your Brevo account and must not be blacklisted. The number should include the country code (e.g. 33689965433). + * * @param int $campaignId Id of the SMS campaign * @param SendTestSmsRequest $request * @param ?array{ @@ -146,6 +160,8 @@ public function sendSmsReport(int $campaignId, SendSmsReportRequest $request, ?a public function sendTestSms(int $campaignId, SendTestSmsRequest $request = new SendTestSmsRequest(), ?array $options = null): void; /** + * Update the status of an SMS campaign, such as suspending, archiving, or replicating it. Available status values include suspended, archive, darchive, sent, queued, replicate, replicateTemplate, cancel, and draft. Note that the replicateTemplate status is only available for template type campaigns. + * * @param int $campaignId id of the campaign * @param UpdateSmsCampaignStatusRequest $request * @param ?array{ diff --git a/src/SmsCampaigns/Types/GetSmsCampaignResponse.php b/src/SmsCampaigns/Types/GetSmsCampaignResponse.php index 7d6e2fea..75c7c248 100644 --- a/src/SmsCampaigns/Types/GetSmsCampaignResponse.php +++ b/src/SmsCampaigns/Types/GetSmsCampaignResponse.php @@ -4,8 +4,8 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; -use Brevo\Types\GetCampaignRecipients; use Brevo\Types\GetSmsCampaignStats; +use Brevo\Core\Types\ArrayType; class GetSmsCampaignResponse extends JsonSerializableType { @@ -40,7 +40,13 @@ class GetSmsCampaignResponse extends JsonSerializableType public string $name; /** - * @var ?string $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format + * @var ?string $organisationPrefix A recognizable prefix added as the Brand Name before the message content. Empty string if not set. + */ + #[JsonProperty('organisationPrefix')] + public ?string $organisationPrefix; + + /** + * @var ?string $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format. Empty string if not scheduled. */ #[JsonProperty('scheduledAt')] public ?string $scheduledAt; @@ -51,6 +57,12 @@ class GetSmsCampaignResponse extends JsonSerializableType #[JsonProperty('sender')] public string $sender; + /** + * @var ?string $sentDate UTC date-time on which the SMS campaign was sent (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if the campaign status is 'sent'. + */ + #[JsonProperty('sentDate')] + public ?string $sentDate; + /** * @var value-of $status Status of the SMS Campaign */ @@ -58,10 +70,16 @@ class GetSmsCampaignResponse extends JsonSerializableType public string $status; /** - * @var GetCampaignRecipients $recipients + * @var ?string $unsubscribeInstruction Instructions to unsubscribe from future communications. Empty string if not set. + */ + #[JsonProperty('unsubscribeInstruction')] + public ?string $unsubscribeInstruction; + + /** + * @var GetSmsCampaignResponseRecipients $recipients Recipients of the SMS campaign. For a single campaign, lists and exclusion lists are returned as objects with id and name. */ #[JsonProperty('recipients')] - public GetCampaignRecipients $recipients; + public GetSmsCampaignResponseRecipients $recipients; /** * @var GetSmsCampaignStats $statistics @@ -69,6 +87,12 @@ class GetSmsCampaignResponse extends JsonSerializableType #[JsonProperty('statistics')] public GetSmsCampaignStats $statistics; + /** + * @var ?array $tags Tags (labels) associated with the SMS campaign. Only available when retrieving a single campaign. + */ + #[JsonProperty('tags'), ArrayType(['string'])] + public ?array $tags; + /** * @param array{ * content: string, @@ -78,9 +102,13 @@ class GetSmsCampaignResponse extends JsonSerializableType * name: string, * sender: string, * status: value-of, - * recipients: GetCampaignRecipients, + * recipients: GetSmsCampaignResponseRecipients, * statistics: GetSmsCampaignStats, + * organisationPrefix?: ?string, * scheduledAt?: ?string, + * sentDate?: ?string, + * unsubscribeInstruction?: ?string, + * tags?: ?array, * } $values */ public function __construct( @@ -91,11 +119,15 @@ public function __construct( $this->id = $values['id']; $this->modifiedAt = $values['modifiedAt']; $this->name = $values['name']; + $this->organisationPrefix = $values['organisationPrefix'] ?? null; $this->scheduledAt = $values['scheduledAt'] ?? null; $this->sender = $values['sender']; + $this->sentDate = $values['sentDate'] ?? null; $this->status = $values['status']; + $this->unsubscribeInstruction = $values['unsubscribeInstruction'] ?? null; $this->recipients = $values['recipients']; $this->statistics = $values['statistics']; + $this->tags = $values['tags'] ?? null; } /** diff --git a/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipients.php b/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipients.php new file mode 100644 index 00000000..06c6d950 --- /dev/null +++ b/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipients.php @@ -0,0 +1,46 @@ + $exclusionLists + */ + #[JsonProperty('exclusionLists'), ArrayType([GetSmsCampaignResponseRecipientsExclusionListsItem::class])] + public ?array $exclusionLists; + + /** + * @var ?array $lists + */ + #[JsonProperty('lists'), ArrayType([GetSmsCampaignResponseRecipientsListsItem::class])] + public ?array $lists; + + /** + * @param array{ + * exclusionLists?: ?array, + * lists?: ?array, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->exclusionLists = $values['exclusionLists'] ?? null; + $this->lists = $values['lists'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipientsExclusionListsItem.php b/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipientsExclusionListsItem.php new file mode 100644 index 00000000..bfb354eb --- /dev/null +++ b/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipientsExclusionListsItem.php @@ -0,0 +1,42 @@ +id = $values['id'] ?? null; + $this->name = $values['name'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipientsListsItem.php b/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipientsListsItem.php new file mode 100644 index 00000000..84e5c4a1 --- /dev/null +++ b/src/SmsCampaigns/Types/GetSmsCampaignResponseRecipientsListsItem.php @@ -0,0 +1,42 @@ +id = $values['id'] ?? null; + $this->name = $values['name'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/SmsCampaigns/Types/GetSmsCampaignsResponseCampaignsItem.php b/src/SmsCampaigns/Types/GetSmsCampaignsResponseCampaignsItem.php index 5ae7d6ab..f0603eaf 100644 --- a/src/SmsCampaigns/Types/GetSmsCampaignsResponseCampaignsItem.php +++ b/src/SmsCampaigns/Types/GetSmsCampaignsResponseCampaignsItem.php @@ -40,7 +40,13 @@ class GetSmsCampaignsResponseCampaignsItem extends JsonSerializableType public string $name; /** - * @var ?string $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format + * @var ?string $organisationPrefix A recognizable prefix added as the Brand Name before the message content. Empty string if not set. + */ + #[JsonProperty('organisationPrefix')] + public ?string $organisationPrefix; + + /** + * @var ?string $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format. Empty string if not scheduled. */ #[JsonProperty('scheduledAt')] public ?string $scheduledAt; @@ -51,12 +57,24 @@ class GetSmsCampaignsResponseCampaignsItem extends JsonSerializableType #[JsonProperty('sender')] public string $sender; + /** + * @var ?string $sentDate UTC date-time on which the SMS campaign was sent (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if the campaign status is 'sent'. + */ + #[JsonProperty('sentDate')] + public ?string $sentDate; + /** * @var value-of $status Status of the SMS Campaign */ #[JsonProperty('status')] public string $status; + /** + * @var ?string $unsubscribeInstruction Instructions to unsubscribe from future communications. Empty string if not set. + */ + #[JsonProperty('unsubscribeInstruction')] + public ?string $unsubscribeInstruction; + /** * @var GetCampaignRecipients $recipients */ @@ -80,7 +98,10 @@ class GetSmsCampaignsResponseCampaignsItem extends JsonSerializableType * status: value-of, * recipients: GetCampaignRecipients, * statistics: GetSmsCampaignStats, + * organisationPrefix?: ?string, * scheduledAt?: ?string, + * sentDate?: ?string, + * unsubscribeInstruction?: ?string, * } $values */ public function __construct( @@ -91,9 +112,12 @@ public function __construct( $this->id = $values['id']; $this->modifiedAt = $values['modifiedAt']; $this->name = $values['name']; + $this->organisationPrefix = $values['organisationPrefix'] ?? null; $this->scheduledAt = $values['scheduledAt'] ?? null; $this->sender = $values['sender']; + $this->sentDate = $values['sentDate'] ?? null; $this->status = $values['status']; + $this->unsubscribeInstruction = $values['unsubscribeInstruction'] ?? null; $this->recipients = $values['recipients']; $this->statistics = $values['statistics']; } diff --git a/src/Tasks/TasksClient.php b/src/Tasks/TasksClient.php index a4acbac8..4c999ce1 100644 --- a/src/Tasks/TasksClient.php +++ b/src/Tasks/TasksClient.php @@ -17,7 +17,8 @@ use Brevo\Tasks\Types\PostCrmTasksResponse; use Brevo\Types\Task; use Brevo\Tasks\Requests\PatchCrmTasksIdRequest; -use Brevo\Tasks\Types\GetCrmTasktypesResponse; +use Brevo\Tasks\Types\GetCrmTasktypesResponseItem; +use Brevo\Core\Json\JsonDecoder; class TasksClient implements TasksClientInterface { @@ -56,6 +57,8 @@ public function __construct( } /** + * Retrieve a paginated list of CRM tasks with optional filtering by task type, status, date range, assignee, and linked entities (contacts, deals, companies). Results are sorted by creation date in descending order by default, with a default limit of 50 tasks per page. + * * @param GetCrmTasksRequest $request * @param ?array{ * baseUrl?: string, @@ -143,6 +146,8 @@ public function getAllTasks(GetCrmTasksRequest $request = new GetCrmTasksRequest } /** + * Create a new CRM task with the specified name, type, due date, and optional associations to contacts, companies, or deals. A task requires a name, task type ID, and due date at minimum. You can also set a duration, notes, a reminder, and assign the task to a specific user. + * * @param PostCrmTasksRequest $request * @param ?array{ * baseUrl?: string, @@ -190,6 +195,8 @@ public function createATask(PostCrmTasksRequest $request, ?array $options = null } /** + * Retrieve the full details of a single CRM task by its identifier. The response includes the task''s name, type, status, due date, duration, notes, assignee, reminder settings, and linked contacts, companies, or deals. + * * @param string $id * @param ?array{ * baseUrl?: string, @@ -236,6 +243,8 @@ public function getATask(string $id, ?array $options = null): ?Task } /** + * Permanently delete a CRM task by its identifier. This removes the task and cancels any associated reminders. The requesting user must be the task assignee or have manage permission on tasks. + * * @param string $id * @param ?array{ * baseUrl?: string, @@ -275,6 +284,8 @@ public function deleteATask(string $id, ?array $options = null): void } /** + * Update an existing CRM task''s properties such as name, type, due date, status, duration, notes, assignee, reminder, or linked entities. Only the fields provided in the request body will be updated; omitted fields remain unchanged. + * * @param string $id * @param PatchCrmTasksIdRequest $request * @param ?array{ @@ -316,6 +327,8 @@ public function updateATask(string $id, PatchCrmTasksIdRequest $request = new Pa } /** + * Retrieve the list of all available task types, such as Email, Call, Meeting, Todo, Lunch, Deadline, and LinkedIn. If no task types exist yet, the default set is automatically created and returned. Use the task type ID when creating or updating tasks. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -324,11 +337,11 @@ public function updateATask(string $id, PatchCrmTasksIdRequest $request = new Pa * queryParameters?: array, * bodyProperties?: array, * } $options - * @return ?GetCrmTasktypesResponse + * @return ?array * @throws BrevoException * @throws BrevoApiException */ - public function getAllTaskTypes(?array $options = null): ?GetCrmTasktypesResponse + public function getAllTaskTypes(?array $options = null): ?array { $options = array_merge($this->options, $options ?? []); try { @@ -346,7 +359,7 @@ public function getAllTaskTypes(?array $options = null): ?GetCrmTasktypesRespons if (empty($json)) { return null; } - return GetCrmTasktypesResponse::fromJson($json); + return JsonDecoder::decodeArray($json, [GetCrmTasktypesResponseItem::class]); // @phpstan-ignore-line } } catch (JsonException $e) { throw new BrevoException(message: "Failed to deserialize response: {$e->getMessage()}", previous: $e); diff --git a/src/Tasks/TasksClientInterface.php b/src/Tasks/TasksClientInterface.php index bb921082..1fd262d9 100644 --- a/src/Tasks/TasksClientInterface.php +++ b/src/Tasks/TasksClientInterface.php @@ -8,11 +8,13 @@ use Brevo\Tasks\Types\PostCrmTasksResponse; use Brevo\Types\Task; use Brevo\Tasks\Requests\PatchCrmTasksIdRequest; -use Brevo\Tasks\Types\GetCrmTasktypesResponse; +use Brevo\Tasks\Types\GetCrmTasktypesResponseItem; interface TasksClientInterface { /** + * Retrieve a paginated list of CRM tasks with optional filtering by task type, status, date range, assignee, and linked entities (contacts, deals, companies). Results are sorted by creation date in descending order by default, with a default limit of 50 tasks per page. + * * @param GetCrmTasksRequest $request * @param ?array{ * baseUrl?: string, @@ -27,6 +29,8 @@ interface TasksClientInterface public function getAllTasks(GetCrmTasksRequest $request = new GetCrmTasksRequest(), ?array $options = null): ?GetCrmTasksResponse; /** + * Create a new CRM task with the specified name, type, due date, and optional associations to contacts, companies, or deals. A task requires a name, task type ID, and due date at minimum. You can also set a duration, notes, a reminder, and assign the task to a specific user. + * * @param PostCrmTasksRequest $request * @param ?array{ * baseUrl?: string, @@ -41,6 +45,8 @@ public function getAllTasks(GetCrmTasksRequest $request = new GetCrmTasksRequest public function createATask(PostCrmTasksRequest $request, ?array $options = null): ?PostCrmTasksResponse; /** + * Retrieve the full details of a single CRM task by its identifier. The response includes the task''s name, type, status, due date, duration, notes, assignee, reminder settings, and linked contacts, companies, or deals. + * * @param string $id * @param ?array{ * baseUrl?: string, @@ -55,6 +61,8 @@ public function createATask(PostCrmTasksRequest $request, ?array $options = null public function getATask(string $id, ?array $options = null): ?Task; /** + * Permanently delete a CRM task by its identifier. This removes the task and cancels any associated reminders. The requesting user must be the task assignee or have manage permission on tasks. + * * @param string $id * @param ?array{ * baseUrl?: string, @@ -68,6 +76,8 @@ public function getATask(string $id, ?array $options = null): ?Task; public function deleteATask(string $id, ?array $options = null): void; /** + * Update an existing CRM task''s properties such as name, type, due date, status, duration, notes, assignee, reminder, or linked entities. Only the fields provided in the request body will be updated; omitted fields remain unchanged. + * * @param string $id * @param PatchCrmTasksIdRequest $request * @param ?array{ @@ -82,6 +92,8 @@ public function deleteATask(string $id, ?array $options = null): void; public function updateATask(string $id, PatchCrmTasksIdRequest $request = new PatchCrmTasksIdRequest(), ?array $options = null): void; /** + * Retrieve the list of all available task types, such as Email, Call, Meeting, Todo, Lunch, Deadline, and LinkedIn. If no task types exist yet, the default set is automatically created and returned. Use the task type ID when creating or updating tasks. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -90,7 +102,7 @@ public function updateATask(string $id, PatchCrmTasksIdRequest $request = new Pa * queryParameters?: array, * bodyProperties?: array, * } $options - * @return ?GetCrmTasktypesResponse + * @return ?array */ - public function getAllTaskTypes(?array $options = null): ?GetCrmTasktypesResponse; + public function getAllTaskTypes(?array $options = null): ?array; } diff --git a/src/Tasks/Types/GetCrmTasktypesResponse.php b/src/Tasks/Types/GetCrmTasktypesResponseItem.php similarity index 89% rename from src/Tasks/Types/GetCrmTasktypesResponse.php rename to src/Tasks/Types/GetCrmTasktypesResponseItem.php index d2d1ef6e..9fb97df3 100644 --- a/src/Tasks/Types/GetCrmTasktypesResponse.php +++ b/src/Tasks/Types/GetCrmTasktypesResponseItem.php @@ -5,10 +5,7 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; -/** - * Task types details - */ -class GetCrmTasktypesResponse extends JsonSerializableType +class GetCrmTasktypesResponseItem extends JsonSerializableType { /** * @var ?string $id Id of task type diff --git a/src/Tier/Requests/CreateTierGroupRequest.php b/src/Tier/Requests/CreateTierGroupRequest.php index 63ec4611..e69b8650 100644 --- a/src/Tier/Requests/CreateTierGroupRequest.php +++ b/src/Tier/Requests/CreateTierGroupRequest.php @@ -8,6 +8,8 @@ use Brevo\Tier\Types\CreateTierGroupRequestMeta; use Brevo\Core\Types\ArrayType; use Brevo\Tier\Types\CreateTierGroupRequestUpgradeStrategy; +use Brevo\Tier\Types\CreateTierGroupRequestUpgradeSchedule; +use Brevo\Tier\Types\CreateTierGroupRequestDowngradeSchedule; class CreateTierGroupRequest extends JsonSerializableType { @@ -41,6 +43,18 @@ class CreateTierGroupRequest extends JsonSerializableType #[JsonProperty('upgradeStrategy')] public ?string $upgradeStrategy; + /** + * @var ?CreateTierGroupRequestUpgradeSchedule $upgradeSchedule Schedule configuration for tier upgrades. Required when upgradeStrategy is set to a schedule-based strategy. + */ + #[JsonProperty('upgradeSchedule')] + public ?CreateTierGroupRequestUpgradeSchedule $upgradeSchedule; + + /** + * @var ?CreateTierGroupRequestDowngradeSchedule $downgradeSchedule Schedule configuration for tier downgrades. Required when downgradeStrategy is set to a schedule-based strategy. + */ + #[JsonProperty('downgradeSchedule')] + public ?CreateTierGroupRequestDowngradeSchedule $downgradeSchedule; + /** * @param array{ * name: string, @@ -48,6 +62,8 @@ class CreateTierGroupRequest extends JsonSerializableType * meta?: ?CreateTierGroupRequestMeta, * tierOrder?: ?array, * upgradeStrategy?: ?value-of, + * upgradeSchedule?: ?CreateTierGroupRequestUpgradeSchedule, + * downgradeSchedule?: ?CreateTierGroupRequestDowngradeSchedule, * } $values */ public function __construct( @@ -58,5 +74,7 @@ public function __construct( $this->meta = $values['meta'] ?? null; $this->tierOrder = $values['tierOrder'] ?? null; $this->upgradeStrategy = $values['upgradeStrategy'] ?? null; + $this->upgradeSchedule = $values['upgradeSchedule'] ?? null; + $this->downgradeSchedule = $values['downgradeSchedule'] ?? null; } } diff --git a/src/Tier/Types/CreateTierGroupRequestDowngradeSchedule.php b/src/Tier/Types/CreateTierGroupRequestDowngradeSchedule.php new file mode 100644 index 00000000..d8f9d7ce --- /dev/null +++ b/src/Tier/Types/CreateTierGroupRequestDowngradeSchedule.php @@ -0,0 +1,61 @@ + $durationUnit Duration unit for the schedule. + */ + #[JsonProperty('durationUnit')] + public ?string $durationUnit; + + /** + * @var ?value-of $durationModifier Modifier for the duration. + */ + #[JsonProperty('durationModifier')] + public ?string $durationModifier; + + /** + * @var ?string $scheduledDate Scheduled date in DD/MM format. + */ + #[JsonProperty('scheduledDate')] + public ?string $scheduledDate; + + /** + * @param array{ + * durationValue?: ?int, + * durationUnit?: ?value-of, + * durationModifier?: ?value-of, + * scheduledDate?: ?string, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->durationValue = $values['durationValue'] ?? null; + $this->durationUnit = $values['durationUnit'] ?? null; + $this->durationModifier = $values['durationModifier'] ?? null; + $this->scheduledDate = $values['scheduledDate'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Tier/Types/CreateTierGroupRequestDowngradeScheduleDurationModifier.php b/src/Tier/Types/CreateTierGroupRequestDowngradeScheduleDurationModifier.php new file mode 100644 index 00000000..00bb9a19 --- /dev/null +++ b/src/Tier/Types/CreateTierGroupRequestDowngradeScheduleDurationModifier.php @@ -0,0 +1,9 @@ + $durationUnit Duration unit for the schedule. + */ + #[JsonProperty('durationUnit')] + public ?string $durationUnit; + + /** + * @var ?value-of $durationModifier Modifier for the duration. + */ + #[JsonProperty('durationModifier')] + public ?string $durationModifier; + + /** + * @var ?string $scheduledDate Scheduled date in DD/MM format. + */ + #[JsonProperty('scheduledDate')] + public ?string $scheduledDate; + + /** + * @param array{ + * durationValue?: ?int, + * durationUnit?: ?value-of, + * durationModifier?: ?value-of, + * scheduledDate?: ?string, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->durationValue = $values['durationValue'] ?? null; + $this->durationUnit = $values['durationUnit'] ?? null; + $this->durationModifier = $values['durationModifier'] ?? null; + $this->scheduledDate = $values['scheduledDate'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Tier/Types/CreateTierGroupRequestUpgradeScheduleDurationModifier.php b/src/Tier/Types/CreateTierGroupRequestUpgradeScheduleDurationModifier.php new file mode 100644 index 00000000..10b962f7 --- /dev/null +++ b/src/Tier/Types/CreateTierGroupRequestUpgradeScheduleDurationModifier.php @@ -0,0 +1,9 @@ +fromDate = $values['fromDate'] ?? null; + $this->toDate = $values['toDate'] ?? null; + } +} diff --git a/src/TransactionalEmails/Requests/GetAggregatedSmtpReportRequest.php b/src/TransactionalEmails/Requests/GetAggregatedSmtpReportRequest.php index c7bf25f3..a45d0279 100644 --- a/src/TransactionalEmails/Requests/GetAggregatedSmtpReportRequest.php +++ b/src/TransactionalEmails/Requests/GetAggregatedSmtpReportRequest.php @@ -17,7 +17,7 @@ class GetAggregatedSmtpReportRequest extends JsonSerializableType public ?string $endDate; /** - * @var ?int $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + * @var ?int $days Number of days in the past including today (positive integer, maximum 90). _Not compatible with 'startDate' and 'endDate'_. Defaults to 90 if neither dates nor days are provided. */ public ?int $days; diff --git a/src/TransactionalEmails/Requests/GetEmailEventReportRequest.php b/src/TransactionalEmails/Requests/GetEmailEventReportRequest.php index 84ab2ae1..b5ab4a36 100644 --- a/src/TransactionalEmails/Requests/GetEmailEventReportRequest.php +++ b/src/TransactionalEmails/Requests/GetEmailEventReportRequest.php @@ -29,7 +29,7 @@ class GetEmailEventReportRequest extends JsonSerializableType public ?string $endDate; /** - * @var ?int $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + * @var ?int $days Number of days in the past including today (positive integer, maximum 90). _Not compatible with 'startDate' and 'endDate'_. Defaults to 30 if neither dates nor days are provided. */ public ?int $days; diff --git a/src/TransactionalEmails/Requests/GetScheduledEmailByIdRequest.php b/src/TransactionalEmails/Requests/GetScheduledEmailByIdRequest.php index 7385d2a0..58c80f99 100644 --- a/src/TransactionalEmails/Requests/GetScheduledEmailByIdRequest.php +++ b/src/TransactionalEmails/Requests/GetScheduledEmailByIdRequest.php @@ -10,7 +10,7 @@ class GetScheduledEmailByIdRequest extends JsonSerializableType { /** - * @var ?DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. + * @var ?DateTime $startDate Mandatory if `endDate` is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Cannot be more than 30 days older than the current date. */ public ?DateTime $startDate; diff --git a/src/TransactionalEmails/Requests/GetSmtpReportRequest.php b/src/TransactionalEmails/Requests/GetSmtpReportRequest.php index 80343168..aa4f64e7 100644 --- a/src/TransactionalEmails/Requests/GetSmtpReportRequest.php +++ b/src/TransactionalEmails/Requests/GetSmtpReportRequest.php @@ -28,7 +28,7 @@ class GetSmtpReportRequest extends JsonSerializableType public ?string $endDate; /** - * @var ?int $days Number of days in the past including today (positive integer). _Not compatible with 'startDate' and 'endDate'_ + * @var ?int $days Number of days in the past including today (positive integer, maximum 30). _Not compatible with 'startDate' and 'endDate'_ */ public ?int $days; diff --git a/src/TransactionalEmails/Requests/GetSmtpTemplatesRequest.php b/src/TransactionalEmails/Requests/GetSmtpTemplatesRequest.php index b108d8d2..6d32afee 100644 --- a/src/TransactionalEmails/Requests/GetSmtpTemplatesRequest.php +++ b/src/TransactionalEmails/Requests/GetSmtpTemplatesRequest.php @@ -27,12 +27,18 @@ class GetSmtpTemplatesRequest extends JsonSerializableType */ public ?string $sort; + /** + * @var ?'richTextEditor' $editorType Filter on the editor type used to create the template. Currently only `richTextEditor` is supported as a filter value. + */ + public ?string $editorType; + /** * @param array{ * templateStatus?: ?bool, * limit?: ?int, * offset?: ?int, * sort?: ?value-of, + * editorType?: ?'richTextEditor', * } $values */ public function __construct( @@ -42,5 +48,6 @@ public function __construct( $this->limit = $values['limit'] ?? null; $this->offset = $values['offset'] ?? null; $this->sort = $values['sort'] ?? null; + $this->editorType = $values['editorType'] ?? null; } } diff --git a/src/TransactionalEmails/TransactionalEmailsClient.php b/src/TransactionalEmails/TransactionalEmailsClient.php index 7d22012e..f7700d0b 100644 --- a/src/TransactionalEmails/TransactionalEmailsClient.php +++ b/src/TransactionalEmails/TransactionalEmailsClient.php @@ -27,6 +27,7 @@ use Brevo\TransactionalEmails\Requests\GetTransacEmailsListRequest; use Brevo\TransactionalEmails\Types\GetTransacEmailsListResponse; use Brevo\TransactionalEmails\Types\GetTransacEmailContentResponse; +use Brevo\TransactionalEmails\Requests\DeleteSmtpLogIdentifierRequest; use Brevo\TransactionalEmails\Requests\GetAggregatedSmtpReportRequest; use Brevo\TransactionalEmails\Types\GetAggregatedSmtpReportResponse; use Brevo\TransactionalEmails\Requests\GetEmailEventReportRequest; @@ -79,6 +80,8 @@ public function __construct( } /** + * Retrieve a paginated list of transactional contacts that have been blocked or unsubscribed, along with the reason for blocking (e.g. hard bounce, admin blocked, spam complaint, or unsubscription via email/API/Marketing Automation). Both `startDate` and `endDate` must be provided together when filtering by date range, and neither date can be in the future. Results default to 50 per page (max 100) and are sorted in descending order of record creation unless overridden with the `sort` parameter. + * * @param GetTransacBlockedContactsRequest $request * @param ?array{ * baseUrl?: string, @@ -145,6 +148,8 @@ public function getTransacBlockedContacts(GetTransacBlockedContactsRequest $requ } /** + * Unblock or resubscribe a transactional contact by removing their email address from the blacklist. The email address must be URL-encoded in the path parameter and must be a valid email format. If the contact is not found in the blocklist, a 404 error is returned. + * * @param string $email contact email (urlencoded) to unblock. * @param ?array{ * baseUrl?: string, @@ -356,6 +361,8 @@ public function deleteHardbounces(DeleteHardbouncesRequest $request = new Delete } /** + * Send a transactional email to one or more recipients, either using inline HTML content or a pre-built template via `templateId`. You can schedule emails for future delivery using `scheduledAt` (UTC, up to 5-minute delay), send multiple personalized versions with `messageVersions` (max 2000 total recipients, 99 per version), and attach files via URL or base64-encoded content. A `sender` and `subject` are required when no `templateId` is provided; when a `templateId` is used, the template''s sender and subject are applied unless overridden. + * * @param SendTransacEmailRequest $request * @param ?array{ * baseUrl?: string, @@ -405,7 +412,7 @@ public function sendTransacEmail(SendTransacEmailRequest $request = new SendTran /** * Delete scheduled batch of emails by batchId or single scheduled email by messageId * - * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. + * @param string $identifier The `batchId` of scheduled emails batch (must be a valid UUIDv4) or the `messageId` of scheduled email (enclosed in angle brackets with @ sign, e.g. `<...@domain>`). * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -446,7 +453,7 @@ public function deleteScheduledEmailById(string $identifier, ?array $options = n /** * Fetch scheduled batch of emails by batchId or single scheduled email by messageId (Can retrieve data upto 30 days old) * - * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. + * @param string $identifier The `batchId` of scheduled emails batch (must be a valid UUIDv4) or the `messageId` of scheduled email (enclosed in angle brackets with @ sign, e.g. `<...@domain>`). When using `messageId`, the `limit`, `offset`, `sort`, and `status` query parameters are ignored. * @param GetScheduledEmailByIdRequest $request * @param ?array{ * baseUrl?: string, @@ -640,7 +647,10 @@ public function getTransacEmailContent(string $uuid, ?array $options = null): ?G } /** - * @param string $identifier MessageId of the transactional log(s) to delete + * Delete SMTP transactional log entries identified by a message ID (enclosed in angle brackets with an @ sign) or a valid email address. Optionally narrow the deletion to a specific date range using `from_date` and `to_date` query parameters (YYYY-MM-DD format). The operation also removes any associated stored email preview content. + * + * @param string $identifier MessageId or email address of the transactional log(s) to delete. Must be a valid message ID (enclosed in angle brackets with @ sign) or a valid email address. + * @param DeleteSmtpLogIdentifierRequest $request * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -652,15 +662,23 @@ public function getTransacEmailContent(string $uuid, ?array $options = null): ?G * @throws BrevoException * @throws BrevoApiException */ - public function deleteAnSmtpTransactionalLog(string $identifier, ?array $options = null): void + public function deleteAnSmtpTransactionalLog(string $identifier, DeleteSmtpLogIdentifierRequest $request = new DeleteSmtpLogIdentifierRequest(), ?array $options = null): void { $options = array_merge($this->options, $options ?? []); + $query = []; + if ($request->fromDate != null) { + $query['from_date'] = $request->fromDate; + } + if ($request->toDate != null) { + $query['to_date'] = $request->toDate; + } try { $response = $this->client->sendRequest( new JsonApiRequest( baseUrl: $options['baseUrl'] ?? $this->client->options['baseUrl'] ?? Environments::Default_->value, path: "smtp/log/{$identifier}", method: HttpMethod::DELETE, + query: $query, ), $options, ); @@ -824,6 +842,8 @@ public function getEmailEventReport(GetEmailEventReportRequest $request = new Ge } /** + * This endpoint will show the aggregated stats per day for the past 10 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 30 days. + * * @param GetSmtpReportRequest $request * @param ?array{ * baseUrl?: string, @@ -893,7 +913,11 @@ public function getSmtpReport(GetSmtpReportRequest $request = new GetSmtpReportR } /** - * @param mixed $request + * Generate a fully rendered preview of a transactional email template by resolving dynamic variables. Provide either an `email` address (to populate variables from the contact''s attributes) or a `params` object with key-value pairs for manual substitution; at least one of these is required alongside the mandatory `templateId`. The response includes the rendered HTML, subject, sender details, preview text, and any feed names used in the template. + * + * @param ( + * mixed + * ) $request * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -940,6 +964,8 @@ public function postPreviewSmtpEmailTemplates(mixed $request, ?array $options = } /** + * Retrieve a paginated list of all transactional email templates (including automation templates) with their details such as name, subject, sender, status, HTML content, and timestamps. Results default to 50 per page (max 1000) and are sorted in descending creation order unless overridden. You can filter by active/inactive status using `templateStatus` and by editor type using `editorType` (currently only `richTextEditor` is supported). + * * @param GetSmtpTemplatesRequest $request * @param ?array{ * baseUrl?: string, @@ -969,6 +995,9 @@ public function getSmtpTemplates(GetSmtpTemplatesRequest $request = new GetSmtpT if ($request->sort != null) { $query['sort'] = $request->sort; } + if ($request->editorType != null) { + $query['editorType'] = $request->editorType; + } try { $response = $this->client->sendRequest( new JsonApiRequest( @@ -1000,6 +1029,8 @@ public function getSmtpTemplates(GetSmtpTemplatesRequest $request = new GetSmtpT } /** + * Create a new transactional email template with the specified sender, subject, and content. The `sender`, `subject`, and `templateName` fields are required. Template content can be provided via `htmlContent` (minimum 10 characters) or `htmlUrl`; at least one must be supplied. Templates are created as inactive by default unless `isActive` is explicitly set to `true`. + * * @param CreateSmtpTemplateRequest $request * @param ?array{ * baseUrl?: string, @@ -1047,7 +1078,12 @@ public function createSmtpTemplate(CreateSmtpTemplateRequest $request, ?array $o } /** - * @param int $templateId id of the template + * Retrieve the full details of a specific transactional email template by its numeric ID or custom template identifier string. The response includes the template name, subject, sender information, HTML content, active status, creation and modification timestamps, reply-to address, tag, and a `doiTemplate` flag indicating whether the template is a double opt-in template (detected by the presence of optin-related tags or variables in the content). + * + * @param ( + * int + * |string + * ) $templateId ID of the template. Can be a numeric template ID or a custom template identifier string (alphanumeric, hyphens, and underscores only, max 64 characters, must start with a letter). * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -1060,7 +1096,7 @@ public function createSmtpTemplate(CreateSmtpTemplateRequest $request, ?array $o * @throws BrevoException * @throws BrevoApiException */ - public function getSmtpTemplate(int $templateId, ?array $options = null): ?GetSmtpTemplateOverview + public function getSmtpTemplate(int|string $templateId, ?array $options = null): ?GetSmtpTemplateOverview { $options = array_merge($this->options, $options ?? []); try { @@ -1093,7 +1129,12 @@ public function getSmtpTemplate(int $templateId, ?array $options = null): ?GetSm } /** - * @param int $templateId id of the template + * Update an existing transactional email template by its numeric ID or custom template identifier string. All fields in the request body are optional; only the provided fields will be updated. You can update the template name, subject, sender, reply-to address, HTML content (via `htmlContent` or `htmlUrl`), active status, tag, attachment URL, and the personalized `toField`. Only one of sender email or sender ID should be provided per request. + * + * @param ( + * int + * |string + * ) $templateId ID of the template. Can be a numeric template ID or a custom template identifier string. * @param UpdateSmtpTemplateRequest $request * @param ?array{ * baseUrl?: string, @@ -1106,7 +1147,7 @@ public function getSmtpTemplate(int $templateId, ?array $options = null): ?GetSm * @throws BrevoException * @throws BrevoApiException */ - public function updateSmtpTemplate(int $templateId, UpdateSmtpTemplateRequest $request = new UpdateSmtpTemplateRequest(), ?array $options = null): void + public function updateSmtpTemplate(int|string $templateId, UpdateSmtpTemplateRequest $request = new UpdateSmtpTemplateRequest(), ?array $options = null): void { $options = array_merge($this->options, $options ?? []); try { @@ -1134,6 +1175,8 @@ public function updateSmtpTemplate(int $templateId, UpdateSmtpTemplateRequest $r } /** + * Permanently delete a transactional email template by its numeric ID. Only inactive templates can be deleted; attempting to delete an active template returns a 405 error. To deactivate a template before deletion, use `PUT /smtp/templates/{templateId}` with `isActive` set to `false`. Deletion also removes associated newsletter template data and triggers asynchronous cleanup of shared assets. + * * @param int $templateId id of the template * @param ?array{ * baseUrl?: string, @@ -1173,6 +1216,8 @@ public function deleteSmtpTemplate(int $templateId, ?array $options = null): voi } /** + * Send a test email of the specified transactional template to one or more recipients. Provide an array of email addresses in the `emailTo` field; if left empty, the test mail is sent to your entire test list. You can send a maximum of 50 test emails per day, and all provided email addresses must be valid. + * * @param int $templateId Id of the template * @param SendTestTemplateRequest $request * @param ?array{ diff --git a/src/TransactionalEmails/TransactionalEmailsClientInterface.php b/src/TransactionalEmails/TransactionalEmailsClientInterface.php index 30db1594..3147c57b 100644 --- a/src/TransactionalEmails/TransactionalEmailsClientInterface.php +++ b/src/TransactionalEmails/TransactionalEmailsClientInterface.php @@ -15,6 +15,7 @@ use Brevo\TransactionalEmails\Requests\GetTransacEmailsListRequest; use Brevo\TransactionalEmails\Types\GetTransacEmailsListResponse; use Brevo\TransactionalEmails\Types\GetTransacEmailContentResponse; +use Brevo\TransactionalEmails\Requests\DeleteSmtpLogIdentifierRequest; use Brevo\TransactionalEmails\Requests\GetAggregatedSmtpReportRequest; use Brevo\TransactionalEmails\Types\GetAggregatedSmtpReportResponse; use Brevo\TransactionalEmails\Requests\GetEmailEventReportRequest; @@ -33,6 +34,8 @@ interface TransactionalEmailsClientInterface { /** + * Retrieve a paginated list of transactional contacts that have been blocked or unsubscribed, along with the reason for blocking (e.g. hard bounce, admin blocked, spam complaint, or unsubscription via email/API/Marketing Automation). Both `startDate` and `endDate` must be provided together when filtering by date range, and neither date can be in the future. Results default to 50 per page (max 100) and are sorted in descending order of record creation unless overridden with the `sort` parameter. + * * @param GetTransacBlockedContactsRequest $request * @param ?array{ * baseUrl?: string, @@ -47,6 +50,8 @@ interface TransactionalEmailsClientInterface public function getTransacBlockedContacts(GetTransacBlockedContactsRequest $request = new GetTransacBlockedContactsRequest(), ?array $options = null): ?GetTransacBlockedContactsResponse; /** + * Unblock or resubscribe a transactional contact by removing their email address from the blacklist. The email address must be URL-encoded in the path parameter and must be a valid email format. If the contact is not found in the blocklist, a 404 error is returned. + * * @param string $email contact email (urlencoded) to unblock. * @param ?array{ * baseUrl?: string, @@ -120,6 +125,8 @@ public function deleteBlockedDomain(string $domain, ?array $options = null): voi public function deleteHardbounces(DeleteHardbouncesRequest $request = new DeleteHardbouncesRequest(), ?array $options = null): void; /** + * Send a transactional email to one or more recipients, either using inline HTML content or a pre-built template via `templateId`. You can schedule emails for future delivery using `scheduledAt` (UTC, up to 5-minute delay), send multiple personalized versions with `messageVersions` (max 2000 total recipients, 99 per version), and attach files via URL or base64-encoded content. A `sender` and `subject` are required when no `templateId` is provided; when a `templateId` is used, the template''s sender and subject are applied unless overridden. + * * @param SendTransacEmailRequest $request * @param ?array{ * baseUrl?: string, @@ -136,7 +143,7 @@ public function sendTransacEmail(SendTransacEmailRequest $request = new SendTran /** * Delete scheduled batch of emails by batchId or single scheduled email by messageId * - * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. + * @param string $identifier The `batchId` of scheduled emails batch (must be a valid UUIDv4) or the `messageId` of scheduled email (enclosed in angle brackets with @ sign, e.g. `<...@domain>`). * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -151,7 +158,7 @@ public function deleteScheduledEmailById(string $identifier, ?array $options = n /** * Fetch scheduled batch of emails by batchId or single scheduled email by messageId (Can retrieve data upto 30 days old) * - * @param string $identifier The `batchId` of scheduled emails batch (Should be a valid UUIDv4) or the `messageId` of scheduled email. + * @param string $identifier The `batchId` of scheduled emails batch (must be a valid UUIDv4) or the `messageId` of scheduled email (enclosed in angle brackets with @ sign, e.g. `<...@domain>`). When using `messageId`, the `limit`, `offset`, `sort`, and `status` query parameters are ignored. * @param GetScheduledEmailByIdRequest $request * @param ?array{ * baseUrl?: string, @@ -203,7 +210,10 @@ public function getTransacEmailsList(GetTransacEmailsListRequest $request = new public function getTransacEmailContent(string $uuid, ?array $options = null): ?GetTransacEmailContentResponse; /** - * @param string $identifier MessageId of the transactional log(s) to delete + * Delete SMTP transactional log entries identified by a message ID (enclosed in angle brackets with an @ sign) or a valid email address. Optionally narrow the deletion to a specific date range using `from_date` and `to_date` query parameters (YYYY-MM-DD format). The operation also removes any associated stored email preview content. + * + * @param string $identifier MessageId or email address of the transactional log(s) to delete. Must be a valid message ID (enclosed in angle brackets with @ sign) or a valid email address. + * @param DeleteSmtpLogIdentifierRequest $request * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -213,7 +223,7 @@ public function getTransacEmailContent(string $uuid, ?array $options = null): ?G * bodyProperties?: array, * } $options */ - public function deleteAnSmtpTransactionalLog(string $identifier, ?array $options = null): void; + public function deleteAnSmtpTransactionalLog(string $identifier, DeleteSmtpLogIdentifierRequest $request = new DeleteSmtpLogIdentifierRequest(), ?array $options = null): void; /** * This endpoint will show the aggregated stats for past 90 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 90 days @@ -248,6 +258,8 @@ public function getAggregatedSmtpReport(GetAggregatedSmtpReportRequest $request public function getEmailEventReport(GetEmailEventReportRequest $request = new GetEmailEventReportRequest(), ?array $options = null): ?GetEmailEventReportResponse; /** + * This endpoint will show the aggregated stats per day for the past 10 days by default if `startDate` and `endDate` OR `days` is not passed. The date range can not exceed 30 days. + * * @param GetSmtpReportRequest $request * @param ?array{ * baseUrl?: string, @@ -262,7 +274,11 @@ public function getEmailEventReport(GetEmailEventReportRequest $request = new Ge public function getSmtpReport(GetSmtpReportRequest $request = new GetSmtpReportRequest(), ?array $options = null): ?GetSmtpReportResponse; /** - * @param mixed $request + * Generate a fully rendered preview of a transactional email template by resolving dynamic variables. Provide either an `email` address (to populate variables from the contact''s attributes) or a `params` object with key-value pairs for manual substitution; at least one of these is required alongside the mandatory `templateId`. The response includes the rendered HTML, subject, sender details, preview text, and any feed names used in the template. + * + * @param ( + * mixed + * ) $request * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -276,6 +292,8 @@ public function getSmtpReport(GetSmtpReportRequest $request = new GetSmtpReportR public function postPreviewSmtpEmailTemplates(mixed $request, ?array $options = null): ?PostPreviewSmtpEmailTemplatesResponse; /** + * Retrieve a paginated list of all transactional email templates (including automation templates) with their details such as name, subject, sender, status, HTML content, and timestamps. Results default to 50 per page (max 1000) and are sorted in descending creation order unless overridden. You can filter by active/inactive status using `templateStatus` and by editor type using `editorType` (currently only `richTextEditor` is supported). + * * @param GetSmtpTemplatesRequest $request * @param ?array{ * baseUrl?: string, @@ -290,6 +308,8 @@ public function postPreviewSmtpEmailTemplates(mixed $request, ?array $options = public function getSmtpTemplates(GetSmtpTemplatesRequest $request = new GetSmtpTemplatesRequest(), ?array $options = null): ?GetSmtpTemplatesResponse; /** + * Create a new transactional email template with the specified sender, subject, and content. The `sender`, `subject`, and `templateName` fields are required. Template content can be provided via `htmlContent` (minimum 10 characters) or `htmlUrl`; at least one must be supplied. Templates are created as inactive by default unless `isActive` is explicitly set to `true`. + * * @param CreateSmtpTemplateRequest $request * @param ?array{ * baseUrl?: string, @@ -304,7 +324,12 @@ public function getSmtpTemplates(GetSmtpTemplatesRequest $request = new GetSmtpT public function createSmtpTemplate(CreateSmtpTemplateRequest $request, ?array $options = null): ?CreateSmtpTemplateResponse; /** - * @param int $templateId id of the template + * Retrieve the full details of a specific transactional email template by its numeric ID or custom template identifier string. The response includes the template name, subject, sender information, HTML content, active status, creation and modification timestamps, reply-to address, tag, and a `doiTemplate` flag indicating whether the template is a double opt-in template (detected by the presence of optin-related tags or variables in the content). + * + * @param ( + * int + * |string + * ) $templateId ID of the template. Can be a numeric template ID or a custom template identifier string (alphanumeric, hyphens, and underscores only, max 64 characters, must start with a letter). * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -315,10 +340,15 @@ public function createSmtpTemplate(CreateSmtpTemplateRequest $request, ?array $o * } $options * @return ?GetSmtpTemplateOverview */ - public function getSmtpTemplate(int $templateId, ?array $options = null): ?GetSmtpTemplateOverview; + public function getSmtpTemplate(int|string $templateId, ?array $options = null): ?GetSmtpTemplateOverview; /** - * @param int $templateId id of the template + * Update an existing transactional email template by its numeric ID or custom template identifier string. All fields in the request body are optional; only the provided fields will be updated. You can update the template name, subject, sender, reply-to address, HTML content (via `htmlContent` or `htmlUrl`), active status, tag, attachment URL, and the personalized `toField`. Only one of sender email or sender ID should be provided per request. + * + * @param ( + * int + * |string + * ) $templateId ID of the template. Can be a numeric template ID or a custom template identifier string. * @param UpdateSmtpTemplateRequest $request * @param ?array{ * baseUrl?: string, @@ -329,9 +359,11 @@ public function getSmtpTemplate(int $templateId, ?array $options = null): ?GetSm * bodyProperties?: array, * } $options */ - public function updateSmtpTemplate(int $templateId, UpdateSmtpTemplateRequest $request = new UpdateSmtpTemplateRequest(), ?array $options = null): void; + public function updateSmtpTemplate(int|string $templateId, UpdateSmtpTemplateRequest $request = new UpdateSmtpTemplateRequest(), ?array $options = null): void; /** + * Permanently delete a transactional email template by its numeric ID. Only inactive templates can be deleted; attempting to delete an active template returns a 405 error. To deactivate a template before deletion, use `PUT /smtp/templates/{templateId}` with `isActive` set to `false`. Deletion also removes associated newsletter template data and triggers asynchronous cleanup of shared assets. + * * @param int $templateId id of the template * @param ?array{ * baseUrl?: string, @@ -345,6 +377,8 @@ public function updateSmtpTemplate(int $templateId, UpdateSmtpTemplateRequest $r public function deleteSmtpTemplate(int $templateId, ?array $options = null): void; /** + * Send a test email of the specified transactional template to one or more recipients. Provide an array of email addresses in the `emailTo` field; if left empty, the test mail is sent to your entire test list. You can send a maximum of 50 test emails per day, and all provided email addresses must be valid. + * * @param int $templateId Id of the template * @param SendTestTemplateRequest $request * @param ?array{ diff --git a/src/TransactionalEmails/Types/GetTransacEmailContentResponse.php b/src/TransactionalEmails/Types/GetTransacEmailContentResponse.php index 71b2d07b..7d00d7e3 100644 --- a/src/TransactionalEmails/Types/GetTransacEmailContentResponse.php +++ b/src/TransactionalEmails/Types/GetTransacEmailContentResponse.php @@ -9,16 +9,16 @@ class GetTransacEmailContentResponse extends JsonSerializableType { /** - * @var int $attachmentCount Count of the attachments that were sent in the email + * @var ?int $attachmentCount Count of the attachments that were sent in the email */ #[JsonProperty('attachmentCount')] - public int $attachmentCount; + public ?int $attachmentCount; /** - * @var string $body Actual content of the transactional email that has been sent + * @var ?string $body Actual content of the transactional email that has been sent */ #[JsonProperty('body')] - public string $body; + public ?string $body; /** * @var string $date Date on which transactional email was sent @@ -52,20 +52,20 @@ class GetTransacEmailContentResponse extends JsonSerializableType /** * @param array{ - * attachmentCount: int, - * body: string, * date: string, * email: string, * events: array, * subject: string, + * attachmentCount?: ?int, + * body?: ?string, * templateId?: ?int, * } $values */ public function __construct( array $values, ) { - $this->attachmentCount = $values['attachmentCount']; - $this->body = $values['body']; + $this->attachmentCount = $values['attachmentCount'] ?? null; + $this->body = $values['body'] ?? null; $this->date = $values['date']; $this->email = $values['email']; $this->events = $values['events']; diff --git a/src/TransactionalEmails/Types/PostPreviewSmtpEmailTemplatesRequestParams.php b/src/TransactionalEmails/Types/PostPreviewSmtpEmailTemplatesRequestParams.php new file mode 100644 index 00000000..d7f42ad7 --- /dev/null +++ b/src/TransactionalEmails/Types/PostPreviewSmtpEmailTemplatesRequestParams.php @@ -0,0 +1,45 @@ +firstname = $values['firstname'] ?? null; + $this->lastname = $values['lastname'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/TransactionalSms/TransactionalSmsClient.php b/src/TransactionalSms/TransactionalSmsClient.php index 06058c1f..62078b90 100644 --- a/src/TransactionalSms/TransactionalSmsClient.php +++ b/src/TransactionalSms/TransactionalSmsClient.php @@ -109,6 +109,8 @@ public function sendAsyncTransactionalSms(SendTransacSms $request, ?array $optio } /** + * Send a transactional SMS message to a single mobile number. The `sender`, `recipient`, and either `content` or `templateId` fields are required. The sender name is limited to 11 alphanumeric characters or 15 numeric characters, and the recipient must be a valid international phone number (6-15 digits, optional leading +). Tags can be a string or an array of up to 10 strings. The SMS type defaults to `transactional` but can be set to `marketing`; if the content includes a stop code, it is automatically treated as marketing. Returns the message ID, SMS count, credits used, and remaining credits. + * * @param SendTransacSms $request * @param ?array{ * baseUrl?: string, @@ -156,6 +158,8 @@ public function sendTransacSms(SendTransacSms $request, ?array $options = null): } /** + * Retrieve an aggregated report of your transactional SMS activity over a specified time period, including counts for requests, delivered, hard bounces, soft bounces, blocked, unsubscribed, replied, accepted, rejected, and skipped messages. Filter by date range using `startDate` and `endDate` (both required together, YYYY-MM-DD format) or by a number of past `days` (not compatible with date range). You can further narrow results by `tag`. If no date filter is provided, the report covers all available data and returns the auto-detected date range. + * * @param GetTransacAggregatedSmsReportRequest $request * @param ?array{ * baseUrl?: string, @@ -216,6 +220,8 @@ public function getTransacAggregatedSmsReport(GetTransacAggregatedSmsReportReque } /** + * Retrieve a paginated list of individual SMS event records (unaggregated), including event type, phone number, message ID, timestamp, tag, and reason or reply content where applicable. Results default to 50 per page (max 100) and are sorted in descending order unless overridden. Filter by date range (`startDate`/`endDate`), past `days` (not compatible with date range), specific `event` type (e.g. delivered, bounces, replies), `phoneNumber`, or `tags`. Bounce events include the failure reason, and reply events include the reply content. + * * @param GetSmsEventsRequest $request * @param ?array{ * baseUrl?: string, @@ -291,6 +297,8 @@ public function getSmsEvents(GetSmsEventsRequest $request = new GetSmsEventsRequ } /** + * Retrieve a day-by-day breakdown of your transactional SMS activity, with each entry containing the date and counts for requests, delivered, hard bounces, soft bounces, blocked, unsubscribed, replied, accepted, rejected, and skipped messages. Filter by date range using `startDate` and `endDate` (both required together, YYYY-MM-DD format), by a number of past `days` (not compatible with date range), or by `tag`. Results are sorted in descending order by default unless overridden with the `sort` parameter. + * * @param GetTransacSmsReportRequest $request * @param ?array{ * baseUrl?: string, diff --git a/src/TransactionalSms/TransactionalSmsClientInterface.php b/src/TransactionalSms/TransactionalSmsClientInterface.php index 776913ab..ab70b033 100644 --- a/src/TransactionalSms/TransactionalSmsClientInterface.php +++ b/src/TransactionalSms/TransactionalSmsClientInterface.php @@ -33,6 +33,8 @@ interface TransactionalSmsClientInterface public function sendAsyncTransactionalSms(SendTransacSms $request, ?array $options = null): ?SendAsyncTransactionalSmsResponse; /** + * Send a transactional SMS message to a single mobile number. The `sender`, `recipient`, and either `content` or `templateId` fields are required. The sender name is limited to 11 alphanumeric characters or 15 numeric characters, and the recipient must be a valid international phone number (6-15 digits, optional leading +). Tags can be a string or an array of up to 10 strings. The SMS type defaults to `transactional` but can be set to `marketing`; if the content includes a stop code, it is automatically treated as marketing. Returns the message ID, SMS count, credits used, and remaining credits. + * * @param SendTransacSms $request * @param ?array{ * baseUrl?: string, @@ -47,6 +49,8 @@ public function sendAsyncTransactionalSms(SendTransacSms $request, ?array $optio public function sendTransacSms(SendTransacSms $request, ?array $options = null): ?SendTransacSmsResponse; /** + * Retrieve an aggregated report of your transactional SMS activity over a specified time period, including counts for requests, delivered, hard bounces, soft bounces, blocked, unsubscribed, replied, accepted, rejected, and skipped messages. Filter by date range using `startDate` and `endDate` (both required together, YYYY-MM-DD format) or by a number of past `days` (not compatible with date range). You can further narrow results by `tag`. If no date filter is provided, the report covers all available data and returns the auto-detected date range. + * * @param GetTransacAggregatedSmsReportRequest $request * @param ?array{ * baseUrl?: string, @@ -61,6 +65,8 @@ public function sendTransacSms(SendTransacSms $request, ?array $options = null): public function getTransacAggregatedSmsReport(GetTransacAggregatedSmsReportRequest $request = new GetTransacAggregatedSmsReportRequest(), ?array $options = null): ?GetTransacAggregatedSmsReportResponse; /** + * Retrieve a paginated list of individual SMS event records (unaggregated), including event type, phone number, message ID, timestamp, tag, and reason or reply content where applicable. Results default to 50 per page (max 100) and are sorted in descending order unless overridden. Filter by date range (`startDate`/`endDate`), past `days` (not compatible with date range), specific `event` type (e.g. delivered, bounces, replies), `phoneNumber`, or `tags`. Bounce events include the failure reason, and reply events include the reply content. + * * @param GetSmsEventsRequest $request * @param ?array{ * baseUrl?: string, @@ -75,6 +81,8 @@ public function getTransacAggregatedSmsReport(GetTransacAggregatedSmsReportReque public function getSmsEvents(GetSmsEventsRequest $request = new GetSmsEventsRequest(), ?array $options = null): ?GetSmsEventsResponse; /** + * Retrieve a day-by-day breakdown of your transactional SMS activity, with each entry containing the date and counts for requests, delivered, hard bounces, soft bounces, blocked, unsubscribed, replied, accepted, rejected, and skipped messages. Filter by date range using `startDate` and `endDate` (both required together, YYYY-MM-DD format), by a number of past `days` (not compatible with date range), or by `tag`. Results are sorted in descending order by default unless overridden with the `sort` parameter. + * * @param GetTransacSmsReportRequest $request * @param ?array{ * baseUrl?: string, diff --git a/src/Types/BalanceDefinition.php b/src/Types/BalanceDefinition.php index 90399ccf..7ac5d313 100644 --- a/src/Types/BalanceDefinition.php +++ b/src/Types/BalanceDefinition.php @@ -4,179 +4,179 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; +use Brevo\Core\Types\ArrayType; use DateTime; use Brevo\Core\Types\Date; -use Brevo\Core\Types\ArrayType; class BalanceDefinition extends JsonSerializableType { /** - * @var ?value-of $balanceAvailabilityDurationModifier startOfPeriod depicts the balancy expiry on start of day/week/month/year. endOfPeriod depicts the balancy expiry on end of day/week/month/year + * @var ?string $id Unique identifier for the balance definition. */ - #[JsonProperty('balanceAvailabilityDurationModifier')] - public ?string $balanceAvailabilityDurationModifier; + #[JsonProperty('id')] + public ?string $id; /** - * @var ?string $balanceAvailabilityDurationUnit Unit of time for the balance's availability (e.g., day/week/month/year). + * @var ?string $name Name of the balance definition. */ - #[JsonProperty('balanceAvailabilityDurationUnit')] - public ?string $balanceAvailabilityDurationUnit; + #[JsonProperty('name')] + public ?string $name; /** - * @var ?int $balanceAvailabilityDurationValue Number of days/weeks/month/year for balance expiry + * @var ?string $description Short description of the balance definition. */ - #[JsonProperty('balanceAvailabilityDurationValue')] - public ?int $balanceAvailabilityDurationValue; + #[JsonProperty('description')] + public ?string $description; /** - * @var ?DateTime $balanceExpirationDate Date when the balance expires and can no longer be used, in dd/mm format. The balance will be expired when this date appears next in the calendar and only one of balanceExpirationDate or balance availability fields can be used. + * @var ?string $imageRef Optional image reference URL. */ - #[JsonProperty('balanceExpirationDate'), Date(Date::TYPE_DATETIME)] - public ?DateTime $balanceExpirationDate; + #[JsonProperty('imageRef')] + public ?string $imageRef; /** - * @var ?string $balanceOptionAmountOvertakingStrategy Partial enables partial credit of balance if maximum balance limit is reaching. Strict enables rejection of transaction if it will breach the max credit amount limit. + * @var ?array $meta Additional metadata for the balance definition. */ - #[JsonProperty('balanceOptionAmountOvertakingStrategy')] - public ?string $balanceOptionAmountOvertakingStrategy; + #[JsonProperty('meta'), ArrayType(['string' => 'mixed'])] + public ?array $meta; /** - * @var ?string $balanceOptionCreditRounding Rounding strategy for credit transactions. + * @var ?value-of $unit Unit of balance measurement. */ - #[JsonProperty('balanceOptionCreditRounding')] - public ?string $balanceOptionCreditRounding; + #[JsonProperty('unit')] + public ?string $unit; /** - * @var ?string $balanceOptionDebitRounding Rounding strategy for debit transactions. + * @var ?float $minAmount Minimum allowable balance. */ - #[JsonProperty('balanceOptionDebitRounding')] - public ?string $balanceOptionDebitRounding; + #[JsonProperty('minAmount')] + public ?float $minAmount; /** - * @var ?DateTime $createdAt Timestamp of balance definition creation. + * @var ?float $maxAmount Maximum allowable balance. */ - #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] - public ?DateTime $createdAt; + #[JsonProperty('maxAmount')] + public ?float $maxAmount; /** - * @var ?string $deletedAt Timestamp of balance definition deletion (nullable). + * @var ?float $maxCreditAmountLimit Maximum credit allowed per operation. */ - #[JsonProperty('deletedAt')] - public ?string $deletedAt; + #[JsonProperty('maxCreditAmountLimit')] + public ?float $maxCreditAmountLimit; /** - * @var ?string $description Short description of the balance definition. + * @var ?float $maxDebitAmountLimit Maximum debit allowed per operation. */ - #[JsonProperty('description')] - public ?string $description; + #[JsonProperty('maxDebitAmountLimit')] + public ?float $maxDebitAmountLimit; /** - * @var ?string $id Unique identifier for the balance definition. + * @var ?value-of $balanceOptionAmountOvertakingStrategy Partial enables partial credit of balance if maximum balance limit is reached. Strict enables rejection of a transaction if it will breach the max balance limit. */ - #[JsonProperty('id')] - public ?string $id; + #[JsonProperty('balanceOptionAmountOvertakingStrategy')] + public ?string $balanceOptionAmountOvertakingStrategy; /** - * @var ?string $imageRef Optional image reference URL. + * @var ?value-of $balanceOptionCreditRounding Rounding strategy for credit transactions. */ - #[JsonProperty('imageRef')] - public ?string $imageRef; + #[JsonProperty('balanceOptionCreditRounding')] + public ?string $balanceOptionCreditRounding; /** - * @var ?float $maxAmount Maximum allowable balance. + * @var ?value-of $balanceOptionDebitRounding Rounding strategy for debit transactions. */ - #[JsonProperty('maxAmount')] - public ?float $maxAmount; + #[JsonProperty('balanceOptionDebitRounding')] + public ?string $balanceOptionDebitRounding; /** - * @var ?float $maxCreditAmountLimit Max credit allowed per operation. + * @var ?int $balanceAvailabilityDurationValue Number of time units before the balance expires. */ - #[JsonProperty('maxCreditAmountLimit')] - public ?float $maxCreditAmountLimit; + #[JsonProperty('balanceAvailabilityDurationValue')] + public ?int $balanceAvailabilityDurationValue; /** - * @var ?float $maxDebitAmountLimit Max debit allowed per operation. + * @var ?value-of $balanceAvailabilityDurationUnit Unit of time for the balance availability duration. */ - #[JsonProperty('maxDebitAmountLimit')] - public ?float $maxDebitAmountLimit; + #[JsonProperty('balanceAvailabilityDurationUnit')] + public ?string $balanceAvailabilityDurationUnit; /** - * @var ?array $meta Additional metadata for the balance definition. + * @var ?value-of $balanceAvailabilityDurationModifier Modifier for balance availability duration. startOfPeriod causes expiry at the start of the period, endOfPeriod at the end. noModification uses the exact duration from the credit date. */ - #[JsonProperty('meta'), ArrayType(['string' => 'mixed'])] - public ?array $meta; + #[JsonProperty('balanceAvailabilityDurationModifier')] + public ?string $balanceAvailabilityDurationModifier; /** - * @var ?float $minAmount Minimum allowable balance. + * @var ?string $balanceExpirationDate Fixed expiration date in dd/mm format. The balance expires when this date next appears in the calendar. Only one of balanceExpirationDate or balance availability duration fields can be used. */ - #[JsonProperty('minAmount')] - public ?float $minAmount; + #[JsonProperty('balanceExpirationDate')] + public ?string $balanceExpirationDate; /** - * @var ?string $name Name of the balance definition. + * @var ?DateTime $createdAt Timestamp of balance definition creation. */ - #[JsonProperty('name')] - public ?string $name; + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; /** - * @var ?string $unit Unit of balance (e.g., points, currency). + * @var ?DateTime $updatedAt Timestamp of the last update. */ - #[JsonProperty('unit')] - public ?string $unit; + #[JsonProperty('updatedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $updatedAt; /** - * @var ?string $updatedAt Timestamp of the last update. + * @var ?DateTime $deletedAt Timestamp of balance definition deletion (nullable). */ - #[JsonProperty('updatedAt')] - public ?string $updatedAt; + #[JsonProperty('deletedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $deletedAt; /** * @param array{ - * balanceAvailabilityDurationModifier?: ?value-of, - * balanceAvailabilityDurationUnit?: ?string, - * balanceAvailabilityDurationValue?: ?int, - * balanceExpirationDate?: ?DateTime, - * balanceOptionAmountOvertakingStrategy?: ?string, - * balanceOptionCreditRounding?: ?string, - * balanceOptionDebitRounding?: ?string, - * createdAt?: ?DateTime, - * deletedAt?: ?string, - * description?: ?string, * id?: ?string, + * name?: ?string, + * description?: ?string, * imageRef?: ?string, + * meta?: ?array, + * unit?: ?value-of, + * minAmount?: ?float, * maxAmount?: ?float, * maxCreditAmountLimit?: ?float, * maxDebitAmountLimit?: ?float, - * meta?: ?array, - * minAmount?: ?float, - * name?: ?string, - * unit?: ?string, - * updatedAt?: ?string, + * balanceOptionAmountOvertakingStrategy?: ?value-of, + * balanceOptionCreditRounding?: ?value-of, + * balanceOptionDebitRounding?: ?value-of, + * balanceAvailabilityDurationValue?: ?int, + * balanceAvailabilityDurationUnit?: ?value-of, + * balanceAvailabilityDurationModifier?: ?value-of, + * balanceExpirationDate?: ?string, + * createdAt?: ?DateTime, + * updatedAt?: ?DateTime, + * deletedAt?: ?DateTime, * } $values */ public function __construct( array $values = [], ) { - $this->balanceAvailabilityDurationModifier = $values['balanceAvailabilityDurationModifier'] ?? null; - $this->balanceAvailabilityDurationUnit = $values['balanceAvailabilityDurationUnit'] ?? null; - $this->balanceAvailabilityDurationValue = $values['balanceAvailabilityDurationValue'] ?? null; - $this->balanceExpirationDate = $values['balanceExpirationDate'] ?? null; - $this->balanceOptionAmountOvertakingStrategy = $values['balanceOptionAmountOvertakingStrategy'] ?? null; - $this->balanceOptionCreditRounding = $values['balanceOptionCreditRounding'] ?? null; - $this->balanceOptionDebitRounding = $values['balanceOptionDebitRounding'] ?? null; - $this->createdAt = $values['createdAt'] ?? null; - $this->deletedAt = $values['deletedAt'] ?? null; - $this->description = $values['description'] ?? null; $this->id = $values['id'] ?? null; + $this->name = $values['name'] ?? null; + $this->description = $values['description'] ?? null; $this->imageRef = $values['imageRef'] ?? null; + $this->meta = $values['meta'] ?? null; + $this->unit = $values['unit'] ?? null; + $this->minAmount = $values['minAmount'] ?? null; $this->maxAmount = $values['maxAmount'] ?? null; $this->maxCreditAmountLimit = $values['maxCreditAmountLimit'] ?? null; $this->maxDebitAmountLimit = $values['maxDebitAmountLimit'] ?? null; - $this->meta = $values['meta'] ?? null; - $this->minAmount = $values['minAmount'] ?? null; - $this->name = $values['name'] ?? null; - $this->unit = $values['unit'] ?? null; + $this->balanceOptionAmountOvertakingStrategy = $values['balanceOptionAmountOvertakingStrategy'] ?? null; + $this->balanceOptionCreditRounding = $values['balanceOptionCreditRounding'] ?? null; + $this->balanceOptionDebitRounding = $values['balanceOptionDebitRounding'] ?? null; + $this->balanceAvailabilityDurationValue = $values['balanceAvailabilityDurationValue'] ?? null; + $this->balanceAvailabilityDurationUnit = $values['balanceAvailabilityDurationUnit'] ?? null; + $this->balanceAvailabilityDurationModifier = $values['balanceAvailabilityDurationModifier'] ?? null; + $this->balanceExpirationDate = $values['balanceExpirationDate'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; + $this->deletedAt = $values['deletedAt'] ?? null; } /** diff --git a/src/Types/BalanceDefinitionBalanceAvailabilityDurationModifier.php b/src/Types/BalanceDefinitionBalanceAvailabilityDurationModifier.php index e0a813c6..d5691e66 100644 --- a/src/Types/BalanceDefinitionBalanceAvailabilityDurationModifier.php +++ b/src/Types/BalanceDefinitionBalanceAvailabilityDurationModifier.php @@ -4,7 +4,7 @@ enum BalanceDefinitionBalanceAvailabilityDurationModifier: string { + case NoModification = "noModification"; case StartOfPeriod = "startOfPeriod"; case EndOfPeriod = "endOfPeriod"; - case NoModification = "noModification"; } diff --git a/src/Types/BalanceDefinitionBalanceAvailabilityDurationUnit.php b/src/Types/BalanceDefinitionBalanceAvailabilityDurationUnit.php new file mode 100644 index 00000000..941fd355 --- /dev/null +++ b/src/Types/BalanceDefinitionBalanceAvailabilityDurationUnit.php @@ -0,0 +1,11 @@ + $transactionType Specifies whether the limit applies to credit or debit transactions. */ - #[JsonProperty('createdAt')] - public string $createdAt; + #[JsonProperty('transactionType')] + public ?string $transactionType; /** - * @var ?string $durationUnit Time unit for the balance limit (day, week, month, year). + * @var ?value-of $constraintType Defines the type of constraint (transaction count or amount). */ - #[JsonProperty('durationUnit')] - public ?string $durationUnit; + #[JsonProperty('constraintType')] + public ?string $constraintType; /** * @var ?int $durationValue Number of time units the balance limit applies to. @@ -38,62 +40,62 @@ class BalanceLimit extends JsonSerializableType public ?int $durationValue; /** - * @var ?string $id Unique identifier for the balance limit. + * @var ?value-of $durationUnit Time unit for the balance limit. */ - #[JsonProperty('id')] - public ?string $id; + #[JsonProperty('durationUnit')] + public ?string $durationUnit; /** - * @var ?bool $slidingSchedule Indicates if the limit resets periodically based on a sliding schedule. + * @var ?float $value The maximum allowed value for the defined constraint. */ - #[JsonProperty('slidingSchedule')] - public ?bool $slidingSchedule; + #[JsonProperty('value')] + public ?float $value; /** - * @var ?string $transactionType Specifies whether the limit applies to credit or debit transactions. + * @var ?bool $slidingSchedule Indicates if the limit resets periodically based on a sliding schedule. */ - #[JsonProperty('transactionType')] - public ?string $transactionType; + #[JsonProperty('slidingSchedule')] + public ?bool $slidingSchedule; /** - * @var string $updatedAt Timestamp of the last update to the balance limit. + * @var ?DateTime $createdAt Timestamp of when the balance limit was created. */ - #[JsonProperty('updatedAt')] - public string $updatedAt; + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; /** - * @var ?int $value The maximum allowed value for the defined constraint. + * @var ?DateTime $updatedAt Timestamp of the last update to the balance limit. */ - #[JsonProperty('value')] - public ?int $value; + #[JsonProperty('updatedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $updatedAt; /** * @param array{ - * createdAt: string, - * updatedAt: string, + * id?: ?string, * balanceDefinitionId?: ?string, - * constraintType?: ?string, - * durationUnit?: ?string, + * transactionType?: ?value-of, + * constraintType?: ?value-of, * durationValue?: ?int, - * id?: ?string, + * durationUnit?: ?value-of, + * value?: ?float, * slidingSchedule?: ?bool, - * transactionType?: ?string, - * value?: ?int, + * createdAt?: ?DateTime, + * updatedAt?: ?DateTime, * } $values */ public function __construct( - array $values, + array $values = [], ) { + $this->id = $values['id'] ?? null; $this->balanceDefinitionId = $values['balanceDefinitionId'] ?? null; + $this->transactionType = $values['transactionType'] ?? null; $this->constraintType = $values['constraintType'] ?? null; - $this->createdAt = $values['createdAt']; - $this->durationUnit = $values['durationUnit'] ?? null; $this->durationValue = $values['durationValue'] ?? null; - $this->id = $values['id'] ?? null; - $this->slidingSchedule = $values['slidingSchedule'] ?? null; - $this->transactionType = $values['transactionType'] ?? null; - $this->updatedAt = $values['updatedAt']; + $this->durationUnit = $values['durationUnit'] ?? null; $this->value = $values['value'] ?? null; + $this->slidingSchedule = $values['slidingSchedule'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; + $this->updatedAt = $values['updatedAt'] ?? null; } /** diff --git a/src/Types/BalanceLimitConstraintType.php b/src/Types/BalanceLimitConstraintType.php new file mode 100644 index 00000000..42619438 --- /dev/null +++ b/src/Types/BalanceLimitConstraintType.php @@ -0,0 +1,9 @@ + $linkedDealsIds Deals ids for companies linked to this company + * @var ?array $linkedDealsIds Deal ids for deals linked to this company */ #[JsonProperty('linkedDealsIds'), ArrayType(['string'])] public ?array $linkedDealsIds; diff --git a/src/Types/ConversationsMessage.php b/src/Types/ConversationsMessage.php index 99411766..f42954ef 100644 --- a/src/Types/ConversationsMessage.php +++ b/src/Types/ConversationsMessage.php @@ -167,6 +167,30 @@ class ConversationsMessage extends JsonSerializableType #[JsonProperty('type')] public ?string $type; + /** + * @var ?bool $isSentViaJsApi β€˜`true` if the message was sent via JavaScript API.’ + */ + #[JsonProperty('isSentViaJsApi')] + public ?bool $isSentViaJsApi; + + /** + * @var ?string $messageType The type of message content (e.g. for integration-specific message types). + */ + #[JsonProperty('messageType')] + public ?string $messageType; + + /** + * @var ?bool $isForward β€˜`true` if the message is a forwarded message.’ + */ + #[JsonProperty('isForward')] + public ?bool $isForward; + + /** + * @var ?array $source Source information for the message. + */ + #[JsonProperty('source'), ArrayType(['string' => 'mixed'])] + public ?array $source; + /** * @var ?string $visitorId visitor’s ID */ @@ -201,6 +225,10 @@ class ConversationsMessage extends JsonSerializableType * text?: ?string, * to?: ?array, * type?: ?value-of, + * isSentViaJsApi?: ?bool, + * messageType?: ?string, + * isForward?: ?bool, + * source?: ?array, * visitorId?: ?string, * } $values */ @@ -233,6 +261,10 @@ public function __construct( $this->text = $values['text'] ?? null; $this->to = $values['to'] ?? null; $this->type = $values['type'] ?? null; + $this->isSentViaJsApi = $values['isSentViaJsApi'] ?? null; + $this->messageType = $values['messageType'] ?? null; + $this->isForward = $values['isForward'] ?? null; + $this->source = $values['source'] ?? null; $this->visitorId = $values['visitorId'] ?? null; } diff --git a/src/Types/ConversationsMessageAttachmentsItem.php b/src/Types/ConversationsMessageAttachmentsItem.php index 07bb643f..85885d0e 100644 --- a/src/Types/ConversationsMessageAttachmentsItem.php +++ b/src/Types/ConversationsMessageAttachmentsItem.php @@ -8,16 +8,22 @@ class ConversationsMessageAttachmentsItem extends JsonSerializableType { /** - * @var ?string $fileName The name of the file. + * @var ?string $name The name of the file. */ - #[JsonProperty('fileName')] - public ?string $fileName; + #[JsonProperty('name')] + public ?string $name; /** - * @var ?string $inlineId The ID of the inline file. + * @var ?string $link The URL of the file. */ - #[JsonProperty('inlineId')] - public ?string $inlineId; + #[JsonProperty('link')] + public ?string $link; + + /** + * @var ?string $mimeType The MIME type of the file. + */ + #[JsonProperty('mimeType')] + public ?string $mimeType; /** * @var ?bool $isImage `true` for images. @@ -26,10 +32,22 @@ class ConversationsMessageAttachmentsItem extends JsonSerializableType public ?bool $isImage; /** - * @var ?string $isInline `true` for inline files. + * @var ?bool $isSticker `true` for sticker files. + */ + #[JsonProperty('isSticker')] + public ?bool $isSticker; + + /** + * @var ?bool $isInline `true` for inline files. */ #[JsonProperty('isInline')] - public ?string $isInline; + public ?bool $isInline; + + /** + * @var ?string $inlineId The ID of the inline file. + */ + #[JsonProperty('inlineId')] + public ?string $inlineId; /** * @var ?int $size The size of the file in bytes. @@ -38,30 +56,44 @@ class ConversationsMessageAttachmentsItem extends JsonSerializableType public ?int $size; /** - * @var ?string $url The URL of the file. + * @var ?ConversationsMessageAttachmentsItemImageInfo $imageInfo Image information (only present for image files). */ - #[JsonProperty('url')] - public ?string $url; + #[JsonProperty('imageInfo')] + public ?ConversationsMessageAttachmentsItemImageInfo $imageInfo; + + /** + * @var ?bool $isAllowedFileType Whether the file extension is allowed for download. + */ + #[JsonProperty('isAllowedFileType')] + public ?bool $isAllowedFileType; /** * @param array{ - * fileName?: ?string, - * inlineId?: ?string, + * name?: ?string, + * link?: ?string, + * mimeType?: ?string, * isImage?: ?bool, - * isInline?: ?string, + * isSticker?: ?bool, + * isInline?: ?bool, + * inlineId?: ?string, * size?: ?int, - * url?: ?string, + * imageInfo?: ?ConversationsMessageAttachmentsItemImageInfo, + * isAllowedFileType?: ?bool, * } $values */ public function __construct( array $values = [], ) { - $this->fileName = $values['fileName'] ?? null; - $this->inlineId = $values['inlineId'] ?? null; + $this->name = $values['name'] ?? null; + $this->link = $values['link'] ?? null; + $this->mimeType = $values['mimeType'] ?? null; $this->isImage = $values['isImage'] ?? null; + $this->isSticker = $values['isSticker'] ?? null; $this->isInline = $values['isInline'] ?? null; + $this->inlineId = $values['inlineId'] ?? null; $this->size = $values['size'] ?? null; - $this->url = $values['url'] ?? null; + $this->imageInfo = $values['imageInfo'] ?? null; + $this->isAllowedFileType = $values['isAllowedFileType'] ?? null; } /** diff --git a/src/Types/ConversationsMessageAttachmentsItemImageInfo.php b/src/Types/ConversationsMessageAttachmentsItemImageInfo.php new file mode 100644 index 00000000..1321adfc --- /dev/null +++ b/src/Types/ConversationsMessageAttachmentsItemImageInfo.php @@ -0,0 +1,53 @@ +width = $values['width'] ?? null; + $this->height = $values['height'] ?? null; + $this->previewLink = $values['previewLink'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/ConversationsMessageFile.php b/src/Types/ConversationsMessageFile.php index 425d4bfa..a40be39d 100644 --- a/src/Types/ConversationsMessageFile.php +++ b/src/Types/ConversationsMessageFile.php @@ -8,52 +8,92 @@ class ConversationsMessageFile extends JsonSerializableType { /** - * @var ?string $filename Name of the file + * @var ?string $name Name of the file. */ - #[JsonProperty('filename')] - public ?string $filename; + #[JsonProperty('name')] + public ?string $name; /** - * @var ?ConversationsMessageFileImageInfo $imageInfo image info is passed in case the file is an image + * @var ?string $link URL of the file. */ - #[JsonProperty('imageInfo')] - public ?ConversationsMessageFileImageInfo $imageInfo; + #[JsonProperty('link')] + public ?string $link; + + /** + * @var ?string $mimeType MIME type of the file. + */ + #[JsonProperty('mimeType')] + public ?string $mimeType; /** - * @var ?bool $isImage Whether the file is an image + * @var ?bool $isImage Whether the file is an image. */ #[JsonProperty('isImage')] public ?bool $isImage; /** - * @var ?int $size Size in bytes + * @var ?bool $isSticker Whether the file is a sticker. + */ + #[JsonProperty('isSticker')] + public ?bool $isSticker; + + /** + * @var ?bool $isInline Whether the file is inline. + */ + #[JsonProperty('isInline')] + public ?bool $isInline; + + /** + * @var ?string $inlineId The ID of the inline file. + */ + #[JsonProperty('inlineId')] + public ?string $inlineId; + + /** + * @var ?int $size Size in bytes. */ #[JsonProperty('size')] public ?int $size; /** - * @var ?string $url URL of the file + * @var ?ConversationsMessageFileImageInfo $imageInfo Image info, present when the file is an image. */ - #[JsonProperty('url')] - public ?string $url; + #[JsonProperty('imageInfo')] + public ?ConversationsMessageFileImageInfo $imageInfo; + + /** + * @var ?bool $isAllowedFileType Whether the file extension is allowed for download. + */ + #[JsonProperty('isAllowedFileType')] + public ?bool $isAllowedFileType; /** * @param array{ - * filename?: ?string, - * imageInfo?: ?ConversationsMessageFileImageInfo, + * name?: ?string, + * link?: ?string, + * mimeType?: ?string, * isImage?: ?bool, + * isSticker?: ?bool, + * isInline?: ?bool, + * inlineId?: ?string, * size?: ?int, - * url?: ?string, + * imageInfo?: ?ConversationsMessageFileImageInfo, + * isAllowedFileType?: ?bool, * } $values */ public function __construct( array $values = [], ) { - $this->filename = $values['filename'] ?? null; - $this->imageInfo = $values['imageInfo'] ?? null; + $this->name = $values['name'] ?? null; + $this->link = $values['link'] ?? null; + $this->mimeType = $values['mimeType'] ?? null; $this->isImage = $values['isImage'] ?? null; + $this->isSticker = $values['isSticker'] ?? null; + $this->isInline = $values['isInline'] ?? null; + $this->inlineId = $values['inlineId'] ?? null; $this->size = $values['size'] ?? null; - $this->url = $values['url'] ?? null; + $this->imageInfo = $values['imageInfo'] ?? null; + $this->isAllowedFileType = $values['isAllowedFileType'] ?? null; } /** diff --git a/src/Types/ConversationsMessageFileImageInfo.php b/src/Types/ConversationsMessageFileImageInfo.php index 9fe01dcf..d3d105e1 100644 --- a/src/Types/ConversationsMessageFileImageInfo.php +++ b/src/Types/ConversationsMessageFileImageInfo.php @@ -6,41 +6,41 @@ use Brevo\Core\Json\JsonProperty; /** - * image info is passed in case the file is an image + * Image info, present when the file is an image. */ class ConversationsMessageFileImageInfo extends JsonSerializableType { /** - * @var ?int $height height of the image + * @var ?int $width Width of the image in pixels. */ - #[JsonProperty('height')] - public ?int $height; + #[JsonProperty('width')] + public ?int $width; /** - * @var ?string $previewUrl URL of the preview + * @var ?int $height Height of the image in pixels. */ - #[JsonProperty('previewUrl')] - public ?string $previewUrl; + #[JsonProperty('height')] + public ?int $height; /** - * @var ?int $width Width of the image + * @var ?string $previewLink URL of the image preview. */ - #[JsonProperty('width')] - public ?int $width; + #[JsonProperty('previewLink')] + public ?string $previewLink; /** * @param array{ - * height?: ?int, - * previewUrl?: ?string, * width?: ?int, + * height?: ?int, + * previewLink?: ?string, * } $values */ public function __construct( array $values = [], ) { - $this->height = $values['height'] ?? null; - $this->previewUrl = $values['previewUrl'] ?? null; $this->width = $values['width'] ?? null; + $this->height = $values['height'] ?? null; + $this->previewLink = $values['previewLink'] ?? null; } /** diff --git a/src/Types/Deal.php b/src/Types/Deal.php index 71e6d9c1..4b821c9d 100644 --- a/src/Types/Deal.php +++ b/src/Types/Deal.php @@ -11,12 +11,6 @@ */ class Deal extends JsonSerializableType { - /** - * @var ?array $attributes Deal attributes with values - */ - #[JsonProperty('attributes'), ArrayType(['string' => 'mixed'])] - public ?array $attributes; - /** * @var ?string $id Unique deal id */ @@ -24,10 +18,10 @@ class Deal extends JsonSerializableType public ?string $id; /** - * @var ?array $linkedCompaniesIds Companies ids for companies linked to this deal + * @var ?array $attributes Deal attributes with values */ - #[JsonProperty('linkedCompaniesIds'), ArrayType(['string'])] - public ?array $linkedCompaniesIds; + #[JsonProperty('attributes'), ArrayType(['string' => 'mixed'])] + public ?array $attributes; /** * @var ?array $linkedContactsIds Contact ids for contacts linked to this deal @@ -35,21 +29,27 @@ class Deal extends JsonSerializableType #[JsonProperty('linkedContactsIds'), ArrayType(['integer'])] public ?array $linkedContactsIds; + /** + * @var ?array $linkedCompaniesIds Companies ids for companies linked to this deal + */ + #[JsonProperty('linkedCompaniesIds'), ArrayType(['string'])] + public ?array $linkedCompaniesIds; + /** * @param array{ - * attributes?: ?array, * id?: ?string, - * linkedCompaniesIds?: ?array, + * attributes?: ?array, * linkedContactsIds?: ?array, + * linkedCompaniesIds?: ?array, * } $values */ public function __construct( array $values = [], ) { - $this->attributes = $values['attributes'] ?? null; $this->id = $values['id'] ?? null; - $this->linkedCompaniesIds = $values['linkedCompaniesIds'] ?? null; + $this->attributes = $values['attributes'] ?? null; $this->linkedContactsIds = $values['linkedContactsIds'] ?? null; + $this->linkedCompaniesIds = $values['linkedCompaniesIds'] ?? null; } /** diff --git a/src/Types/FileData.php b/src/Types/FileData.php index 8e3b26da..7f9e4e90 100644 --- a/src/Types/FileData.php +++ b/src/Types/FileData.php @@ -13,28 +13,28 @@ class FileData extends JsonSerializableType { /** - * @var ?string $authorId Account id of user which created the file + * @var ?string $id Unique file id */ - #[JsonProperty('authorId')] - public ?string $authorId; + #[JsonProperty('id')] + public ?string $id; /** - * @var ?string $companyId Company id linked to a file + * @var ?string $name Name of uploaded file */ - #[JsonProperty('companyId')] - public ?string $companyId; + #[JsonProperty('name')] + public ?string $name; /** - * @var ?int $contactId Contact id of contact on which file is uploaded + * @var ?string $authorId Account id of user which created the file */ - #[JsonProperty('contactId')] - public ?int $contactId; + #[JsonProperty('authorId')] + public ?string $authorId; /** - * @var ?DateTime $createdAt File created date/time + * @var ?int $contactId Contact id of contact on which file is uploaded */ - #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] - public ?DateTime $createdAt; + #[JsonProperty('contactId')] + public ?int $contactId; /** * @var ?string $dealId Deal id linked to a file @@ -43,10 +43,10 @@ class FileData extends JsonSerializableType public ?string $dealId; /** - * @var ?string $name Name of uploaded file + * @var ?string $companyId Company id linked to a file */ - #[JsonProperty('name')] - public ?string $name; + #[JsonProperty('companyId')] + public ?string $companyId; /** * @var ?int $size Size of file in bytes @@ -54,27 +54,35 @@ class FileData extends JsonSerializableType #[JsonProperty('size')] public ?int $size; + /** + * @var ?DateTime $createdAt File created date/time + */ + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; + /** * @param array{ + * id?: ?string, + * name?: ?string, * authorId?: ?string, - * companyId?: ?string, * contactId?: ?int, - * createdAt?: ?DateTime, * dealId?: ?string, - * name?: ?string, + * companyId?: ?string, * size?: ?int, + * createdAt?: ?DateTime, * } $values */ public function __construct( array $values = [], ) { + $this->id = $values['id'] ?? null; + $this->name = $values['name'] ?? null; $this->authorId = $values['authorId'] ?? null; - $this->companyId = $values['companyId'] ?? null; $this->contactId = $values['contactId'] ?? null; - $this->createdAt = $values['createdAt'] ?? null; $this->dealId = $values['dealId'] ?? null; - $this->name = $values['name'] ?? null; + $this->companyId = $values['companyId'] ?? null; $this->size = $values['size'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; } /** diff --git a/src/Types/GetCampaignRecipients.php b/src/Types/GetCampaignRecipients.php index 047fc9c0..d0653c6f 100644 --- a/src/Types/GetCampaignRecipients.php +++ b/src/Types/GetCampaignRecipients.php @@ -8,6 +8,12 @@ class GetCampaignRecipients extends JsonSerializableType { + /** + * @var ?array $excludedSegments Segment IDs excluded from the campaign + */ + #[JsonProperty('excludedSegments'), ArrayType(['integer'])] + public ?array $excludedSegments; + /** * @var array $exclusionLists */ @@ -20,17 +26,27 @@ class GetCampaignRecipients extends JsonSerializableType #[JsonProperty('lists'), ArrayType(['integer'])] public array $lists; + /** + * @var ?array $segments Segment IDs included in the campaign + */ + #[JsonProperty('segments'), ArrayType(['integer'])] + public ?array $segments; + /** * @param array{ * exclusionLists: array, * lists: array, + * excludedSegments?: ?array, + * segments?: ?array, * } $values */ public function __construct( array $values, ) { + $this->excludedSegments = $values['excludedSegments'] ?? null; $this->exclusionLists = $values['exclusionLists']; $this->lists = $values['lists']; + $this->segments = $values['segments'] ?? null; } /** diff --git a/src/Types/GetCampaignStats.php b/src/Types/GetCampaignStats.php index 5f37a150..eceb7811 100644 --- a/src/Types/GetCampaignStats.php +++ b/src/Types/GetCampaignStats.php @@ -38,13 +38,13 @@ class GetCampaignStats extends JsonSerializableType public int $delivered; /** - * @var ?int $estimatedViews Rate of recipients without any privacy protection option enabled in their email client_dev, applied to all delivered emails + * @var ?int $estimatedViews Rate of recipients without any privacy protection option enabled in their email client, applied to all delivered emails */ #[JsonProperty('estimatedViews')] public ?int $estimatedViews; /** - * @var int $hardBounces Number of harbounce for the campaign + * @var int $hardBounces Number of hard bounces for the campaign */ #[JsonProperty('hardBounces')] public int $hardBounces; @@ -80,13 +80,13 @@ class GetCampaignStats extends JsonSerializableType public int $softBounces; /** - * @var int $trackableViews Recipients without any privacy protection option enabled in their email client_dev + * @var int $trackableViews Recipients without any privacy protection option enabled in their email email client */ #[JsonProperty('trackableViews')] public int $trackableViews; /** - * @var ?float $trackableViewsRate Rate of recipients without any privacy protection option enabled in their email client_dev + * @var ?float $trackableViewsRate Rate of recipients without any privacy protection option enabled in their email client */ #[JsonProperty('trackableViewsRate')] public ?float $trackableViewsRate; diff --git a/src/Types/GetContactDetails.php b/src/Types/GetContactDetails.php index e7303b48..bc849296 100644 --- a/src/Types/GetContactDetails.php +++ b/src/Types/GetContactDetails.php @@ -62,6 +62,12 @@ class GetContactDetails extends JsonSerializableType #[JsonProperty('smsBlacklisted')] public bool $smsBlacklisted; + /** + * @var bool $whatsappBlacklisted Blacklist status for WhatsApp campaigns (true=blacklisted, false=not blacklisted) + */ + #[JsonProperty('whatsappBlacklisted')] + public bool $whatsappBlacklisted; + /** * @param array{ * attributes: GetContactDetailsAttributes, @@ -71,6 +77,7 @@ class GetContactDetails extends JsonSerializableType * listIds: array, * modifiedAt: string, * smsBlacklisted: bool, + * whatsappBlacklisted: bool, * email?: ?string, * listUnsubscribed?: ?array, * } $values @@ -87,6 +94,7 @@ public function __construct( $this->listUnsubscribed = $values['listUnsubscribed'] ?? null; $this->modifiedAt = $values['modifiedAt']; $this->smsBlacklisted = $values['smsBlacklisted']; + $this->whatsappBlacklisted = $values['whatsappBlacklisted']; } /** diff --git a/src/Types/GetEventsListEventsItem.php b/src/Types/GetEventsListEventsItem.php index 2fc7d99a..e5df04a9 100644 --- a/src/Types/GetEventsListEventsItem.php +++ b/src/Types/GetEventsListEventsItem.php @@ -34,12 +34,6 @@ class GetEventsListEventsItem extends JsonSerializableType #[JsonProperty('event_filter_id')] public ?string $eventFilterId; - /** - * @var ?string $source Source of the event - */ - #[JsonProperty('source')] - public ?string $source; - /** * @var ?string $objectType Object type associated with the event */ @@ -64,7 +58,6 @@ class GetEventsListEventsItem extends JsonSerializableType * eventDate?: ?DateTime, * eventName?: ?string, * eventFilterId?: ?string, - * source?: ?string, * objectType?: ?string, * eventProperties?: ?array, * contactProperties?: ?array, @@ -77,7 +70,6 @@ public function __construct( $this->eventDate = $values['eventDate'] ?? null; $this->eventName = $values['eventName'] ?? null; $this->eventFilterId = $values['eventFilterId'] ?? null; - $this->source = $values['source'] ?? null; $this->objectType = $values['objectType'] ?? null; $this->eventProperties = $values['eventProperties'] ?? null; $this->contactProperties = $values['contactProperties'] ?? null; diff --git a/src/Types/GetExtendedCampaignOverview.php b/src/Types/GetExtendedCampaignOverview.php index b9da9072..fedd29b5 100644 --- a/src/Types/GetExtendedCampaignOverview.php +++ b/src/Types/GetExtendedCampaignOverview.php @@ -98,12 +98,24 @@ class GetExtendedCampaignOverview extends JsonSerializableType #[JsonProperty('winnerDelay')] public ?int $winnerDelay; + /** + * @var ?string $attachmentUrl URL of the attachment file associated with the campaign. Empty string if no attachment is present. + */ + #[JsonProperty('attachmentUrl')] + public ?string $attachmentUrl; + /** * @var string $createdAt Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ) */ #[JsonProperty('createdAt')] public string $createdAt; + /** + * @var ?GetExtendedCampaignOverviewEmailExpirationDate $emailExpirationDate Expiration date configuration for the email campaign, if set. Contains the duration and unit of the email expiry. + */ + #[JsonProperty('emailExpirationDate')] + public ?GetExtendedCampaignOverviewEmailExpirationDate $emailExpirationDate; + /** * @var string $footer Footer of the campaign */ @@ -171,7 +183,7 @@ class GetExtendedCampaignOverview extends JsonSerializableType public ?string $sentDate; /** - * @var ?string $shareLink Link to share the campaign on social medias + * @var ?string $shareLink Link to share the campaign on social media. For trigger campaigns, this returns a descriptive message instead of a URL. For classic campaigns that have not been sent, this also returns a descriptive message. */ #[JsonProperty('shareLink')] public ?string $shareLink; @@ -201,25 +213,25 @@ class GetExtendedCampaignOverview extends JsonSerializableType public ?string $toField; /** - * @var ?string $utmCampaignValue utm parameter associated with campaign + * @var ?string $utmCampaignValue The utm_campaign value associated with the campaign. Only present if a UTM campaign value was set. */ #[JsonProperty('utmCampaignValue')] public ?string $utmCampaignValue; /** - * @var ?bool $utmIdActive utm id active + * @var ?int $utmId The campaign ID used as utm_id parameter. Only present if UTM campaign tracking with ID is enabled. */ - #[JsonProperty('utmIDActive')] - public ?bool $utmIdActive; + #[JsonProperty('utmID')] + public ?int $utmId; /** - * @var ?string $utmMedium + * @var ?string $utmMedium The utm_medium value. Set to "EMAIL" when UTM campaign tracking is enabled. */ #[JsonProperty('utmMedium')] public ?string $utmMedium; /** - * @var ?string $utmSource source of utm + * @var ?string $utmSource The utm_source value. Set to "Brevo" when UTM campaign tracking is enabled. */ #[JsonProperty('utmSource')] public ?string $utmSource; @@ -249,6 +261,8 @@ class GetExtendedCampaignOverview extends JsonSerializableType * subjectB?: ?string, * winnerCriteria?: ?string, * winnerDelay?: ?int, + * attachmentUrl?: ?string, + * emailExpirationDate?: ?GetExtendedCampaignOverviewEmailExpirationDate, * inlineImageActivation?: ?bool, * mirrorActive?: ?bool, * recurring?: ?bool, @@ -259,7 +273,7 @@ class GetExtendedCampaignOverview extends JsonSerializableType * tags?: ?array, * toField?: ?string, * utmCampaignValue?: ?string, - * utmIdActive?: ?bool, + * utmId?: ?int, * utmMedium?: ?string, * utmSource?: ?string, * } $values @@ -282,7 +296,9 @@ public function __construct( $this->type = $values['type']; $this->winnerCriteria = $values['winnerCriteria'] ?? null; $this->winnerDelay = $values['winnerDelay'] ?? null; + $this->attachmentUrl = $values['attachmentUrl'] ?? null; $this->createdAt = $values['createdAt']; + $this->emailExpirationDate = $values['emailExpirationDate'] ?? null; $this->footer = $values['footer']; $this->header = $values['header']; $this->htmlContent = $values['htmlContent']; @@ -300,7 +316,7 @@ public function __construct( $this->testSent = $values['testSent']; $this->toField = $values['toField'] ?? null; $this->utmCampaignValue = $values['utmCampaignValue'] ?? null; - $this->utmIdActive = $values['utmIdActive'] ?? null; + $this->utmId = $values['utmId'] ?? null; $this->utmMedium = $values['utmMedium'] ?? null; $this->utmSource = $values['utmSource'] ?? null; } diff --git a/src/Types/GetExtendedCampaignOverviewEmailExpirationDate.php b/src/Types/GetExtendedCampaignOverviewEmailExpirationDate.php new file mode 100644 index 00000000..a6cea89a --- /dev/null +++ b/src/Types/GetExtendedCampaignOverviewEmailExpirationDate.php @@ -0,0 +1,45 @@ + $unit Unit of the duration + */ + #[JsonProperty('unit')] + public ?string $unit; + + /** + * @param array{ + * duration?: ?int, + * unit?: ?value-of, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->duration = $values['duration'] ?? null; + $this->unit = $values['unit'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/GetExtendedCampaignOverviewEmailExpirationDateUnit.php b/src/Types/GetExtendedCampaignOverviewEmailExpirationDateUnit.php new file mode 100644 index 00000000..f74126ed --- /dev/null +++ b/src/Types/GetExtendedCampaignOverviewEmailExpirationDateUnit.php @@ -0,0 +1,10 @@ + $linksStats Statistics about the number of clicks for each link in the campaign. Keys are the link URLs, values are click counts. Only populated when the `statistics` query parameter is set to `linksStats`. */ - #[JsonProperty('linksStats')] - public GetExtendedCampaignStatsLinksStats $linksStats; + #[JsonProperty('linksStats'), ArrayType(['string' => 'integer'])] + public array $linksStats; /** * @var int $mirrorClick Number of clicks on mirror link @@ -33,39 +33,39 @@ class GetExtendedCampaignStats extends JsonSerializableType public int $mirrorClick; /** - * @var int $remaining Number of remaning emails to send + * @var int $remaining Number of remaining emails to send */ #[JsonProperty('remaining')] public int $remaining; /** - * @var array $statsByBrowser + * @var ?array $statsByBrowser Statistics of the campaign grouped by browser. Only available when retrieving a single campaign with the `statistics` query parameter set to `statsByBrowser`. */ #[JsonProperty('statsByBrowser'), ArrayType(['string' => GetDeviceBrowserStats::class])] - public array $statsByBrowser; + public ?array $statsByBrowser; /** - * @var GetExtendedCampaignStatsStatsByDevice $statsByDevice + * @var ?GetExtendedCampaignStatsStatsByDevice $statsByDevice */ #[JsonProperty('statsByDevice')] - public GetExtendedCampaignStatsStatsByDevice $statsByDevice; + public ?GetExtendedCampaignStatsStatsByDevice $statsByDevice; /** - * @var array $statsByDomain + * @var ?array $statsByDomain Statistics of the campaign grouped by email domain. Only populated when the `statistics` query parameter is set to `statsByDomain`. */ #[JsonProperty('statsByDomain'), ArrayType(['string' => GetCampaignStats::class])] - public array $statsByDomain; + public ?array $statsByDomain; /** * @param array{ * campaignStats: array, * globalStats: GetCampaignStats, - * linksStats: GetExtendedCampaignStatsLinksStats, + * linksStats: array, * mirrorClick: int, * remaining: int, - * statsByBrowser: array, - * statsByDevice: GetExtendedCampaignStatsStatsByDevice, - * statsByDomain: array, + * statsByBrowser?: ?array, + * statsByDevice?: ?GetExtendedCampaignStatsStatsByDevice, + * statsByDomain?: ?array, * } $values */ public function __construct( @@ -76,9 +76,9 @@ public function __construct( $this->linksStats = $values['linksStats']; $this->mirrorClick = $values['mirrorClick']; $this->remaining = $values['remaining']; - $this->statsByBrowser = $values['statsByBrowser']; - $this->statsByDevice = $values['statsByDevice']; - $this->statsByDomain = $values['statsByDomain']; + $this->statsByBrowser = $values['statsByBrowser'] ?? null; + $this->statsByDevice = $values['statsByDevice'] ?? null; + $this->statsByDomain = $values['statsByDomain'] ?? null; } /** diff --git a/src/Types/GetExtendedCampaignStatsLinksStats.php b/src/Types/GetExtendedCampaignStatsLinksStats.php deleted file mode 100644 index d7220115..00000000 --- a/src/Types/GetExtendedCampaignStatsLinksStats.php +++ /dev/null @@ -1,29 +0,0 @@ -toJson(); - } -} diff --git a/src/Types/GetProductDetails.php b/src/Types/GetProductDetails.php index 955187aa..202c8fbd 100644 --- a/src/Types/GetProductDetails.php +++ b/src/Types/GetProductDetails.php @@ -45,7 +45,7 @@ class GetProductDetails extends JsonSerializableType public ?string $imageUrl; /** - * @var ?bool $isDeleted Product get deleted from the shop's database but not from Brevo + * @var ?bool $isDeleted Product deleted from the shop's database but not from Brevo */ #[JsonProperty('isDeleted')] public ?bool $isDeleted; @@ -80,6 +80,12 @@ class GetProductDetails extends JsonSerializableType #[JsonProperty('price')] public ?float $price; + /** + * @var ?float $alternativePrice Alternative price of the product + */ + #[JsonProperty('alternativePrice')] + public ?float $alternativePrice; + /** * @var ?string $s3Original S3 url of original image */ @@ -132,6 +138,7 @@ class GetProductDetails extends JsonSerializableType * metaInfo?: ?array, * parentId?: ?string, * price?: ?float, + * alternativePrice?: ?float, * s3Original?: ?string, * sku?: ?string, * stock?: ?float, @@ -153,6 +160,7 @@ public function __construct( $this->name = $values['name']; $this->parentId = $values['parentId'] ?? null; $this->price = $values['price'] ?? null; + $this->alternativePrice = $values['alternativePrice'] ?? null; $this->s3Original = $values['s3Original'] ?? null; $this->s3ThumbAnalytics = $values['s3ThumbAnalytics']; $this->s3ThumbEditor = $values['s3ThumbEditor']; diff --git a/src/Types/GetSmsCampaignOverview.php b/src/Types/GetSmsCampaignOverview.php index 574923ab..88c95298 100644 --- a/src/Types/GetSmsCampaignOverview.php +++ b/src/Types/GetSmsCampaignOverview.php @@ -38,7 +38,13 @@ class GetSmsCampaignOverview extends JsonSerializableType public string $name; /** - * @var ?string $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format + * @var ?string $organisationPrefix A recognizable prefix added as the Brand Name before the message content. Empty string if not set. + */ + #[JsonProperty('organisationPrefix')] + public ?string $organisationPrefix; + + /** + * @var ?string $scheduledAt UTC date-time on which SMS campaign is scheduled. Should be in YYYY-MM-DDTHH:mm:ss.SSSZ format. Empty string if not scheduled. */ #[JsonProperty('scheduledAt')] public ?string $scheduledAt; @@ -49,12 +55,24 @@ class GetSmsCampaignOverview extends JsonSerializableType #[JsonProperty('sender')] public string $sender; + /** + * @var ?string $sentDate UTC date-time on which the SMS campaign was sent (YYYY-MM-DDTHH:mm:ss.SSSZ). Only available if the campaign status is 'sent'. + */ + #[JsonProperty('sentDate')] + public ?string $sentDate; + /** * @var value-of $status Status of the SMS Campaign */ #[JsonProperty('status')] public string $status; + /** + * @var ?string $unsubscribeInstruction Instructions to unsubscribe from future communications. Empty string if not set. + */ + #[JsonProperty('unsubscribeInstruction')] + public ?string $unsubscribeInstruction; + /** * @param array{ * content: string, @@ -64,7 +82,10 @@ class GetSmsCampaignOverview extends JsonSerializableType * name: string, * sender: string, * status: value-of, + * organisationPrefix?: ?string, * scheduledAt?: ?string, + * sentDate?: ?string, + * unsubscribeInstruction?: ?string, * } $values */ public function __construct( @@ -75,9 +96,12 @@ public function __construct( $this->id = $values['id']; $this->modifiedAt = $values['modifiedAt']; $this->name = $values['name']; + $this->organisationPrefix = $values['organisationPrefix'] ?? null; $this->scheduledAt = $values['scheduledAt'] ?? null; $this->sender = $values['sender']; + $this->sentDate = $values['sentDate'] ?? null; $this->status = $values['status']; + $this->unsubscribeInstruction = $values['unsubscribeInstruction'] ?? null; } /** diff --git a/src/Types/GetSmtpTemplateOverview.php b/src/Types/GetSmtpTemplateOverview.php index 3fe05c15..42cad29d 100644 --- a/src/Types/GetSmtpTemplateOverview.php +++ b/src/Types/GetSmtpTemplateOverview.php @@ -85,6 +85,12 @@ class GetSmtpTemplateOverview extends JsonSerializableType #[JsonProperty('toField')] public string $toField; + /** + * @var ?string $customTemplateId Custom template identifier, if one was assigned during template creation. Only present when the template has a custom ID. + */ + #[JsonProperty('customTemplateId')] + public ?string $customTemplateId; + /** * @param array{ * createdAt: string, @@ -100,6 +106,7 @@ class GetSmtpTemplateOverview extends JsonSerializableType * testSent: bool, * toField: string, * doiTemplate?: ?bool, + * customTemplateId?: ?string, * } $values */ public function __construct( @@ -118,6 +125,7 @@ public function __construct( $this->tag = $values['tag']; $this->testSent = $values['testSent']; $this->toField = $values['toField']; + $this->customTemplateId = $values['customTemplateId'] ?? null; } /** diff --git a/src/Types/GetSmtpTemplateOverviewSender.php b/src/Types/GetSmtpTemplateOverviewSender.php index 825d6d0a..5e889e1e 100644 --- a/src/Types/GetSmtpTemplateOverviewSender.php +++ b/src/Types/GetSmtpTemplateOverviewSender.php @@ -20,7 +20,7 @@ class GetSmtpTemplateOverviewSender extends JsonSerializableType public ?string $id; /** - * @var ?string $name From email for the template + * @var ?string $name Sender name for the template */ #[JsonProperty('name')] public ?string $name; diff --git a/src/Types/GetWebhook.php b/src/Types/GetWebhook.php index f47a5005..fb7d7973 100644 --- a/src/Types/GetWebhook.php +++ b/src/Types/GetWebhook.php @@ -23,12 +23,6 @@ class GetWebhook extends JsonSerializableType #[JsonProperty('batched')] public ?bool $batched; - /** - * @var ?value-of $channel channel of webhook - */ - #[JsonProperty('channel')] - public ?string $channel; - /** * @var string $createdAt Creation UTC date-time of the webhook (YYYY-MM-DDTHH:mm:ss.SSSZ) */ @@ -66,11 +60,17 @@ class GetWebhook extends JsonSerializableType public string $modifiedAt; /** - * @var value-of $type Type of webhook (marketing or transactional) + * @var value-of $type Type of webhook (marketing, transactional, or inbound) */ #[JsonProperty('type')] public string $type; + /** + * @var ?string $domain Inbound domain of the webhook, only returned for inbound type webhooks + */ + #[JsonProperty('domain')] + public ?string $domain; + /** * @var string $url URL of the webhook */ @@ -88,8 +88,8 @@ class GetWebhook extends JsonSerializableType * url: string, * auth?: ?array, * batched?: ?bool, - * channel?: ?value-of, * headers?: ?array>, + * domain?: ?string, * } $values */ public function __construct( @@ -97,7 +97,6 @@ public function __construct( ) { $this->auth = $values['auth'] ?? null; $this->batched = $values['batched'] ?? null; - $this->channel = $values['channel'] ?? null; $this->createdAt = $values['createdAt']; $this->description = $values['description']; $this->events = $values['events']; @@ -105,6 +104,7 @@ public function __construct( $this->id = $values['id']; $this->modifiedAt = $values['modifiedAt']; $this->type = $values['type']; + $this->domain = $values['domain'] ?? null; $this->url = $values['url']; } diff --git a/src/Types/GetWebhookChannel.php b/src/Types/GetWebhookChannel.php deleted file mode 100644 index 7d553b24..00000000 --- a/src/Types/GetWebhookChannel.php +++ /dev/null @@ -1,9 +0,0 @@ - $meta Loyalty Program metadata. */ - #[JsonProperty('documentId')] - public ?string $documentId; + #[JsonProperty('meta'), ArrayType(['string' => 'mixed'])] + public ?array $meta; /** - * @var ?string $id Loyalty Program ID + * @var ?value-of $state Current state of the loyalty program. */ - #[JsonProperty('id')] - public ?string $id; + #[JsonProperty('state')] + public ?string $state; /** - * @var ?array $meta Loyalty Program meta data + * @var ?string $subscriptionPoolId Loyalty Program subscription pool ID. */ - #[JsonProperty('meta'), ArrayType(['string' => 'mixed'])] - public ?array $meta; + #[JsonProperty('subscriptionPoolId')] + public ?string $subscriptionPoolId; /** - * @var ?string $name Loyalty Program name + * @var ?string $subscriptionGeneratorId Loyalty Program subscription generator ID. */ - #[JsonProperty('name')] - public ?string $name; + #[JsonProperty('subscriptionGeneratorId')] + public ?string $subscriptionGeneratorId; /** - * @var ?string $pattern string + * @var ?string $pattern Subscription code pattern. */ #[JsonProperty('pattern')] public ?string $pattern; /** - * @var ?value-of $state Loyalty Program state + * @var ?int $codeCount Number of available subscription codes. */ - #[JsonProperty('state')] - public ?string $state; + #[JsonProperty('codeCount')] + public ?int $codeCount; /** - * @var ?string $subscriptionGeneratorId Loyalty Program subscription generator ID + * @var ?string $documentId Associated document identifier. */ - #[JsonProperty('subscriptionGeneratorId')] - public ?string $subscriptionGeneratorId; + #[JsonProperty('documentId')] + public ?string $documentId; /** - * @var ?string $subscriptionPoolId Loyalty Program subscription pool ID + * @var ?string $birthdayAttribute Contact attribute name used for birthday tracking. */ - #[JsonProperty('subscriptionPoolId')] - public ?string $subscriptionPoolId; + #[JsonProperty('birthdayAttribute')] + public ?string $birthdayAttribute; + + /** + * @var ?DateTime $createdAt Timestamp when the loyalty program was created. + */ + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; /** - * @var ?string $updatedAt Loyalty Program last modification date + * @var ?DateTime $updatedAt Timestamp when the loyalty program was last modified. */ - #[JsonProperty('updatedAt')] - public ?string $updatedAt; + #[JsonProperty('updatedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $updatedAt; /** * @param array{ - * codeCount?: ?int, - * createdAt?: ?string, - * description?: ?string, - * documentId?: ?string, * id?: ?string, - * meta?: ?array, * name?: ?string, - * pattern?: ?string, + * description?: ?string, + * meta?: ?array, * state?: ?value-of, - * subscriptionGeneratorId?: ?string, * subscriptionPoolId?: ?string, - * updatedAt?: ?string, + * subscriptionGeneratorId?: ?string, + * pattern?: ?string, + * codeCount?: ?int, + * documentId?: ?string, + * birthdayAttribute?: ?string, + * createdAt?: ?DateTime, + * updatedAt?: ?DateTime, * } $values */ public function __construct( array $values = [], ) { - $this->codeCount = $values['codeCount'] ?? null; - $this->createdAt = $values['createdAt'] ?? null; - $this->description = $values['description'] ?? null; - $this->documentId = $values['documentId'] ?? null; $this->id = $values['id'] ?? null; - $this->meta = $values['meta'] ?? null; $this->name = $values['name'] ?? null; - $this->pattern = $values['pattern'] ?? null; + $this->description = $values['description'] ?? null; + $this->meta = $values['meta'] ?? null; $this->state = $values['state'] ?? null; - $this->subscriptionGeneratorId = $values['subscriptionGeneratorId'] ?? null; $this->subscriptionPoolId = $values['subscriptionPoolId'] ?? null; + $this->subscriptionGeneratorId = $values['subscriptionGeneratorId'] ?? null; + $this->pattern = $values['pattern'] ?? null; + $this->codeCount = $values['codeCount'] ?? null; + $this->documentId = $values['documentId'] ?? null; + $this->birthdayAttribute = $values['birthdayAttribute'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; } diff --git a/src/Types/LoyaltyProgramState.php b/src/Types/LoyaltyProgramState.php index 27efe63f..aedd4eba 100644 --- a/src/Types/LoyaltyProgramState.php +++ b/src/Types/LoyaltyProgramState.php @@ -6,4 +6,5 @@ enum LoyaltyProgramState: string { case Inactive = "inactive"; case Active = "active"; + case Draft = "draft"; } diff --git a/src/Types/Note.php b/src/Types/Note.php index 4d95278b..8a75997f 100644 --- a/src/Types/Note.php +++ b/src/Types/Note.php @@ -14,10 +14,16 @@ class Note extends JsonSerializableType { /** - * @var ?array $authorId Account details of user which created the note + * @var ?string $id Unique note Id */ - #[JsonProperty('authorId'), ArrayType(['string' => 'mixed'])] - public ?array $authorId; + #[JsonProperty('id')] + public ?string $id; + + /** + * @var string $text Content of the note. Supports HTML for rich text formatting. Supported tags include: `

` (paragraph), `` / `` (bold), `` / `` (italic), `` (underline), `
` (line break), `` (labelled hyperlink). Example labelled link: `Link text`. + */ + #[JsonProperty('text')] + public string $text; /** * @var ?array $contactIds Contact ids linked to a note @@ -26,10 +32,10 @@ class Note extends JsonSerializableType public ?array $contactIds; /** - * @var ?DateTime $createdAt Note created date/time + * @var ?array $companyIds Company ids linked to a note */ - #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] - public ?DateTime $createdAt; + #[JsonProperty('companyIds'), ArrayType(['string'])] + public ?array $companyIds; /** * @var ?array $dealIds Deal ids linked to a note @@ -38,16 +44,16 @@ class Note extends JsonSerializableType public ?array $dealIds; /** - * @var ?string $id Unique note Id + * @var ?array $authorId Account details of user which created the note */ - #[JsonProperty('id')] - public ?string $id; + #[JsonProperty('authorId'), ArrayType(['string' => 'mixed'])] + public ?array $authorId; /** - * @var string $text Text content of a note + * @var ?DateTime $createdAt Note created date/time */ - #[JsonProperty('text')] - public string $text; + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; /** * @var ?DateTime $updatedAt Note updated date/time @@ -58,23 +64,25 @@ class Note extends JsonSerializableType /** * @param array{ * text: string, - * authorId?: ?array, + * id?: ?string, * contactIds?: ?array, - * createdAt?: ?DateTime, + * companyIds?: ?array, * dealIds?: ?array, - * id?: ?string, + * authorId?: ?array, + * createdAt?: ?DateTime, * updatedAt?: ?DateTime, * } $values */ public function __construct( array $values, ) { - $this->authorId = $values['authorId'] ?? null; - $this->contactIds = $values['contactIds'] ?? null; - $this->createdAt = $values['createdAt'] ?? null; - $this->dealIds = $values['dealIds'] ?? null; $this->id = $values['id'] ?? null; $this->text = $values['text']; + $this->contactIds = $values['contactIds'] ?? null; + $this->companyIds = $values['companyIds'] ?? null; + $this->dealIds = $values['dealIds'] ?? null; + $this->authorId = $values['authorId'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; } diff --git a/src/Types/NoteData.php b/src/Types/NoteData.php index e5284fab..dc64b0dd 100644 --- a/src/Types/NoteData.php +++ b/src/Types/NoteData.php @@ -30,7 +30,7 @@ class NoteData extends JsonSerializableType public ?array $dealIds; /** - * @var string $text Text content of a note + * @var string $text Content of the note. Supports HTML for rich text formatting. Supported tags include: `

` (paragraph), `` / `` (bold), `` / `` (italic), `` (underline), `
` (line break), `` (labelled hyperlink). Example labelled link: `Link text`. */ #[JsonProperty('text')] public string $text; diff --git a/src/Types/Order.php b/src/Types/Order.php index 44acc680..ef869a35 100644 --- a/src/Types/Order.php +++ b/src/Types/Order.php @@ -50,7 +50,7 @@ class Order extends JsonSerializableType * string * |int * |bool - * )> $metaInfo Meta data of order to store additional detal such as custom message, customer type, source. + * )> $metaInfo Meta data of order to store additional detail such as custom message, customer type, source. */ #[JsonProperty('metaInfo'), ArrayType(['string' => new Union('string', 'integer', 'bool')])] public ?array $metaInfo; diff --git a/src/Types/Pipeline.php b/src/Types/Pipeline.php index 6313bdd8..7a28ca7e 100644 --- a/src/Types/Pipeline.php +++ b/src/Types/Pipeline.php @@ -7,7 +7,7 @@ use Brevo\Core\Types\ArrayType; /** - * List of stages + * Pipeline details with stages */ class Pipeline extends JsonSerializableType { @@ -24,7 +24,7 @@ class Pipeline extends JsonSerializableType public ?string $pipelineName; /** - * @var ?array $stages List of stages + * @var ?array $stages List of pipeline stages */ #[JsonProperty('stages'), ArrayType([PipelineStagesItem::class])] public ?array $stages; diff --git a/src/Types/PipelineStagesItem.php b/src/Types/PipelineStagesItem.php index 6c9abc92..6ab8b480 100644 --- a/src/Types/PipelineStagesItem.php +++ b/src/Types/PipelineStagesItem.php @@ -6,7 +6,7 @@ use Brevo\Core\Json\JsonProperty; /** - * List of stages + * Stage details */ class PipelineStagesItem extends JsonSerializableType { diff --git a/src/Types/SendTransacSms.php b/src/Types/SendTransacSms.php index 6bdb8270..e89042a9 100644 --- a/src/Types/SendTransacSms.php +++ b/src/Types/SendTransacSms.php @@ -4,6 +4,8 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; +use Brevo\Core\Types\Union; +use Brevo\Core\Types\ArrayType; class SendTransacSms extends JsonSerializableType { @@ -14,22 +16,25 @@ class SendTransacSms extends JsonSerializableType public ?string $organisationPrefix; /** - * @var string $recipient Mobile number to send SMS with the country code + * @var string $recipient Mobile number to send SMS with the country code. Must contain between 6 and 15 digits, optionally prefixed with '+'. */ #[JsonProperty('recipient')] public string $recipient; /** - * @var string $sender Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters** + * @var string $sender Name of the sender. **The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters.** Alphanumeric sender names (up to 11 characters) must contain only letters and digits. Numeric sender names (12-15 characters) must contain only digits. */ #[JsonProperty('sender')] public string $sender; /** - * @var ?SendTransacSmsTag $tag Tag of the message + * @var ( + * string + * |array + * )|null $tag Tag of the message. Can be a single string or an array of strings (maximum 10 tags). Each tag must be a non-empty string. */ - #[JsonProperty('tag')] - public ?SendTransacSmsTag $tag; + #[JsonProperty('tag'), Union('string', ['string'], 'null')] + public string|array|null $tag; /** * @var ?value-of $type Type of the SMS. Marketing SMS messages are those sent typically with marketing content. Transactional SMS messages are sent to individuals and are triggered in response to some action, such as a sign-up, purchase, etc. @@ -49,6 +54,12 @@ class SendTransacSms extends JsonSerializableType #[JsonProperty('webUrl')] public ?string $webUrl; + /** + * @var ?array $params Pass the set of attributes to customize the template. For example, {"FNAME":"Joe", "LNAME":"Doe"}. These are the placeholder variables in the template that will be replaced with the corresponding values passed in the params object. Applicable only if `templateId` is used. + */ + #[JsonProperty('params'), ArrayType(['string' => 'mixed'])] + public ?array $params; + /** * @var ?int $templateId Template ID to send SMS with the template. When provided, overrides the content parameter. Mandatory if 'content' is not passed. */ @@ -66,10 +77,14 @@ class SendTransacSms extends JsonSerializableType * recipient: string, * sender: string, * organisationPrefix?: ?string, - * tag?: ?SendTransacSmsTag, + * tag?: ( + * string + * |array + * )|null, * type?: ?value-of, * unicodeEnabled?: ?bool, * webUrl?: ?string, + * params?: ?array, * templateId?: ?int, * content?: ?string, * } $values @@ -84,6 +99,7 @@ public function __construct( $this->type = $values['type'] ?? null; $this->unicodeEnabled = $values['unicodeEnabled'] ?? null; $this->webUrl = $values['webUrl'] ?? null; + $this->params = $values['params'] ?? null; $this->templateId = $values['templateId'] ?? null; $this->content = $values['content'] ?? null; } diff --git a/src/Types/SendTransacSmsTag.php b/src/Types/SendTransacSmsTag.php deleted file mode 100644 index 1ddbd4bc..00000000 --- a/src/Types/SendTransacSmsTag.php +++ /dev/null @@ -1,44 +0,0 @@ - - * )|null $field A tag can be a string or an array of strings. - */ - #[JsonProperty('field'), Union('string', ['string'], 'null')] - public string|array|null $field; - - /** - * @param array{ - * field?: ( - * string - * |array - * )|null, - * } $values - */ - public function __construct( - array $values = [], - ) { - $this->field = $values['field'] ?? null; - } - - /** - * @return string - */ - public function __toString(): string - { - return $this->toJson(); - } -} diff --git a/src/Types/Task.php b/src/Types/Task.php index 53cb5d44..5b7e44fd 100644 --- a/src/Types/Task.php +++ b/src/Types/Task.php @@ -5,18 +5,44 @@ use Brevo\Core\Json\JsonSerializableType; use Brevo\Core\Json\JsonProperty; use Brevo\Core\Types\ArrayType; +use DateTime; +use Brevo\Core\Types\Date; /** * Task Details */ class Task extends JsonSerializableType { + /** + * @var ?string $id Unique task id + */ + #[JsonProperty('id')] + public ?string $id; + + /** + * @var string $taskTypeId Id for type of task e.g Call / Email / Meeting etc. + */ + #[JsonProperty('taskTypeId')] + public string $taskTypeId; + + /** + * @var string $name Name of task + */ + #[JsonProperty('name')] + public string $name; + /** * @var ?array $companiesIds Companies ids for companies a task is linked to */ #[JsonProperty('companiesIds'), ArrayType(['string'])] public ?array $companiesIds; + /** + * @var ?array $dealsIds Deal ids for deals a task is linked to + */ + #[JsonProperty('dealsIds'), ArrayType(['string'])] + public ?array $dealsIds; + /** * @var ?array $contactsIds Contact ids for contacts linked to this task */ @@ -24,48 +50,72 @@ class Task extends JsonSerializableType public ?array $contactsIds; /** - * @var ?array $dealsIds Deal ids for deals a task is linked to + * @var ?string $assignToId Account id of the user assigned to this task */ - #[JsonProperty('dealsIds'), ArrayType(['string'])] - public ?array $dealsIds; + #[JsonProperty('assignToId')] + public ?string $assignToId; /** - * @var ?string $id Unique task id + * @var DateTime $date Task due date and time */ - #[JsonProperty('id')] - public ?string $id; + #[JsonProperty('date'), Date(Date::TYPE_DATETIME)] + public DateTime $date; /** - * @var string $name Name of task + * @var ?string $notes Notes added to a task */ - #[JsonProperty('name')] - public string $name; + #[JsonProperty('notes')] + public ?string $notes; /** - * @var string $taskTypeId Id for type of task e.g Call / Email / Meeting etc. + * @var ?bool $done Whether the task is marked as done */ - #[JsonProperty('taskTypeId')] - public string $taskTypeId; + #[JsonProperty('done')] + public ?bool $done; + + /** + * @var ?DateTime $createdAt Task creation date/time + */ + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; + + /** + * @var ?DateTime $updatedAt Task last update date/time + */ + #[JsonProperty('updatedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $updatedAt; /** * @param array{ - * name: string, * taskTypeId: string, + * name: string, + * date: DateTime, + * id?: ?string, * companiesIds?: ?array, - * contactsIds?: ?array, * dealsIds?: ?array, - * id?: ?string, + * contactsIds?: ?array, + * assignToId?: ?string, + * notes?: ?string, + * done?: ?bool, + * createdAt?: ?DateTime, + * updatedAt?: ?DateTime, * } $values */ public function __construct( array $values, ) { - $this->companiesIds = $values['companiesIds'] ?? null; - $this->contactsIds = $values['contactsIds'] ?? null; - $this->dealsIds = $values['dealsIds'] ?? null; $this->id = $values['id'] ?? null; - $this->name = $values['name']; $this->taskTypeId = $values['taskTypeId']; + $this->name = $values['name']; + $this->companiesIds = $values['companiesIds'] ?? null; + $this->dealsIds = $values['dealsIds'] ?? null; + $this->contactsIds = $values['contactsIds'] ?? null; + $this->assignToId = $values['assignToId'] ?? null; + $this->date = $values['date']; + $this->notes = $values['notes'] ?? null; + $this->done = $values['done'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; + $this->updatedAt = $values['updatedAt'] ?? null; } /** diff --git a/src/Types/TierGroup.php b/src/Types/TierGroup.php index 1f2bdcb8..2d96a7c5 100644 --- a/src/Types/TierGroup.php +++ b/src/Types/TierGroup.php @@ -58,6 +58,18 @@ class TierGroup extends JsonSerializableType #[JsonProperty('upgradeStrategy')] public ?string $upgradeStrategy; + /** + * @var ?TierGroupUpgradeSchedule $upgradeSchedule Schedule configuration for tier upgrades. + */ + #[JsonProperty('upgradeSchedule')] + public ?TierGroupUpgradeSchedule $upgradeSchedule; + + /** + * @var ?TierGroupDowngradeSchedule $downgradeSchedule Schedule configuration for tier downgrades. + */ + #[JsonProperty('downgradeSchedule')] + public ?TierGroupDowngradeSchedule $downgradeSchedule; + /** * @param array{ * createdAt?: ?DateTime, @@ -68,6 +80,8 @@ class TierGroup extends JsonSerializableType * tierOrder?: ?array, * updatedAt?: ?DateTime, * upgradeStrategy?: ?value-of, + * upgradeSchedule?: ?TierGroupUpgradeSchedule, + * downgradeSchedule?: ?TierGroupDowngradeSchedule, * } $values */ public function __construct( @@ -81,6 +95,8 @@ public function __construct( $this->tierOrder = $values['tierOrder'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; $this->upgradeStrategy = $values['upgradeStrategy'] ?? null; + $this->upgradeSchedule = $values['upgradeSchedule'] ?? null; + $this->downgradeSchedule = $values['downgradeSchedule'] ?? null; } /** diff --git a/src/Types/TierGroupDowngradeSchedule.php b/src/Types/TierGroupDowngradeSchedule.php new file mode 100644 index 00000000..fb14b38f --- /dev/null +++ b/src/Types/TierGroupDowngradeSchedule.php @@ -0,0 +1,69 @@ + $durationUnit Duration unit for the schedule. + */ + #[JsonProperty('durationUnit')] + public ?string $durationUnit; + + /** + * @var ?value-of $durationModifier Modifier for the duration. + */ + #[JsonProperty('durationModifier')] + public ?string $durationModifier; + + /** + * @var ?string $scheduledDate Scheduled date in DD/MM format. + */ + #[JsonProperty('scheduledDate')] + public ?string $scheduledDate; + + /** + * @param array{ + * strategy?: ?string, + * durationValue?: ?int, + * durationUnit?: ?value-of, + * durationModifier?: ?value-of, + * scheduledDate?: ?string, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->strategy = $values['strategy'] ?? null; + $this->durationValue = $values['durationValue'] ?? null; + $this->durationUnit = $values['durationUnit'] ?? null; + $this->durationModifier = $values['durationModifier'] ?? null; + $this->scheduledDate = $values['scheduledDate'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/TierGroupDowngradeScheduleDurationModifier.php b/src/Types/TierGroupDowngradeScheduleDurationModifier.php new file mode 100644 index 00000000..84d98af0 --- /dev/null +++ b/src/Types/TierGroupDowngradeScheduleDurationModifier.php @@ -0,0 +1,9 @@ + $durationUnit Duration unit for the schedule. + */ + #[JsonProperty('durationUnit')] + public ?string $durationUnit; + + /** + * @var ?value-of $durationModifier Modifier for the duration. + */ + #[JsonProperty('durationModifier')] + public ?string $durationModifier; + + /** + * @var ?string $scheduledDate Scheduled date in DD/MM format. + */ + #[JsonProperty('scheduledDate')] + public ?string $scheduledDate; + + /** + * @param array{ + * strategy?: ?string, + * durationValue?: ?int, + * durationUnit?: ?value-of, + * durationModifier?: ?value-of, + * scheduledDate?: ?string, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->strategy = $values['strategy'] ?? null; + $this->durationValue = $values['durationValue'] ?? null; + $this->durationUnit = $values['durationUnit'] ?? null; + $this->durationModifier = $values['durationModifier'] ?? null; + $this->scheduledDate = $values['scheduledDate'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/Types/TierGroupUpgradeScheduleDurationModifier.php b/src/Types/TierGroupUpgradeScheduleDurationModifier.php new file mode 100644 index 00000000..84861f27 --- /dev/null +++ b/src/Types/TierGroupUpgradeScheduleDurationModifier.php @@ -0,0 +1,9 @@ + $transactionType The type of the transaction. */ - #[JsonProperty('balanceDefinitionId')] - public ?string $balanceDefinitionId; + #[JsonProperty('transactionType')] + public ?string $transactionType; /** - * @var ?string $cancelledAt Timestamp when the transaction was canceled (nullable). + * @var ?array $meta Optional metadata associated with the transaction. */ - #[JsonProperty('cancelledAt')] - public ?string $cancelledAt; + #[JsonProperty('meta'), ArrayType(['string' => 'mixed'])] + public ?array $meta; /** - * @var ?string $completedAt Timestamp when the transaction was completed (nullable). + * @var ?value-of $status The current status of the transaction. */ - #[JsonProperty('completedAt')] - public ?string $completedAt; + #[JsonProperty('status')] + public ?string $status; /** - * @var ?int $contactId Unique identifier of the contact associated with the transaction. + * @var ?string $loyaltyProgramId Unique identifier (UUID) of the associated loyalty program. */ - #[JsonProperty('contactId')] - public ?int $contactId; + #[JsonProperty('loyaltyProgramId')] + public ?string $loyaltyProgramId; /** - * @var ?string $createdAt Timestamp when the transaction was created. + * @var ?string $balanceDefinitionId Unique identifier (UUID) of the associated balance definition. */ - #[JsonProperty('createdAt')] - public ?string $createdAt; + #[JsonProperty('balanceDefinitionId')] + public ?string $balanceDefinitionId; /** - * @var ?string $eventTime Optional timestamp indicating when the transaction event occurred. + * @var ?int $contactId Unique identifier of the contact associated with the transaction. */ - #[JsonProperty('eventTime')] - public ?string $eventTime; + #[JsonProperty('contactId')] + public ?int $contactId; /** - * @var ?string $expirationDate Expiry date of the transaction (nullable). + * @var ?DateTime $eventTime Optional timestamp indicating when the transaction event occurred (ISO 8601 format). */ - #[JsonProperty('expirationDate')] - public ?string $expirationDate; + #[JsonProperty('eventTime'), Date(Date::TYPE_DATETIME)] + public ?DateTime $eventTime; /** - * @var ?string $id Unique identifier (UUID) of the transaction. + * @var ?string $rejectReason Reason for rejection if the transaction was declined (nullable). */ - #[JsonProperty('id')] - public ?string $id; + #[JsonProperty('rejectReason')] + public ?string $rejectReason; /** - * @var ?string $loyaltyProgramId Unique identifier (UUID) of the associated loyalty program. + * @var ?DateTime $rejectedAt Timestamp when the transaction was rejected (nullable). */ - #[JsonProperty('loyaltyProgramId')] - public ?string $loyaltyProgramId; + #[JsonProperty('rejectedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $rejectedAt; /** - * @var ?array $meta Optional metadata associated with the transaction. + * @var ?DateTime $expirationDate Expiry date of the transaction (nullable). */ - #[JsonProperty('meta'), ArrayType(['string' => 'mixed'])] - public ?array $meta; + #[JsonProperty('expirationDate'), Date(Date::TYPE_DATETIME)] + public ?DateTime $expirationDate; /** - * @var ?string $rejectReason Reason for rejection if the transaction was declined (nullable). + * @var ?DateTime $completedAt Timestamp when the transaction was completed (nullable). */ - #[JsonProperty('rejectReason')] - public ?string $rejectReason; + #[JsonProperty('completedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $completedAt; /** - * @var ?string $rejectedAt Timestamp when the transaction was rejected (nullable). + * @var ?DateTime $cancelledAt Timestamp when the transaction was canceled (nullable). */ - #[JsonProperty('rejectedAt')] - public ?string $rejectedAt; + #[JsonProperty('cancelledAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $cancelledAt; /** - * @var ?string $status The current status of the transaction (e.g., pending, completed, rejected). + * @var ?DateTime $createdAt Timestamp when the transaction was created. */ - #[JsonProperty('status')] - public ?string $status; + #[JsonProperty('createdAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $createdAt; /** - * @var ?string $updatedAt Timestamp when the transaction was last updated. + * @var ?DateTime $updatedAt Timestamp when the transaction was last updated. */ - #[JsonProperty('updatedAt')] - public ?string $updatedAt; + #[JsonProperty('updatedAt'), Date(Date::TYPE_DATETIME)] + public ?DateTime $updatedAt; /** * @param array{ + * id?: ?string, * amount?: ?float, + * transactionType?: ?value-of, + * meta?: ?array, + * status?: ?value-of, + * loyaltyProgramId?: ?string, * balanceDefinitionId?: ?string, - * cancelledAt?: ?string, - * completedAt?: ?string, * contactId?: ?int, - * createdAt?: ?string, - * eventTime?: ?string, - * expirationDate?: ?string, - * id?: ?string, - * loyaltyProgramId?: ?string, - * meta?: ?array, + * eventTime?: ?DateTime, * rejectReason?: ?string, - * rejectedAt?: ?string, - * status?: ?string, - * updatedAt?: ?string, + * rejectedAt?: ?DateTime, + * expirationDate?: ?DateTime, + * completedAt?: ?DateTime, + * cancelledAt?: ?DateTime, + * createdAt?: ?DateTime, + * updatedAt?: ?DateTime, * } $values */ public function __construct( array $values = [], ) { + $this->id = $values['id'] ?? null; $this->amount = $values['amount'] ?? null; + $this->transactionType = $values['transactionType'] ?? null; + $this->meta = $values['meta'] ?? null; + $this->status = $values['status'] ?? null; + $this->loyaltyProgramId = $values['loyaltyProgramId'] ?? null; $this->balanceDefinitionId = $values['balanceDefinitionId'] ?? null; - $this->cancelledAt = $values['cancelledAt'] ?? null; - $this->completedAt = $values['completedAt'] ?? null; $this->contactId = $values['contactId'] ?? null; - $this->createdAt = $values['createdAt'] ?? null; $this->eventTime = $values['eventTime'] ?? null; - $this->expirationDate = $values['expirationDate'] ?? null; - $this->id = $values['id'] ?? null; - $this->loyaltyProgramId = $values['loyaltyProgramId'] ?? null; - $this->meta = $values['meta'] ?? null; $this->rejectReason = $values['rejectReason'] ?? null; $this->rejectedAt = $values['rejectedAt'] ?? null; - $this->status = $values['status'] ?? null; + $this->expirationDate = $values['expirationDate'] ?? null; + $this->completedAt = $values['completedAt'] ?? null; + $this->cancelledAt = $values['cancelledAt'] ?? null; + $this->createdAt = $values['createdAt'] ?? null; $this->updatedAt = $values['updatedAt'] ?? null; } diff --git a/src/Types/TransactionStatus.php b/src/Types/TransactionStatus.php new file mode 100644 index 00000000..10ce1947 --- /dev/null +++ b/src/Types/TransactionStatus.php @@ -0,0 +1,12 @@ + $action action * @param string $email Email of the invited user. * @param ?array{ @@ -426,6 +432,8 @@ public function editUserPermission(Inviteuser $request, ?array $options = null): } /** + * Retrieves the granular feature-level permissions assigned to a specific user in the organization, identified by their email address. The response includes the user''s current status (active or pending) and a detailed list of privileges specifying which features and permission levels are granted. + * * @param string $email Email of the invited user. * @param ?array{ * baseUrl?: string, diff --git a/src/User/UserClientInterface.php b/src/User/UserClientInterface.php index fa48fa26..01ca487b 100644 --- a/src/User/UserClientInterface.php +++ b/src/User/UserClientInterface.php @@ -14,6 +14,8 @@ interface UserClientInterface { /** + * Retrieves the list of all users associated with your organization, including both active and pending invited users. Each user entry includes their email address, owner status, current invitation status, and feature access levels for marketing, CRM, and conversations. + * * @param ?array{ * baseUrl?: string, * maxRetries?: int, @@ -27,6 +29,8 @@ interface UserClientInterface public function getInvitedUsersList(?array $options = null): ?GetInvitedUsersListResponse; /** + * Revokes all permissions for an invited user in the organization, effectively removing their access to the platform. If the user''s plan change generated credit notes, they are returned in the response for billing reconciliation. + * * @param string $email Email of the invited user. * @param ?array{ * baseUrl?: string, @@ -124,6 +128,8 @@ public function putRevokeUserPermission(string $email, ?array $options = null): public function inviteuser(Inviteuser $request, ?array $options = null): ?InviteuserResponse; /** + * Resends or cancels a pending invitation for a user in the organization, depending on the action path parameter. Use `resend` to send a new invitation email to the user, or `cancel` to revoke the pending invitation entirely and remove the user''s pending access. + * * @param value-of $action action * @param string $email Email of the invited user. * @param ?array{ @@ -221,6 +227,8 @@ public function putresendcancelinvitation(string $action, string $email, ?array public function editUserPermission(Inviteuser $request, ?array $options = null): ?EditUserPermissionResponse; /** + * Retrieves the granular feature-level permissions assigned to a specific user in the organization, identified by their email address. The response includes the user''s current status (active or pending) and a detailed list of privileges specifying which features and permission levels are granted. + * * @param string $email Email of the invited user. * @param ?array{ * baseUrl?: string, diff --git a/src/Webhooks/Requests/CreateWebhookRequest.php b/src/Webhooks/Requests/CreateWebhookRequest.php index d6d32619..ed988795 100644 --- a/src/Webhooks/Requests/CreateWebhookRequest.php +++ b/src/Webhooks/Requests/CreateWebhookRequest.php @@ -26,7 +26,7 @@ class CreateWebhookRequest extends JsonSerializableType public ?bool $batched; /** - * @var ?value-of $channel channel of webhook + * @var ?value-of $channel Channel of the webhook */ #[JsonProperty('channel')] public ?string $channel; @@ -47,27 +47,21 @@ class CreateWebhookRequest extends JsonSerializableType public ?string $domain; /** - * - Events triggering the webhook. Possible values for - * **Transactional** type webhook: #### `sent` OR `request`, - * `delivered`, `hardBounce`, `softBounce`, `blocked`, `spam`, - * `invalid`, `deferred`, `click`, `opened`, `uniqueOpened` and - * `unsubscribed` - Possible values for **Marketing** type webhook: - * #### `spam`, `opened`, `click`, `hardBounce`, `softBounce`, - * `unsubscribed`, `listAddition` & `delivered` - Possible values - * for **Inbound** type webhook: #### `inboundEmailProcessed` - - * Possible values for type **Transactional** and channel **SMS** - * #### - * `accepted`,`delivered`,`softBounce`,`hardBounce`,`unsubscribe`,`reply`, - * `subscribe`,`sent`,`blacklisted`,`skip` - Possible values for - * type **Marketing** channel **SMS** #### - * `sent`,`delivered`,`softBounce`,`hardBounce`,`unsubscribe`,`reply`, - * `subscribe`,`skip` - * #### `reply` + * Events triggering the webhook. Required for transactional and + * marketing types, optional for inbound type (defaults to + * `inboundEmailProcessed`). Possible values for **Transactional** + * type webhook: `sent` OR `request`, `delivered`, `hardBounce`, + * `softBounce`, `blocked`, `spam`, `invalid`, `deferred`, `click`, + * `opened`, `uniqueOpened` and `unsubscribed`. Possible values for + * **Marketing** type webhook: `spam`, `opened`, `click`, + * `hardBounce`, `softBounce`, `unsubscribed`, `listAddition`, + * `delivered`, `contactUpdated` & `contactDeleted`. Possible values + * for **Inbound** type webhook: `inboundEmailProcessed`. * - * @var array> $events + * @var ?array> $events */ #[JsonProperty('events'), ArrayType(['string'])] - public array $events; + public ?array $events; /** * @var ?array $headers Custom headers to be send with webhooks @@ -89,13 +83,13 @@ class CreateWebhookRequest extends JsonSerializableType /** * @param array{ - * events: array>, * url: string, * auth?: ?CreateWebhookRequestAuth, * batched?: ?bool, * channel?: ?value-of, * description?: ?string, * domain?: ?string, + * events?: ?array>, * headers?: ?array, * type?: ?value-of, * } $values @@ -108,7 +102,7 @@ public function __construct( $this->channel = $values['channel'] ?? null; $this->description = $values['description'] ?? null; $this->domain = $values['domain'] ?? null; - $this->events = $values['events']; + $this->events = $values['events'] ?? null; $this->headers = $values['headers'] ?? null; $this->type = $values['type'] ?? null; $this->url = $values['url']; diff --git a/src/Webhooks/Requests/ExportWebhooksHistoryRequest.php b/src/Webhooks/Requests/ExportWebhooksHistoryRequest.php index 6513c7f1..b6ffc169 100644 --- a/src/Webhooks/Requests/ExportWebhooksHistoryRequest.php +++ b/src/Webhooks/Requests/ExportWebhooksHistoryRequest.php @@ -43,10 +43,10 @@ class ExportWebhooksHistoryRequest extends JsonSerializableType * Filter the history for a specific message id. Applicable * only for transactional webhooks. * - * @var ?int $messageId + * @var ?string $messageId */ #[JsonProperty('messageId')] - public ?int $messageId; + public ?string $messageId; /** * @var string $notifyUrl Webhook URL to receive CSV file link @@ -89,7 +89,7 @@ class ExportWebhooksHistoryRequest extends JsonSerializableType * days?: ?int, * email?: ?string, * endDate?: ?string, - * messageId?: ?int, + * messageId?: ?string, * sort?: ?string, * startDate?: ?string, * webhookId?: ?int, diff --git a/src/Webhooks/Types/CreateWebhookRequestChannel.php b/src/Webhooks/Types/CreateWebhookRequestChannel.php index 48b5ab9d..09fe3ff5 100644 --- a/src/Webhooks/Types/CreateWebhookRequestChannel.php +++ b/src/Webhooks/Types/CreateWebhookRequestChannel.php @@ -4,6 +4,6 @@ enum CreateWebhookRequestChannel: string { - case Sms = "sms"; case Email = "email"; + case Sms = "sms"; } diff --git a/src/WhatsAppCampaigns/Types/GetWhatsAppCampaignResponse.php b/src/WhatsAppCampaigns/Types/GetWhatsAppCampaignResponse.php index 72ed4336..95e0702c 100644 --- a/src/WhatsAppCampaigns/Types/GetWhatsAppCampaignResponse.php +++ b/src/WhatsAppCampaigns/Types/GetWhatsAppCampaignResponse.php @@ -44,6 +44,12 @@ class GetWhatsAppCampaignResponse extends JsonSerializableType #[JsonProperty('scheduledAt')] public ?string $scheduledAt; + /** + * @var GetWhatsAppCampaignResponseRecipients $recipients Recipients of the WhatsApp Campaign + */ + #[JsonProperty('recipients')] + public GetWhatsAppCampaignResponseRecipients $recipients; + /** * @var string $senderNumber Sender of the WhatsApp Campaign */ @@ -69,6 +75,7 @@ class GetWhatsAppCampaignResponse extends JsonSerializableType * createdAt: string, * id: int, * modifiedAt: string, + * recipients: GetWhatsAppCampaignResponseRecipients, * senderNumber: string, * template: GetWhatsAppCampaignResponseTemplate, * scheduledAt?: ?string, @@ -84,6 +91,7 @@ public function __construct( $this->id = $values['id']; $this->modifiedAt = $values['modifiedAt']; $this->scheduledAt = $values['scheduledAt'] ?? null; + $this->recipients = $values['recipients']; $this->senderNumber = $values['senderNumber']; $this->stats = $values['stats'] ?? null; $this->template = $values['template']; diff --git a/src/WhatsAppCampaigns/Types/GetWhatsAppCampaignResponseRecipients.php b/src/WhatsAppCampaigns/Types/GetWhatsAppCampaignResponseRecipients.php new file mode 100644 index 00000000..2ba8a410 --- /dev/null +++ b/src/WhatsAppCampaigns/Types/GetWhatsAppCampaignResponseRecipients.php @@ -0,0 +1,62 @@ + $excludedLists List of excluded list IDs + */ + #[JsonProperty('excludedLists'), ArrayType(['integer'])] + public ?array $excludedLists; + + /** + * @var ?array $includedLists List of included list IDs + */ + #[JsonProperty('includedLists'), ArrayType(['integer'])] + public ?array $includedLists; + + /** + * @var ?array $segments List of segment IDs + */ + #[JsonProperty('segments'), ArrayType(['integer'])] + public ?array $segments; + + /** + * @var ?string $type Type of recipients (list or segment) + */ + #[JsonProperty('type')] + public ?string $type; + + /** + * @param array{ + * excludedLists?: ?array, + * includedLists?: ?array, + * segments?: ?array, + * type?: ?string, + * } $values + */ + public function __construct( + array $values = [], + ) { + $this->excludedLists = $values['excludedLists'] ?? null; + $this->includedLists = $values['includedLists'] ?? null; + $this->segments = $values['segments'] ?? null; + $this->type = $values['type'] ?? null; + } + + /** + * @return string + */ + public function __toString(): string + { + return $this->toJson(); + } +} diff --git a/src/WhatsAppCampaigns/Types/GetWhatsAppTemplatesResponseTemplatesItem.php b/src/WhatsAppCampaigns/Types/GetWhatsAppTemplatesResponseTemplatesItem.php index af72efce..7e77b6fc 100644 --- a/src/WhatsAppCampaigns/Types/GetWhatsAppTemplatesResponseTemplatesItem.php +++ b/src/WhatsAppCampaigns/Types/GetWhatsAppTemplatesResponseTemplatesItem.php @@ -55,6 +55,12 @@ class GetWhatsAppTemplatesResponseTemplatesItem extends JsonSerializableType #[JsonProperty('status')] public string $status; + /** + * @var string $type Type of the whatsApp template + */ + #[JsonProperty('type')] + public string $type; + /** * @param array{ * category: string, @@ -64,6 +70,7 @@ class GetWhatsAppTemplatesResponseTemplatesItem extends JsonSerializableType * modifiedAt: string, * name: string, * status: string, + * type: string, * errorReason?: ?string, * } $values */ @@ -78,6 +85,7 @@ public function __construct( $this->modifiedAt = $values['modifiedAt']; $this->name = $values['name']; $this->status = $values['status']; + $this->type = $values['type']; } /** diff --git a/src/WhatsAppCampaigns/WhatsAppCampaignsClient.php b/src/WhatsAppCampaigns/WhatsAppCampaignsClient.php index aa217f12..829e1d96 100644 --- a/src/WhatsAppCampaigns/WhatsAppCampaignsClient.php +++ b/src/WhatsAppCampaigns/WhatsAppCampaignsClient.php @@ -60,6 +60,8 @@ public function __construct( } /** + * Retrieve a paginated list of all your WhatsApp campaigns with their statistics and metadata. Results can be filtered by creation date range using startDate and endDate, with a default limit of 50 and maximum of 100 per page. The sort order defaults to descending by modification date. + * * @param GetWhatsAppCampaignsRequest $request * @param ?array{ * baseUrl?: string, @@ -274,6 +276,8 @@ public function createWhatsAppTemplate(CreateWhatsAppTemplateRequest $request, ? } /** + * Retrieve a paginated list of all your WhatsApp templates with their status, category, language, and metadata. Results can be filtered by creation date range and optionally by source (Automation or Conversations), with a default limit of 50 and maximum of 100 per page. The sort order defaults to descending by modification date. + * * @param GetWhatsAppTemplatesRequest $request * @param ?array{ * baseUrl?: string, @@ -481,6 +485,8 @@ public function updateWhatsAppCampaign(int $campaignId, UpdateWhatsAppCampaignRe } /** + * Delete a WhatsApp campaign by its campaign ID. The campaign must exist; if the campaign ID is not found, a 404 error is returned. This action is permanent and cannot be undone. + * * @param int $campaignId id of the campaign * @param ?array{ * baseUrl?: string, diff --git a/src/WhatsAppCampaigns/WhatsAppCampaignsClientInterface.php b/src/WhatsAppCampaigns/WhatsAppCampaignsClientInterface.php index 0817e849..91c504b2 100644 --- a/src/WhatsAppCampaigns/WhatsAppCampaignsClientInterface.php +++ b/src/WhatsAppCampaigns/WhatsAppCampaignsClientInterface.php @@ -17,6 +17,8 @@ interface WhatsAppCampaignsClientInterface { /** + * Retrieve a paginated list of all your WhatsApp campaigns with their statistics and metadata. Results can be filtered by creation date range using startDate and endDate, with a default limit of 50 and maximum of 100 per page. The sort order defaults to descending by modification date. + * * @param GetWhatsAppCampaignsRequest $request * @param ?array{ * baseUrl?: string, @@ -84,6 +86,8 @@ public function getWhatsAppConfig(?array $options = null): ?GetWhatsAppConfigRes public function createWhatsAppTemplate(CreateWhatsAppTemplateRequest $request, ?array $options = null): ?CreateWhatsAppTemplateResponse; /** + * Retrieve a paginated list of all your WhatsApp templates with their status, category, language, and metadata. Results can be filtered by creation date range and optionally by source (Automation or Conversations), with a default limit of 50 and maximum of 100 per page. The sort order defaults to descending by modification date. + * * @param GetWhatsAppTemplatesRequest $request * @param ?array{ * baseUrl?: string, @@ -154,6 +158,8 @@ public function getWhatsAppCampaign(int $campaignId, ?array $options = null): ?G public function updateWhatsAppCampaign(int $campaignId, UpdateWhatsAppCampaignRequest $request = new UpdateWhatsAppCampaignRequest(), ?array $options = null): void; /** + * Delete a WhatsApp campaign by its campaign ID. The campaign must exist; if the campaign ID is not found, a 404 error is returned. This action is permanent and cannot be undone. + * * @param int $campaignId id of the campaign * @param ?array{ * baseUrl?: string,