diff --git a/src/brevo/__init__.py b/src/brevo/__init__.py
index d7f792e..f2335be 100644
--- a/src/brevo/__init__.py
+++ b/src/brevo/__init__.py
@@ -14,7 +14,15 @@
BadRequestErrorBodyCode,
BalanceDefinition,
BalanceDefinitionBalanceAvailabilityDurationModifier,
+ BalanceDefinitionBalanceAvailabilityDurationUnit,
+ BalanceDefinitionBalanceOptionAmountOvertakingStrategy,
+ BalanceDefinitionBalanceOptionCreditRounding,
+ BalanceDefinitionBalanceOptionDebitRounding,
+ BalanceDefinitionUnit,
BalanceLimit,
+ BalanceLimitConstraintType,
+ BalanceLimitDurationUnit,
+ BalanceLimitTransactionType,
BatchAcceptedResponse,
BatchEventsResponse,
BatchEventsResponseErrorsItem,
@@ -26,6 +34,7 @@
ContactErrorModelCode,
ConversationsMessage,
ConversationsMessageAttachmentsItem,
+ ConversationsMessageAttachmentsItemImageInfo,
ConversationsMessageBccItem,
ConversationsMessageCcItem,
ConversationsMessageFile,
@@ -54,11 +63,12 @@
GetEventsList,
GetEventsListEventsItem,
GetExtendedCampaignOverview,
+ GetExtendedCampaignOverviewEmailExpirationDate,
+ GetExtendedCampaignOverviewEmailExpirationDateUnit,
GetExtendedCampaignOverviewSender,
GetExtendedCampaignOverviewStatus,
GetExtendedCampaignOverviewType,
GetExtendedCampaignStats,
- GetExtendedCampaignStatsLinksStats,
GetExtendedCampaignStatsStatsByDevice,
GetFolder,
GetList,
@@ -70,7 +80,6 @@
GetSmtpTemplateOverviewSender,
GetSsoToken,
GetWebhook,
- GetWebhookChannel,
GetWebhookType,
InternalServerErrorBody,
InternalServerErrorBodyCode,
@@ -107,7 +116,6 @@
SendTestEmail,
SendTransacSms,
SendTransacSmsTag,
- SendTransacSmsTagField,
SendTransacSmsType,
Task,
TaskReminder,
@@ -116,10 +124,18 @@
Tier,
TierAccessConditionsItem,
TierGroup,
+ TierGroupDowngradeSchedule,
+ TierGroupDowngradeScheduleDurationModifier,
+ TierGroupDowngradeScheduleDurationUnit,
TierGroupDowngradeStrategy,
+ TierGroupUpgradeSchedule,
+ TierGroupUpgradeScheduleDurationModifier,
+ TierGroupUpgradeScheduleDurationUnit,
TierGroupUpgradeStrategy,
TierTierRewardsItem,
Transaction,
+ TransactionStatus,
+ TransactionTransactionType,
UnauthorizedErrorBody,
UnauthorizedErrorBodyCode,
UpdateCampaignStatus,
@@ -184,7 +200,6 @@
GetAccountActivityResponseLogsItem,
GetAccountResponse,
GetAccountResponseAddress,
- GetAccountResponseDateTimePreferences,
GetAccountResponseMarketingAutomation,
GetAccountResponsePlanItem,
GetAccountResponsePlanItemType,
@@ -196,9 +211,11 @@
GetAccountResponseRelayData,
)
from .balance import (
+ BeginTransactionRequestTransactionType,
CreateBalanceLimitRequestConstraintType,
CreateBalanceLimitRequestDurationUnit,
CreateBalanceLimitRequestTransactionType,
+ CreateBalanceOrderRequestSource,
CreateBalanceOrderResponse,
GetBalanceDefinitionListRequestSort,
GetBalanceDefinitionListRequestSortField,
@@ -206,13 +223,19 @@
GetBalanceDefinitionListResponse,
GetBalanceDefinitionRequestVersion,
GetBalanceLimitRequestVersion,
+ GetContactBalancesRequestSort,
+ GetContactBalancesRequestSortField,
GetContactBalancesResponse,
GetContactBalancesResponseBalancesItem,
+ GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort,
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse,
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem,
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort,
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus,
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType,
GetLoyaltyBalanceProgramsPidTransactionHistoryResponse,
GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem,
+ GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType,
GetSubscriptionBalancesResponse,
GetSubscriptionBalancesResponseBalanceItem,
PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier,
@@ -239,6 +262,7 @@
GetCompaniesRequestSort,
GetCompaniesResponse,
GetCrmAttributesCompaniesResponseItem,
+ GetCrmAttributesCompaniesResponseItemAttributeOptionsItem,
PatchCrmAttributesIdRequestObjectType,
PatchCrmAttributesIdRequestOptionsLabelsItem,
PostCompaniesImportResponse,
@@ -365,19 +389,15 @@
GetrecordsResponseRecordsItemIdentifiers,
UpsertrecordsRequestRecordsItem,
UpsertrecordsRequestRecordsItemAssociationsItem,
- UpsertrecordsRequestRecordsItemAssociationsItemOne,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers,
- UpsertrecordsRequestRecordsItemAssociationsItemZero,
- UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem,
- UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers,
+ UpsertrecordsRequestRecordsItemAssociationsItemAction,
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem,
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers,
UpsertrecordsRequestRecordsItemIdentifiers,
UpsertrecordsResponse,
)
from .deals import (
GetCrmAttributesDealsResponseItem,
+ GetCrmAttributesDealsResponseItemAttributeOptionsItem,
GetCrmDealsRequestSort,
GetCrmDealsResponse,
PostCrmDealsImportResponse,
@@ -423,6 +443,7 @@
GetEcommerceConfigDisplayCurrencyResponse,
GetOrdersRequestSort,
GetProductsRequestSort,
+ GetProductsRequestSortByField,
GetProductsResponse,
SetConfigDisplayCurrencyResponse,
)
@@ -442,6 +463,8 @@
GetAbTestCampaignResultResponseWinningVersion,
GetEmailCampaignRequestStatistics,
GetEmailCampaignResponse,
+ GetEmailCampaignResponseEmailExpirationDate,
+ GetEmailCampaignResponseEmailExpirationDateUnit,
GetEmailCampaignResponseSender,
GetEmailCampaignResponseStatus,
GetEmailCampaignResponseType,
@@ -451,6 +474,8 @@
GetEmailCampaignsRequestType,
GetEmailCampaignsResponse,
GetEmailCampaignsResponseCampaignsItem,
+ GetEmailCampaignsResponseCampaignsItemEmailExpirationDate,
+ GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit,
GetEmailCampaignsResponseCampaignsItemSender,
GetEmailCampaignsResponseCampaignsItemStatus,
GetEmailCampaignsResponseCampaignsItemType,
@@ -464,12 +489,12 @@
)
from .environment import BrevoEnvironment
from .event import (
- CreateBatchEventsRequestItem,
- CreateBatchEventsRequestItemContactPropertiesValue,
- CreateBatchEventsRequestItemEventPropertiesValue,
- CreateBatchEventsRequestItemIdentifiers,
- CreateBatchEventsRequestItemObject,
- CreateBatchEventsRequestItemObjectIdentifiers,
+ CreateBatchEventsRequestEventsItem,
+ CreateBatchEventsRequestEventsItemContactPropertiesValue,
+ CreateBatchEventsRequestEventsItemEventPropertiesValue,
+ CreateBatchEventsRequestEventsItemIdentifiers,
+ CreateBatchEventsRequestEventsItemObject,
+ CreateBatchEventsRequestEventsItemObjectIdentifiers,
CreateEventRequestContactPropertiesValue,
CreateEventRequestEventPropertiesValue,
CreateEventRequestIdentifiers,
@@ -564,7 +589,6 @@
from .process import (
GetProcessResponse,
GetProcessResponseInfo,
- GetProcessResponseInfoExport,
GetProcessResponseInfoImport,
GetProcessResponseName,
GetProcessResponseStatus,
@@ -572,12 +596,12 @@
GetProcessesResponse,
GetProcessesResponseProcessesItem,
GetProcessesResponseProcessesItemInfo,
- GetProcessesResponseProcessesItemInfoExport,
GetProcessesResponseProcessesItemInfoImport,
GetProcessesResponseProcessesItemName,
GetProcessesResponseProcessesItemStatus,
)
from .program import (
+ GetLpListRequestSort,
GetLpListRequestSortField,
GetLpListResponse,
GetParameterSubscriptionInfoResponse,
@@ -633,6 +657,9 @@
CreateSmsCampaignRequestRecipients,
CreateSmsCampaignResponse,
GetSmsCampaignResponse,
+ GetSmsCampaignResponseRecipients,
+ GetSmsCampaignResponseRecipientsExclusionListsItem,
+ GetSmsCampaignResponseRecipientsListsItem,
GetSmsCampaignResponseStatus,
GetSmsCampaignsRequestSort,
GetSmsCampaignsRequestStatus,
@@ -654,15 +681,21 @@
GetCrmTasksRequestFilterStatus,
GetCrmTasksRequestSort,
GetCrmTasksResponse,
- GetCrmTasktypesResponse,
+ GetCrmTasktypesResponseItem,
PostCrmTasksResponse,
)
from .tier import (
AddSubscriptionToTierResponse,
CreateTierForTierGroupRequestAccessConditionsItem,
CreateTierForTierGroupRequestTierRewardsItem,
+ CreateTierGroupRequestDowngradeSchedule,
+ CreateTierGroupRequestDowngradeScheduleDurationModifier,
+ CreateTierGroupRequestDowngradeScheduleDurationUnit,
CreateTierGroupRequestDowngradeStrategy,
CreateTierGroupRequestMeta,
+ CreateTierGroupRequestUpgradeSchedule,
+ CreateTierGroupRequestUpgradeScheduleDurationModifier,
+ CreateTierGroupRequestUpgradeScheduleDurationUnit,
CreateTierGroupRequestUpgradeStrategy,
GetListOfTierGroupsRequestVersion,
GetListOfTierGroupsResponse,
@@ -696,6 +729,7 @@
GetSmtpReportRequestSort,
GetSmtpReportResponse,
GetSmtpReportResponseReportsItem,
+ GetSmtpTemplateRequestTemplateId,
GetSmtpTemplatesRequestSort,
GetSmtpTemplatesResponse,
GetTransacBlockedContactsRequestSort,
@@ -708,6 +742,8 @@
GetTransacEmailsListRequestSort,
GetTransacEmailsListResponse,
GetTransacEmailsListResponseTransactionalEmailsItem,
+ PostPreviewSmtpEmailTemplatesRequest,
+ PostPreviewSmtpEmailTemplatesRequestParams,
PostPreviewSmtpEmailTemplatesResponse,
SendTransacEmailRequestAttachmentItem,
SendTransacEmailRequestBccItem,
@@ -722,6 +758,7 @@
SendTransacEmailRequestToItem,
SendTransacEmailResponse,
UpdateSmtpTemplateRequestSender,
+ UpdateSmtpTemplateRequestTemplateId,
)
from .transactional_sms import (
GetSmsEventsRequestEvent,
@@ -785,6 +822,7 @@
CreateWhatsAppTemplateResponse,
GetWhatsAppCampaignResponse,
GetWhatsAppCampaignResponseCampaignStatus,
+ GetWhatsAppCampaignResponseRecipients,
GetWhatsAppCampaignResponseTemplate,
GetWhatsAppCampaignResponseTemplateComponentsItem,
GetWhatsAppCampaignsRequestSort,
@@ -818,7 +856,15 @@
"BadRequestErrorBodyCode": ".types",
"BalanceDefinition": ".types",
"BalanceDefinitionBalanceAvailabilityDurationModifier": ".types",
+ "BalanceDefinitionBalanceAvailabilityDurationUnit": ".types",
+ "BalanceDefinitionBalanceOptionAmountOvertakingStrategy": ".types",
+ "BalanceDefinitionBalanceOptionCreditRounding": ".types",
+ "BalanceDefinitionBalanceOptionDebitRounding": ".types",
+ "BalanceDefinitionUnit": ".types",
"BalanceLimit": ".types",
+ "BalanceLimitConstraintType": ".types",
+ "BalanceLimitDurationUnit": ".types",
+ "BalanceLimitTransactionType": ".types",
"BatchAcceptedResponse": ".types",
"BatchDeleteObjectRecordsRequestIdentifiers": ".custom_objects",
"BatchDeleteObjectRecordsRequestIdentifiersExtIds": ".custom_objects",
@@ -826,6 +872,7 @@
"BatchDeleteObjectRecordsResponse": ".custom_objects",
"BatchEventsResponse": ".types",
"BatchEventsResponseErrorsItem": ".types",
+ "BeginTransactionRequestTransactionType": ".balance",
"Brevo": ".client",
"BrevoEnvironment": ".environment",
"BrevoError": ".types",
@@ -837,6 +884,7 @@
"ContactErrorModelCode": ".types",
"ConversationsMessage": ".types",
"ConversationsMessageAttachmentsItem": ".types",
+ "ConversationsMessageAttachmentsItemImageInfo": ".types",
"ConversationsMessageBccItem": ".types",
"ConversationsMessageCcItem": ".types",
"ConversationsMessageFile": ".types",
@@ -854,13 +902,14 @@
"CreateBalanceLimitRequestConstraintType": ".balance",
"CreateBalanceLimitRequestDurationUnit": ".balance",
"CreateBalanceLimitRequestTransactionType": ".balance",
+ "CreateBalanceOrderRequestSource": ".balance",
"CreateBalanceOrderResponse": ".balance",
- "CreateBatchEventsRequestItem": ".event",
- "CreateBatchEventsRequestItemContactPropertiesValue": ".event",
- "CreateBatchEventsRequestItemEventPropertiesValue": ".event",
- "CreateBatchEventsRequestItemIdentifiers": ".event",
- "CreateBatchEventsRequestItemObject": ".event",
- "CreateBatchEventsRequestItemObjectIdentifiers": ".event",
+ "CreateBatchEventsRequestEventsItem": ".event",
+ "CreateBatchEventsRequestEventsItemContactPropertiesValue": ".event",
+ "CreateBatchEventsRequestEventsItemEventPropertiesValue": ".event",
+ "CreateBatchEventsRequestEventsItemIdentifiers": ".event",
+ "CreateBatchEventsRequestEventsItemObject": ".event",
+ "CreateBatchEventsRequestEventsItemObjectIdentifiers": ".event",
"CreateBatchOrderResponse": ".ecommerce",
"CreateContactRequestAttributesValue": ".contacts",
"CreateContactResponse": ".contacts",
@@ -898,8 +947,14 @@
"CreateSmtpTemplateResponse": ".transactional_emails",
"CreateTierForTierGroupRequestAccessConditionsItem": ".tier",
"CreateTierForTierGroupRequestTierRewardsItem": ".tier",
+ "CreateTierGroupRequestDowngradeSchedule": ".tier",
+ "CreateTierGroupRequestDowngradeScheduleDurationModifier": ".tier",
+ "CreateTierGroupRequestDowngradeScheduleDurationUnit": ".tier",
"CreateTierGroupRequestDowngradeStrategy": ".tier",
"CreateTierGroupRequestMeta": ".tier",
+ "CreateTierGroupRequestUpgradeSchedule": ".tier",
+ "CreateTierGroupRequestUpgradeScheduleDurationModifier": ".tier",
+ "CreateTierGroupRequestUpgradeScheduleDurationUnit": ".tier",
"CreateTierGroupRequestUpgradeStrategy": ".tier",
"CreateUpdateBatchCategoryRequestCategoriesItem": ".ecommerce",
"CreateUpdateBatchCategoryResponse": ".ecommerce",
@@ -948,7 +1003,6 @@
"GetAccountActivityResponseLogsItem": ".account",
"GetAccountResponse": ".account",
"GetAccountResponseAddress": ".account",
- "GetAccountResponseDateTimePreferences": ".account",
"GetAccountResponseMarketingAutomation": ".account",
"GetAccountResponsePlanItem": ".account",
"GetAccountResponsePlanItemType": ".account",
@@ -985,6 +1039,8 @@
"GetCodeCountResponse": ".reward",
"GetCompaniesRequestSort": ".companies",
"GetCompaniesResponse": ".companies",
+ "GetContactBalancesRequestSort": ".balance",
+ "GetContactBalancesRequestSortField": ".balance",
"GetContactBalancesResponse": ".balance",
"GetContactBalancesResponseBalancesItem": ".balance",
"GetContactDetails": ".types",
@@ -1063,7 +1119,9 @@
"GetCouponCollectionsRequestSort": ".coupons",
"GetCouponCollectionsRequestSortBy": ".coupons",
"GetCrmAttributesCompaniesResponseItem": ".companies",
+ "GetCrmAttributesCompaniesResponseItemAttributeOptionsItem": ".companies",
"GetCrmAttributesDealsResponseItem": ".deals",
+ "GetCrmAttributesDealsResponseItemAttributeOptionsItem": ".deals",
"GetCrmDealsRequestSort": ".deals",
"GetCrmDealsResponse": ".deals",
"GetCrmFilesIdResponse": ".files",
@@ -1075,7 +1133,7 @@
"GetCrmTasksRequestFilterStatus": ".tasks",
"GetCrmTasksRequestSort": ".tasks",
"GetCrmTasksResponse": ".tasks",
- "GetCrmTasktypesResponse": ".tasks",
+ "GetCrmTasktypesResponseItem": ".tasks",
"GetDeviceBrowserStats": ".types",
"GetDomainConfigurationResponse": ".domains",
"GetDomainConfigurationResponseDnsRecords": ".domains",
@@ -1096,6 +1154,8 @@
"GetEcommerceConfigDisplayCurrencyResponse": ".ecommerce",
"GetEmailCampaignRequestStatistics": ".email_campaigns",
"GetEmailCampaignResponse": ".email_campaigns",
+ "GetEmailCampaignResponseEmailExpirationDate": ".email_campaigns",
+ "GetEmailCampaignResponseEmailExpirationDateUnit": ".email_campaigns",
"GetEmailCampaignResponseSender": ".email_campaigns",
"GetEmailCampaignResponseStatus": ".email_campaigns",
"GetEmailCampaignResponseType": ".email_campaigns",
@@ -1105,6 +1165,8 @@
"GetEmailCampaignsRequestType": ".email_campaigns",
"GetEmailCampaignsResponse": ".email_campaigns",
"GetEmailCampaignsResponseCampaignsItem": ".email_campaigns",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDate": ".email_campaigns",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit": ".email_campaigns",
"GetEmailCampaignsResponseCampaignsItemSender": ".email_campaigns",
"GetEmailCampaignsResponseCampaignsItemStatus": ".email_campaigns",
"GetEmailCampaignsResponseCampaignsItemType": ".email_campaigns",
@@ -1116,11 +1178,12 @@
"GetEventsList": ".types",
"GetEventsListEventsItem": ".types",
"GetExtendedCampaignOverview": ".types",
+ "GetExtendedCampaignOverviewEmailExpirationDate": ".types",
+ "GetExtendedCampaignOverviewEmailExpirationDateUnit": ".types",
"GetExtendedCampaignOverviewSender": ".types",
"GetExtendedCampaignOverviewStatus": ".types",
"GetExtendedCampaignOverviewType": ".types",
"GetExtendedCampaignStats": ".types",
- "GetExtendedCampaignStatsLinksStats": ".types",
"GetExtendedCampaignStatsStatsByDevice": ".types",
"GetExternalFeedByUuidResponse": ".external_feeds",
"GetExternalFeedByUuidResponseAuthType": ".external_feeds",
@@ -1152,11 +1215,15 @@
"GetListsRequestSort": ".contacts",
"GetListsResponse": ".contacts",
"GetListsResponseListsItem": ".contacts",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort": ".balance",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponse": ".balance",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem": ".balance",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort": ".balance",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus": ".balance",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType": ".balance",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponse": ".balance",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem": ".balance",
+ "GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType": ".balance",
"GetLoyaltyOfferProgramsPidOffersRequestVersion": ".reward",
"GetLoyaltyOfferProgramsPidOffersResponse": ".reward",
"GetLoyaltyOfferProgramsPidOffersResponseItemsItem": ".reward",
@@ -1177,6 +1244,7 @@
"GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem": ".reward",
"GetLoyaltyProgramTierRequestVersion": ".tier",
"GetLoyaltyProgramTierResponse": ".tier",
+ "GetLpListRequestSort": ".program",
"GetLpListRequestSortField": ".program",
"GetLpListResponse": ".program",
"GetOrdersRequestSort": ".ecommerce",
@@ -1190,7 +1258,6 @@
"GetPaymentRequestResponseStatus": ".payments",
"GetProcessResponse": ".process",
"GetProcessResponseInfo": ".process",
- "GetProcessResponseInfoExport": ".process",
"GetProcessResponseInfoImport": ".process",
"GetProcessResponseName": ".process",
"GetProcessResponseStatus": ".process",
@@ -1198,12 +1265,12 @@
"GetProcessesResponse": ".process",
"GetProcessesResponseProcessesItem": ".process",
"GetProcessesResponseProcessesItemInfo": ".process",
- "GetProcessesResponseProcessesItemInfoExport": ".process",
"GetProcessesResponseProcessesItemInfoImport": ".process",
"GetProcessesResponseProcessesItemName": ".process",
"GetProcessesResponseProcessesItemStatus": ".process",
"GetProductDetails": ".types",
"GetProductsRequestSort": ".ecommerce",
+ "GetProductsRequestSortByField": ".ecommerce",
"GetProductsResponse": ".ecommerce",
"GetScheduledEmailByIdRequestSort": ".transactional_emails",
"GetScheduledEmailByIdRequestStatus": ".transactional_emails",
@@ -1223,6 +1290,9 @@
"GetSmsCampaignOverview": ".types",
"GetSmsCampaignOverviewStatus": ".types",
"GetSmsCampaignResponse": ".sms_campaigns",
+ "GetSmsCampaignResponseRecipients": ".sms_campaigns",
+ "GetSmsCampaignResponseRecipientsExclusionListsItem": ".sms_campaigns",
+ "GetSmsCampaignResponseRecipientsListsItem": ".sms_campaigns",
"GetSmsCampaignResponseStatus": ".sms_campaigns",
"GetSmsCampaignStats": ".types",
"GetSmsCampaignsRequestSort": ".sms_campaigns",
@@ -1244,6 +1314,7 @@
"GetSmtpReportResponseReportsItem": ".transactional_emails",
"GetSmtpTemplateOverview": ".types",
"GetSmtpTemplateOverviewSender": ".types",
+ "GetSmtpTemplateRequestTemplateId": ".transactional_emails",
"GetSmtpTemplatesRequestSort": ".transactional_emails",
"GetSmtpTemplatesResponse": ".transactional_emails",
"GetSsoToken": ".types",
@@ -1268,13 +1339,13 @@
"GetUserPermissionResponse": ".user",
"GetUserPermissionResponsePrivilegesItem": ".user",
"GetWebhook": ".types",
- "GetWebhookChannel": ".types",
"GetWebhookType": ".types",
"GetWebhooksRequestSort": ".webhooks",
"GetWebhooksRequestType": ".webhooks",
"GetWebhooksResponse": ".webhooks",
"GetWhatsAppCampaignResponse": ".whats_app_campaigns",
"GetWhatsAppCampaignResponseCampaignStatus": ".whats_app_campaigns",
+ "GetWhatsAppCampaignResponseRecipients": ".whats_app_campaigns",
"GetWhatsAppCampaignResponseTemplate": ".whats_app_campaigns",
"GetWhatsAppCampaignResponseTemplateComponentsItem": ".whats_app_campaigns",
"GetWhatsAppCampaignsRequestSort": ".whats_app_campaigns",
@@ -1374,6 +1445,8 @@
"PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestMeta": ".balance",
"PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestUnit": ".balance",
"PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse": ".balance",
+ "PostPreviewSmtpEmailTemplatesRequest": ".transactional_emails",
+ "PostPreviewSmtpEmailTemplatesRequestParams": ".transactional_emails",
"PostPreviewSmtpEmailTemplatesResponse": ".transactional_emails",
"PostSendFailed": ".types",
"PreconditionFailedError": ".errors",
@@ -1428,7 +1501,6 @@
"SendTransacSms": ".types",
"SendTransacSmsResponse": ".transactional_sms",
"SendTransacSmsTag": ".types",
- "SendTransacSmsTagField": ".types",
"SendTransacSmsType": ".types",
"SendWhatsappMessageRequest": ".transactional_whats_app",
"SendWhatsappMessageRequestParams": ".transactional_whats_app",
@@ -1444,12 +1516,20 @@
"Tier": ".types",
"TierAccessConditionsItem": ".types",
"TierGroup": ".types",
+ "TierGroupDowngradeSchedule": ".types",
+ "TierGroupDowngradeScheduleDurationModifier": ".types",
+ "TierGroupDowngradeScheduleDurationUnit": ".types",
"TierGroupDowngradeStrategy": ".types",
+ "TierGroupUpgradeSchedule": ".types",
+ "TierGroupUpgradeScheduleDurationModifier": ".types",
+ "TierGroupUpgradeScheduleDurationUnit": ".types",
"TierGroupUpgradeStrategy": ".types",
"TierTierRewardsItem": ".types",
"TooEarlyError": ".errors",
"TooManyRequestsError": ".errors",
"Transaction": ".types",
+ "TransactionStatus": ".types",
+ "TransactionTransactionType": ".types",
"UnauthorizedError": ".errors",
"UnauthorizedErrorBody": ".types",
"UnauthorizedErrorBodyCode": ".types",
@@ -1484,6 +1564,7 @@
"UpdateSenderRequestIpsItem": ".senders",
"UpdateSmsCampaignRequestRecipients": ".sms_campaigns",
"UpdateSmtpTemplateRequestSender": ".transactional_emails",
+ "UpdateSmtpTemplateRequestTemplateId": ".transactional_emails",
"UpdateTierGroupRequestDowngradeStrategy": ".tier",
"UpdateTierGroupRequestMeta": ".tier",
"UpdateTierGroupRequestUpgradeStrategy": ".tier",
@@ -1497,14 +1578,9 @@
"UploadImageToGalleryResponse": ".email_campaigns",
"UpsertrecordsRequestRecordsItem": ".custom_objects",
"UpsertrecordsRequestRecordsItemAssociationsItem": ".custom_objects",
- "UpsertrecordsRequestRecordsItemAssociationsItemOne": ".custom_objects",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem": ".custom_objects",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne": ".custom_objects",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero": ".custom_objects",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers": ".custom_objects",
- "UpsertrecordsRequestRecordsItemAssociationsItemZero": ".custom_objects",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem": ".custom_objects",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers": ".custom_objects",
+ "UpsertrecordsRequestRecordsItemAssociationsItemAction": ".custom_objects",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem": ".custom_objects",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers": ".custom_objects",
"UpsertrecordsRequestRecordsItemIdentifiers": ".custom_objects",
"UpsertrecordsResponse": ".custom_objects",
"ValidateRewardResponse": ".reward",
@@ -1584,7 +1660,15 @@ def __dir__():
"BadRequestErrorBodyCode",
"BalanceDefinition",
"BalanceDefinitionBalanceAvailabilityDurationModifier",
+ "BalanceDefinitionBalanceAvailabilityDurationUnit",
+ "BalanceDefinitionBalanceOptionAmountOvertakingStrategy",
+ "BalanceDefinitionBalanceOptionCreditRounding",
+ "BalanceDefinitionBalanceOptionDebitRounding",
+ "BalanceDefinitionUnit",
"BalanceLimit",
+ "BalanceLimitConstraintType",
+ "BalanceLimitDurationUnit",
+ "BalanceLimitTransactionType",
"BatchAcceptedResponse",
"BatchDeleteObjectRecordsRequestIdentifiers",
"BatchDeleteObjectRecordsRequestIdentifiersExtIds",
@@ -1592,6 +1676,7 @@ def __dir__():
"BatchDeleteObjectRecordsResponse",
"BatchEventsResponse",
"BatchEventsResponseErrorsItem",
+ "BeginTransactionRequestTransactionType",
"Brevo",
"BrevoEnvironment",
"BrevoError",
@@ -1603,6 +1688,7 @@ def __dir__():
"ContactErrorModelCode",
"ConversationsMessage",
"ConversationsMessageAttachmentsItem",
+ "ConversationsMessageAttachmentsItemImageInfo",
"ConversationsMessageBccItem",
"ConversationsMessageCcItem",
"ConversationsMessageFile",
@@ -1620,13 +1706,14 @@ def __dir__():
"CreateBalanceLimitRequestConstraintType",
"CreateBalanceLimitRequestDurationUnit",
"CreateBalanceLimitRequestTransactionType",
+ "CreateBalanceOrderRequestSource",
"CreateBalanceOrderResponse",
- "CreateBatchEventsRequestItem",
- "CreateBatchEventsRequestItemContactPropertiesValue",
- "CreateBatchEventsRequestItemEventPropertiesValue",
- "CreateBatchEventsRequestItemIdentifiers",
- "CreateBatchEventsRequestItemObject",
- "CreateBatchEventsRequestItemObjectIdentifiers",
+ "CreateBatchEventsRequestEventsItem",
+ "CreateBatchEventsRequestEventsItemContactPropertiesValue",
+ "CreateBatchEventsRequestEventsItemEventPropertiesValue",
+ "CreateBatchEventsRequestEventsItemIdentifiers",
+ "CreateBatchEventsRequestEventsItemObject",
+ "CreateBatchEventsRequestEventsItemObjectIdentifiers",
"CreateBatchOrderResponse",
"CreateContactRequestAttributesValue",
"CreateContactResponse",
@@ -1664,8 +1751,14 @@ def __dir__():
"CreateSmtpTemplateResponse",
"CreateTierForTierGroupRequestAccessConditionsItem",
"CreateTierForTierGroupRequestTierRewardsItem",
+ "CreateTierGroupRequestDowngradeSchedule",
+ "CreateTierGroupRequestDowngradeScheduleDurationModifier",
+ "CreateTierGroupRequestDowngradeScheduleDurationUnit",
"CreateTierGroupRequestDowngradeStrategy",
"CreateTierGroupRequestMeta",
+ "CreateTierGroupRequestUpgradeSchedule",
+ "CreateTierGroupRequestUpgradeScheduleDurationModifier",
+ "CreateTierGroupRequestUpgradeScheduleDurationUnit",
"CreateTierGroupRequestUpgradeStrategy",
"CreateUpdateBatchCategoryRequestCategoriesItem",
"CreateUpdateBatchCategoryResponse",
@@ -1714,7 +1807,6 @@ def __dir__():
"GetAccountActivityResponseLogsItem",
"GetAccountResponse",
"GetAccountResponseAddress",
- "GetAccountResponseDateTimePreferences",
"GetAccountResponseMarketingAutomation",
"GetAccountResponsePlanItem",
"GetAccountResponsePlanItemType",
@@ -1751,6 +1843,8 @@ def __dir__():
"GetCodeCountResponse",
"GetCompaniesRequestSort",
"GetCompaniesResponse",
+ "GetContactBalancesRequestSort",
+ "GetContactBalancesRequestSortField",
"GetContactBalancesResponse",
"GetContactBalancesResponseBalancesItem",
"GetContactDetails",
@@ -1829,7 +1923,9 @@ def __dir__():
"GetCouponCollectionsRequestSort",
"GetCouponCollectionsRequestSortBy",
"GetCrmAttributesCompaniesResponseItem",
+ "GetCrmAttributesCompaniesResponseItemAttributeOptionsItem",
"GetCrmAttributesDealsResponseItem",
+ "GetCrmAttributesDealsResponseItemAttributeOptionsItem",
"GetCrmDealsRequestSort",
"GetCrmDealsResponse",
"GetCrmFilesIdResponse",
@@ -1841,7 +1937,7 @@ def __dir__():
"GetCrmTasksRequestFilterStatus",
"GetCrmTasksRequestSort",
"GetCrmTasksResponse",
- "GetCrmTasktypesResponse",
+ "GetCrmTasktypesResponseItem",
"GetDeviceBrowserStats",
"GetDomainConfigurationResponse",
"GetDomainConfigurationResponseDnsRecords",
@@ -1862,6 +1958,8 @@ def __dir__():
"GetEcommerceConfigDisplayCurrencyResponse",
"GetEmailCampaignRequestStatistics",
"GetEmailCampaignResponse",
+ "GetEmailCampaignResponseEmailExpirationDate",
+ "GetEmailCampaignResponseEmailExpirationDateUnit",
"GetEmailCampaignResponseSender",
"GetEmailCampaignResponseStatus",
"GetEmailCampaignResponseType",
@@ -1871,6 +1969,8 @@ def __dir__():
"GetEmailCampaignsRequestType",
"GetEmailCampaignsResponse",
"GetEmailCampaignsResponseCampaignsItem",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDate",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit",
"GetEmailCampaignsResponseCampaignsItemSender",
"GetEmailCampaignsResponseCampaignsItemStatus",
"GetEmailCampaignsResponseCampaignsItemType",
@@ -1882,11 +1982,12 @@ def __dir__():
"GetEventsList",
"GetEventsListEventsItem",
"GetExtendedCampaignOverview",
+ "GetExtendedCampaignOverviewEmailExpirationDate",
+ "GetExtendedCampaignOverviewEmailExpirationDateUnit",
"GetExtendedCampaignOverviewSender",
"GetExtendedCampaignOverviewStatus",
"GetExtendedCampaignOverviewType",
"GetExtendedCampaignStats",
- "GetExtendedCampaignStatsLinksStats",
"GetExtendedCampaignStatsStatsByDevice",
"GetExternalFeedByUuidResponse",
"GetExternalFeedByUuidResponseAuthType",
@@ -1918,11 +2019,15 @@ def __dir__():
"GetListsRequestSort",
"GetListsResponse",
"GetListsResponseListsItem",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponse",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponse",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem",
+ "GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType",
"GetLoyaltyOfferProgramsPidOffersRequestVersion",
"GetLoyaltyOfferProgramsPidOffersResponse",
"GetLoyaltyOfferProgramsPidOffersResponseItemsItem",
@@ -1943,6 +2048,7 @@ def __dir__():
"GetLoyaltyOfferProgramsPidVouchersResponseContactRewardsItem",
"GetLoyaltyProgramTierRequestVersion",
"GetLoyaltyProgramTierResponse",
+ "GetLpListRequestSort",
"GetLpListRequestSortField",
"GetLpListResponse",
"GetOrdersRequestSort",
@@ -1956,7 +2062,6 @@ def __dir__():
"GetPaymentRequestResponseStatus",
"GetProcessResponse",
"GetProcessResponseInfo",
- "GetProcessResponseInfoExport",
"GetProcessResponseInfoImport",
"GetProcessResponseName",
"GetProcessResponseStatus",
@@ -1964,12 +2069,12 @@ def __dir__():
"GetProcessesResponse",
"GetProcessesResponseProcessesItem",
"GetProcessesResponseProcessesItemInfo",
- "GetProcessesResponseProcessesItemInfoExport",
"GetProcessesResponseProcessesItemInfoImport",
"GetProcessesResponseProcessesItemName",
"GetProcessesResponseProcessesItemStatus",
"GetProductDetails",
"GetProductsRequestSort",
+ "GetProductsRequestSortByField",
"GetProductsResponse",
"GetScheduledEmailByIdRequestSort",
"GetScheduledEmailByIdRequestStatus",
@@ -1989,6 +2094,9 @@ def __dir__():
"GetSmsCampaignOverview",
"GetSmsCampaignOverviewStatus",
"GetSmsCampaignResponse",
+ "GetSmsCampaignResponseRecipients",
+ "GetSmsCampaignResponseRecipientsExclusionListsItem",
+ "GetSmsCampaignResponseRecipientsListsItem",
"GetSmsCampaignResponseStatus",
"GetSmsCampaignStats",
"GetSmsCampaignsRequestSort",
@@ -2010,6 +2118,7 @@ def __dir__():
"GetSmtpReportResponseReportsItem",
"GetSmtpTemplateOverview",
"GetSmtpTemplateOverviewSender",
+ "GetSmtpTemplateRequestTemplateId",
"GetSmtpTemplatesRequestSort",
"GetSmtpTemplatesResponse",
"GetSsoToken",
@@ -2034,13 +2143,13 @@ def __dir__():
"GetUserPermissionResponse",
"GetUserPermissionResponsePrivilegesItem",
"GetWebhook",
- "GetWebhookChannel",
"GetWebhookType",
"GetWebhooksRequestSort",
"GetWebhooksRequestType",
"GetWebhooksResponse",
"GetWhatsAppCampaignResponse",
"GetWhatsAppCampaignResponseCampaignStatus",
+ "GetWhatsAppCampaignResponseRecipients",
"GetWhatsAppCampaignResponseTemplate",
"GetWhatsAppCampaignResponseTemplateComponentsItem",
"GetWhatsAppCampaignsRequestSort",
@@ -2140,6 +2249,8 @@ def __dir__():
"PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestMeta",
"PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestUnit",
"PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse",
+ "PostPreviewSmtpEmailTemplatesRequest",
+ "PostPreviewSmtpEmailTemplatesRequestParams",
"PostPreviewSmtpEmailTemplatesResponse",
"PostSendFailed",
"PreconditionFailedError",
@@ -2194,7 +2305,6 @@ def __dir__():
"SendTransacSms",
"SendTransacSmsResponse",
"SendTransacSmsTag",
- "SendTransacSmsTagField",
"SendTransacSmsType",
"SendWhatsappMessageRequest",
"SendWhatsappMessageRequestParams",
@@ -2210,12 +2320,20 @@ def __dir__():
"Tier",
"TierAccessConditionsItem",
"TierGroup",
+ "TierGroupDowngradeSchedule",
+ "TierGroupDowngradeScheduleDurationModifier",
+ "TierGroupDowngradeScheduleDurationUnit",
"TierGroupDowngradeStrategy",
+ "TierGroupUpgradeSchedule",
+ "TierGroupUpgradeScheduleDurationModifier",
+ "TierGroupUpgradeScheduleDurationUnit",
"TierGroupUpgradeStrategy",
"TierTierRewardsItem",
"TooEarlyError",
"TooManyRequestsError",
"Transaction",
+ "TransactionStatus",
+ "TransactionTransactionType",
"UnauthorizedError",
"UnauthorizedErrorBody",
"UnauthorizedErrorBodyCode",
@@ -2250,6 +2368,7 @@ def __dir__():
"UpdateSenderRequestIpsItem",
"UpdateSmsCampaignRequestRecipients",
"UpdateSmtpTemplateRequestSender",
+ "UpdateSmtpTemplateRequestTemplateId",
"UpdateTierGroupRequestDowngradeStrategy",
"UpdateTierGroupRequestMeta",
"UpdateTierGroupRequestUpgradeStrategy",
@@ -2263,14 +2382,9 @@ def __dir__():
"UploadImageToGalleryResponse",
"UpsertrecordsRequestRecordsItem",
"UpsertrecordsRequestRecordsItemAssociationsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemOne",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers",
- "UpsertrecordsRequestRecordsItemAssociationsItemZero",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers",
+ "UpsertrecordsRequestRecordsItemAssociationsItemAction",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers",
"UpsertrecordsRequestRecordsItemIdentifiers",
"UpsertrecordsResponse",
"ValidateRewardResponse",
diff --git a/src/brevo/account/__init__.py b/src/brevo/account/__init__.py
index bd2e80f..426a9f0 100644
--- a/src/brevo/account/__init__.py
+++ b/src/brevo/account/__init__.py
@@ -11,7 +11,6 @@
GetAccountActivityResponseLogsItem,
GetAccountResponse,
GetAccountResponseAddress,
- GetAccountResponseDateTimePreferences,
GetAccountResponseMarketingAutomation,
GetAccountResponsePlanItem,
GetAccountResponsePlanItemType,
@@ -27,7 +26,6 @@
"GetAccountActivityResponseLogsItem": ".types",
"GetAccountResponse": ".types",
"GetAccountResponseAddress": ".types",
- "GetAccountResponseDateTimePreferences": ".types",
"GetAccountResponseMarketingAutomation": ".types",
"GetAccountResponsePlanItem": ".types",
"GetAccountResponsePlanItemType": ".types",
@@ -66,7 +64,6 @@ def __dir__():
"GetAccountActivityResponseLogsItem",
"GetAccountResponse",
"GetAccountResponseAddress",
- "GetAccountResponseDateTimePreferences",
"GetAccountResponseMarketingAutomation",
"GetAccountResponsePlanItem",
"GetAccountResponsePlanItemType",
diff --git a/src/brevo/account/client.py b/src/brevo/account/client.py
index 8813e7c..2cb9dba 100644
--- a/src/brevo/account/client.py
+++ b/src/brevo/account/client.py
@@ -33,25 +33,22 @@ def get_account(self, *, request_options: typing.Optional[RequestOptions] = None
- 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
Parameters
@@ -179,25 +176,22 @@ async def get_account(self, *, request_options: typing.Optional[RequestOptions]
- 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
Parameters
diff --git a/src/brevo/account/raw_client.py b/src/brevo/account/raw_client.py
index 2c565c5..df2c626 100644
--- a/src/brevo/account/raw_client.py
+++ b/src/brevo/account/raw_client.py
@@ -30,25 +30,22 @@ def get_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
Parameters
@@ -76,6 +73,17 @@ def get_account(
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -202,25 +210,22 @@ async def get_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
Parameters
@@ -248,6 +253,17 @@ async def get_account(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
diff --git a/src/brevo/account/types/__init__.py b/src/brevo/account/types/__init__.py
index 03fbdfa..118a1b9 100644
--- a/src/brevo/account/types/__init__.py
+++ b/src/brevo/account/types/__init__.py
@@ -10,7 +10,6 @@
from .get_account_activity_response_logs_item import GetAccountActivityResponseLogsItem
from .get_account_response import GetAccountResponse
from .get_account_response_address import GetAccountResponseAddress
- from .get_account_response_date_time_preferences import GetAccountResponseDateTimePreferences
from .get_account_response_marketing_automation import GetAccountResponseMarketingAutomation
from .get_account_response_plan_item import GetAccountResponsePlanItem
from .get_account_response_plan_item_type import GetAccountResponsePlanItemType
@@ -25,7 +24,6 @@
"GetAccountActivityResponseLogsItem": ".get_account_activity_response_logs_item",
"GetAccountResponse": ".get_account_response",
"GetAccountResponseAddress": ".get_account_response_address",
- "GetAccountResponseDateTimePreferences": ".get_account_response_date_time_preferences",
"GetAccountResponseMarketingAutomation": ".get_account_response_marketing_automation",
"GetAccountResponsePlanItem": ".get_account_response_plan_item",
"GetAccountResponsePlanItemType": ".get_account_response_plan_item_type",
@@ -64,7 +62,6 @@ def __dir__():
"GetAccountActivityResponseLogsItem",
"GetAccountResponse",
"GetAccountResponseAddress",
- "GetAccountResponseDateTimePreferences",
"GetAccountResponseMarketingAutomation",
"GetAccountResponsePlanItem",
"GetAccountResponsePlanItemType",
diff --git a/src/brevo/account/types/get_account_response.py b/src/brevo/account/types/get_account_response.py
index fa09825..7c1a18b 100644
--- a/src/brevo/account/types/get_account_response.py
+++ b/src/brevo/account/types/get_account_response.py
@@ -8,7 +8,6 @@
from ...core.serialization import FieldMetadata
from ...core.unchecked_base_model import UncheckedBaseModel
from .get_account_response_address import GetAccountResponseAddress
-from .get_account_response_date_time_preferences import GetAccountResponseDateTimePreferences
from .get_account_response_marketing_automation import GetAccountResponseMarketingAutomation
from .get_account_response_plan_item import GetAccountResponsePlanItem
from .get_account_response_plan_verticals_item import GetAccountResponsePlanVerticalsItem
@@ -45,16 +44,11 @@ class GetAccountResponse(UncheckedBaseModel):
last_name: typing_extensions.Annotated[
str, FieldMetadata(alias="lastName"), pydantic.Field(alias="lastName", description="Last Name")
]
- address: GetAccountResponseAddress = pydantic.Field()
+ address: typing.Optional[GetAccountResponseAddress] = pydantic.Field(default=None)
"""
Address informations
"""
- date_time_preferences: typing_extensions.Annotated[
- GetAccountResponseDateTimePreferences,
- FieldMetadata(alias="dateTimePreferences"),
- pydantic.Field(alias="dateTimePreferences", description="User's date and time preferences"),
- ]
marketing_automation: typing_extensions.Annotated[
typing.Optional[GetAccountResponseMarketingAutomation],
FieldMetadata(alias="marketingAutomation"),
diff --git a/src/brevo/account/types/get_account_response_date_time_preferences.py b/src/brevo/account/types/get_account_response_date_time_preferences.py
deleted file mode 100644
index 61a06a8..0000000
--- a/src/brevo/account/types/get_account_response_date_time_preferences.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-import typing_extensions
-from ...core.pydantic_utilities import IS_PYDANTIC_V2
-from ...core.serialization import FieldMetadata
-from ...core.unchecked_base_model import UncheckedBaseModel
-
-
-class GetAccountResponseDateTimePreferences(UncheckedBaseModel):
- """
- User's date and time preferences
- """
-
- timezone: str = pydantic.Field()
- """
- User's timezone setting
- """
-
- time_format: typing_extensions.Annotated[
- str,
- FieldMetadata(alias="timeFormat"),
- pydantic.Field(alias="timeFormat", description="Preferred time format (12 or 24 hour)"),
- ]
- date_format: typing_extensions.Annotated[
- str, FieldMetadata(alias="dateFormat"), pydantic.Field(alias="dateFormat", description="Preferred date format")
- ]
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/brevo/account/types/get_account_response_plan_verticals_item.py b/src/brevo/account/types/get_account_response_plan_verticals_item.py
index d94a27b..63efd8a 100644
--- a/src/brevo/account/types/get_account_response_plan_verticals_item.py
+++ b/src/brevo/account/types/get_account_response_plan_verticals_item.py
@@ -34,15 +34,15 @@ class GetAccountResponsePlanVerticalsItem(UncheckedBaseModel):
"""
start_date: typing_extensions.Annotated[
- str,
+ typing.Optional[str],
FieldMetadata(alias="startDate"),
pydantic.Field(alias="startDate", description="Plan start date (Unix timestamp)"),
- ]
+ ] = None
end_date: typing_extensions.Annotated[
- str,
+ typing.Optional[str],
FieldMetadata(alias="endDate"),
pydantic.Field(alias="endDate", description="Plan end date (Unix timestamp)"),
- ]
+ ] = None
users: typing.Optional[GetAccountResponsePlanVerticalsItemUsers] = pydantic.Field(default=None)
"""
User seat information for the plan
diff --git a/src/brevo/balance/__init__.py b/src/brevo/balance/__init__.py
index 5ba917c..4be6d1c 100644
--- a/src/brevo/balance/__init__.py
+++ b/src/brevo/balance/__init__.py
@@ -7,9 +7,11 @@
if typing.TYPE_CHECKING:
from .types import (
+ BeginTransactionRequestTransactionType,
CreateBalanceLimitRequestConstraintType,
CreateBalanceLimitRequestDurationUnit,
CreateBalanceLimitRequestTransactionType,
+ CreateBalanceOrderRequestSource,
CreateBalanceOrderResponse,
GetBalanceDefinitionListRequestSort,
GetBalanceDefinitionListRequestSortField,
@@ -17,13 +19,19 @@
GetBalanceDefinitionListResponse,
GetBalanceDefinitionRequestVersion,
GetBalanceLimitRequestVersion,
+ GetContactBalancesRequestSort,
+ GetContactBalancesRequestSortField,
GetContactBalancesResponse,
GetContactBalancesResponseBalancesItem,
+ GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort,
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse,
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem,
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort,
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus,
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType,
GetLoyaltyBalanceProgramsPidTransactionHistoryResponse,
GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem,
+ GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType,
GetSubscriptionBalancesResponse,
GetSubscriptionBalancesResponseBalanceItem,
PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier,
@@ -46,9 +54,11 @@
UpdateBalanceLimitRequestTransactionType,
)
_dynamic_imports: typing.Dict[str, str] = {
+ "BeginTransactionRequestTransactionType": ".types",
"CreateBalanceLimitRequestConstraintType": ".types",
"CreateBalanceLimitRequestDurationUnit": ".types",
"CreateBalanceLimitRequestTransactionType": ".types",
+ "CreateBalanceOrderRequestSource": ".types",
"CreateBalanceOrderResponse": ".types",
"GetBalanceDefinitionListRequestSort": ".types",
"GetBalanceDefinitionListRequestSortField": ".types",
@@ -56,13 +66,19 @@
"GetBalanceDefinitionListResponse": ".types",
"GetBalanceDefinitionRequestVersion": ".types",
"GetBalanceLimitRequestVersion": ".types",
+ "GetContactBalancesRequestSort": ".types",
+ "GetContactBalancesRequestSortField": ".types",
"GetContactBalancesResponse": ".types",
"GetContactBalancesResponseBalancesItem": ".types",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort": ".types",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponse": ".types",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem": ".types",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort": ".types",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus": ".types",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType": ".types",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponse": ".types",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem": ".types",
+ "GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType": ".types",
"GetSubscriptionBalancesResponse": ".types",
"GetSubscriptionBalancesResponseBalanceItem": ".types",
"PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier": ".types",
@@ -108,9 +124,11 @@ def __dir__():
__all__ = [
+ "BeginTransactionRequestTransactionType",
"CreateBalanceLimitRequestConstraintType",
"CreateBalanceLimitRequestDurationUnit",
"CreateBalanceLimitRequestTransactionType",
+ "CreateBalanceOrderRequestSource",
"CreateBalanceOrderResponse",
"GetBalanceDefinitionListRequestSort",
"GetBalanceDefinitionListRequestSortField",
@@ -118,13 +136,19 @@ def __dir__():
"GetBalanceDefinitionListResponse",
"GetBalanceDefinitionRequestVersion",
"GetBalanceLimitRequestVersion",
+ "GetContactBalancesRequestSort",
+ "GetContactBalancesRequestSortField",
"GetContactBalancesResponse",
"GetContactBalancesResponseBalancesItem",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponse",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponse",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem",
+ "GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType",
"GetSubscriptionBalancesResponse",
"GetSubscriptionBalancesResponseBalanceItem",
"PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier",
diff --git a/src/brevo/balance/client.py b/src/brevo/balance/client.py
index 8b2ed58..bd0989e 100644
--- a/src/brevo/balance/client.py
+++ b/src/brevo/balance/client.py
@@ -9,9 +9,11 @@
from ..types.balance_limit import BalanceLimit
from ..types.transaction import Transaction
from .raw_client import AsyncRawBalanceClient, RawBalanceClient
+from .types.begin_transaction_request_transaction_type import BeginTransactionRequestTransactionType
from .types.create_balance_limit_request_constraint_type import CreateBalanceLimitRequestConstraintType
from .types.create_balance_limit_request_duration_unit import CreateBalanceLimitRequestDurationUnit
from .types.create_balance_limit_request_transaction_type import CreateBalanceLimitRequestTransactionType
+from .types.create_balance_order_request_source import CreateBalanceOrderRequestSource
from .types.create_balance_order_response import CreateBalanceOrderResponse
from .types.get_balance_definition_list_request_sort import GetBalanceDefinitionListRequestSort
from .types.get_balance_definition_list_request_sort_field import GetBalanceDefinitionListRequestSortField
@@ -19,7 +21,15 @@
from .types.get_balance_definition_list_response import GetBalanceDefinitionListResponse
from .types.get_balance_definition_request_version import GetBalanceDefinitionRequestVersion
from .types.get_balance_limit_request_version import GetBalanceLimitRequestVersion
+from .types.get_contact_balances_request_sort import GetContactBalancesRequestSort
+from .types.get_contact_balances_request_sort_field import GetContactBalancesRequestSortField
from .types.get_contact_balances_response import GetContactBalancesResponse
+from .types.get_loyalty_balance_programs_pid_active_balance_request_sort import (
+ GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort,
+)
+from .types.get_loyalty_balance_programs_pid_active_balance_response import (
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse,
+)
from .types.get_loyalty_balance_programs_pid_transaction_history_request_sort import (
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort,
)
@@ -105,11 +115,11 @@ def get_active_balances_api(
balance_definition_id: str,
limit: typing.Optional[int] = None,
offset: typing.Optional[int] = None,
- sort_field: typing.Optional[str] = None,
- sort: typing.Optional[str] = None,
+ sort_field: typing.Optional[typing.Literal["createdAt"]] = None,
+ sort: typing.Optional[GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort] = None,
include_internal: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
- ) -> BalanceLimit:
+ ) -> GetLoyaltyBalanceProgramsPidActiveBalanceResponse:
"""
Returns Active Balances
@@ -130,10 +140,10 @@ def get_active_balances_api(
offset : typing.Optional[int]
Offset
- sort_field : typing.Optional[str]
+ sort_field : typing.Optional[typing.Literal["createdAt"]]
Sort Field
- sort : typing.Optional[str]
+ sort : typing.Optional[GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort]
Sort Order
include_internal : typing.Optional[bool]
@@ -144,8 +154,8 @@ def get_active_balances_api(
Returns
-------
- BalanceLimit
- Successful retrieval of active balance
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse
+ Successful retrieval of active balances
Examples
--------
@@ -156,8 +166,8 @@ def get_active_balances_api(
)
client.balance.get_active_balances_api(
pid="pid",
- contact_id=1,
- balance_definition_id="balance_definition_id",
+ contact_id=1000000,
+ balance_definition_id="balanceDefinitionId",
)
"""
_response = self._raw_client.get_active_balances_api(
@@ -846,20 +856,40 @@ def get_contact_balances(
self,
pid: str,
*,
+ balance_definition_id: str,
include_internal: typing.Optional[bool] = None,
+ limit: typing.Optional[int] = None,
+ offset: typing.Optional[int] = None,
+ sort: typing.Optional[GetContactBalancesRequestSort] = None,
+ sort_field: typing.Optional[GetContactBalancesRequestSortField] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetContactBalancesResponse:
"""
- Returns balance list
+ Returns contact balances for a given balance definition across all subscriptions.
Parameters
----------
pid : str
Loyalty Program Id
+ balance_definition_id : str
+ Balance Definition ID (required)
+
include_internal : typing.Optional[bool]
Include balances tied to internal definitions.
+ limit : typing.Optional[int]
+ Limit the number of records returned
+
+ offset : typing.Optional[int]
+ Skip a number of records
+
+ sort : typing.Optional[GetContactBalancesRequestSort]
+ Sort order
+
+ sort_field : typing.Optional[GetContactBalancesRequestSortField]
+ Field to sort by
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -877,10 +907,18 @@ def get_contact_balances(
)
client.balance.get_contact_balances(
pid="pid",
+ balance_definition_id="balanceDefinitionId",
)
"""
_response = self._raw_client.get_contact_balances(
- pid, include_internal=include_internal, request_options=request_options
+ pid,
+ balance_definition_id=balance_definition_id,
+ include_internal=include_internal,
+ limit=limit,
+ offset=offset,
+ sort=sort,
+ sort_field=sort_field,
+ request_options=request_options,
)
return _response.data
@@ -892,7 +930,7 @@ def create_balance_order(
balance_definition_id: str,
contact_id: int,
due_at: str,
- source: str,
+ source: CreateBalanceOrderRequestSource,
expires_at: typing.Optional[str] = OMIT,
meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -917,8 +955,8 @@ def create_balance_order(
due_at : str
RFC3339 timestamp specifying when the order is due.
- source : str
- Specifies the origin of the order (`engine` or `user`).
+ source : CreateBalanceOrderRequestSource
+ Specifies the origin of the order.
expires_at : typing.Optional[str]
Optional RFC3339 timestamp defining order expiration.
@@ -947,7 +985,7 @@ def create_balance_order(
balance_definition_id="balanceDefinitionId",
contact_id=1,
due_at="dueAt",
- source="source",
+ source="engine",
)
"""
_response = self._raw_client.create_balance_order(
@@ -1063,9 +1101,9 @@ def get_transaction_history_api(
offset: typing.Optional[int] = None,
sort_field: typing.Optional[typing.Literal["createdAt"]] = None,
sort: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort] = None,
- filters: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
status: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus] = None,
transaction_type: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType] = None,
+ loyalty_subscription_id: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetLoyaltyBalanceProgramsPidTransactionHistoryResponse:
"""
@@ -1092,16 +1130,16 @@ def get_transaction_history_api(
Field to sort by
sort : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort]
- Sort order, either asc or desc
-
- filters : typing.Optional[typing.Union[str, typing.Sequence[str]]]
- Filters to apply
+ Sort order
status : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus]
- Transaction status filter. Allowed values: draft, completed, rejected, cancelled, expired
+ Transaction status filter
transaction_type : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType]
- Transaction type filter. Allowed values: credit, debit
+ Transaction type filter
+
+ loyalty_subscription_id : typing.Optional[str]
+ Loyalty Subscription ID filter
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1120,7 +1158,7 @@ def get_transaction_history_api(
)
client.balance.get_transaction_history_api(
pid="pid",
- contact_id=1,
+ contact_id=1000000,
balance_definition_id="balanceDefinitionId",
)
"""
@@ -1132,9 +1170,9 @@ def get_transaction_history_api(
offset=offset,
sort_field=sort_field,
sort=sort,
- filters=filters,
status=status,
transaction_type=transaction_type,
+ loyalty_subscription_id=loyalty_subscription_id,
request_options=request_options,
)
return _response.data
@@ -1145,13 +1183,14 @@ def begin_transaction(
*,
amount: float,
balance_definition_id: str,
- loyalty_subscription_id: typing.Optional[str] = OMIT,
- auto_complete: typing.Optional[bool] = OMIT,
- balance_expiry_in_minutes: typing.Optional[int] = OMIT,
+ transaction_type: typing.Optional[BeginTransactionRequestTransactionType] = OMIT,
contact_id: typing.Optional[int] = OMIT,
- event_time: typing.Optional[str] = OMIT,
+ loyalty_subscription_id: typing.Optional[str] = OMIT,
meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
ttl: typing.Optional[int] = OMIT,
+ event_time: typing.Optional[dt.datetime] = OMIT,
+ auto_complete: typing.Optional[bool] = OMIT,
+ balance_expiry_in_minutes: typing.Optional[int] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> Transaction:
"""
@@ -1163,31 +1202,34 @@ def begin_transaction(
Loyalty Program Id
amount : float
- Transaction amount (must be provided).
+ Transaction amount. A positive value creates a credit transaction and a negative value creates a debit transaction (unless transactionType is explicitly provided).
balance_definition_id : str
Unique identifier (UUID) of the associated balance definition.
- loyalty_subscription_id : typing.Optional[str]
- Unique identifier for the loyalty subscription (required unless `contactId` is provided).
-
- auto_complete : typing.Optional[bool]
- Whether the transaction should be automatically completed.
-
- balance_expiry_in_minutes : typing.Optional[int]
- Optional expiry time for the balance in minutes (must be greater than 0 if provided).
+ transaction_type : typing.Optional[BeginTransactionRequestTransactionType]
+ Explicit transaction type. If not provided, the type is inferred from the sign of the amount (positive = credit, negative = debit).
contact_id : typing.Optional[int]
- Unique identifier of the contact involved in the transaction (required unless `LoyaltySubscriptionId` is provided).
+ Unique identifier of the contact involved in the transaction. Required unless `LoyaltySubscriptionId` is provided.
- event_time : typing.Optional[str]
- Optional timestamp specifying when the transaction occurred.
+ loyalty_subscription_id : typing.Optional[str]
+ Unique identifier for the loyalty subscription. Required unless `contactId` is provided.
meta : typing.Optional[typing.Dict[str, typing.Any]]
Optional metadata associated with the transaction.
ttl : typing.Optional[int]
- Optional time-to-live for the transaction (must be greater than 0 if provided).
+ Time-to-live for the transaction in seconds. Must be at least 10 seconds if provided.
+
+ event_time : typing.Optional[dt.datetime]
+ Timestamp specifying when the transaction event occurred (ISO 8601 / RFC 3339 format).
+
+ auto_complete : typing.Optional[bool]
+ Whether the transaction should be automatically completed.
+
+ balance_expiry_in_minutes : typing.Optional[int]
+ Expiry time for the balance in minutes. Must be greater than 0 if provided. Only applicable when autoComplete is true.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1195,7 +1237,7 @@ def begin_transaction(
Returns
-------
Transaction
- Transaction information
+ Transaction created successfully
Examples
--------
@@ -1214,13 +1256,14 @@ def begin_transaction(
pid,
amount=amount,
balance_definition_id=balance_definition_id,
- loyalty_subscription_id=loyalty_subscription_id,
- auto_complete=auto_complete,
- balance_expiry_in_minutes=balance_expiry_in_minutes,
+ transaction_type=transaction_type,
contact_id=contact_id,
- event_time=event_time,
+ loyalty_subscription_id=loyalty_subscription_id,
meta=meta,
ttl=ttl,
+ event_time=event_time,
+ auto_complete=auto_complete,
+ balance_expiry_in_minutes=balance_expiry_in_minutes,
request_options=request_options,
)
return _response.data
@@ -1323,11 +1366,11 @@ async def get_active_balances_api(
balance_definition_id: str,
limit: typing.Optional[int] = None,
offset: typing.Optional[int] = None,
- sort_field: typing.Optional[str] = None,
- sort: typing.Optional[str] = None,
+ sort_field: typing.Optional[typing.Literal["createdAt"]] = None,
+ sort: typing.Optional[GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort] = None,
include_internal: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
- ) -> BalanceLimit:
+ ) -> GetLoyaltyBalanceProgramsPidActiveBalanceResponse:
"""
Returns Active Balances
@@ -1348,10 +1391,10 @@ async def get_active_balances_api(
offset : typing.Optional[int]
Offset
- sort_field : typing.Optional[str]
+ sort_field : typing.Optional[typing.Literal["createdAt"]]
Sort Field
- sort : typing.Optional[str]
+ sort : typing.Optional[GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort]
Sort Order
include_internal : typing.Optional[bool]
@@ -1362,8 +1405,8 @@ async def get_active_balances_api(
Returns
-------
- BalanceLimit
- Successful retrieval of active balance
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse
+ Successful retrieval of active balances
Examples
--------
@@ -1379,8 +1422,8 @@ async def get_active_balances_api(
async def main() -> None:
await client.balance.get_active_balances_api(
pid="pid",
- contact_id=1,
- balance_definition_id="balance_definition_id",
+ contact_id=1000000,
+ balance_definition_id="balanceDefinitionId",
)
@@ -2146,20 +2189,40 @@ async def get_contact_balances(
self,
pid: str,
*,
+ balance_definition_id: str,
include_internal: typing.Optional[bool] = None,
+ limit: typing.Optional[int] = None,
+ offset: typing.Optional[int] = None,
+ sort: typing.Optional[GetContactBalancesRequestSort] = None,
+ sort_field: typing.Optional[GetContactBalancesRequestSortField] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetContactBalancesResponse:
"""
- Returns balance list
+ Returns contact balances for a given balance definition across all subscriptions.
Parameters
----------
pid : str
Loyalty Program Id
+ balance_definition_id : str
+ Balance Definition ID (required)
+
include_internal : typing.Optional[bool]
Include balances tied to internal definitions.
+ limit : typing.Optional[int]
+ Limit the number of records returned
+
+ offset : typing.Optional[int]
+ Skip a number of records
+
+ sort : typing.Optional[GetContactBalancesRequestSort]
+ Sort order
+
+ sort_field : typing.Optional[GetContactBalancesRequestSortField]
+ Field to sort by
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2182,13 +2245,21 @@ async def get_contact_balances(
async def main() -> None:
await client.balance.get_contact_balances(
pid="pid",
+ balance_definition_id="balanceDefinitionId",
)
asyncio.run(main())
"""
_response = await self._raw_client.get_contact_balances(
- pid, include_internal=include_internal, request_options=request_options
+ pid,
+ balance_definition_id=balance_definition_id,
+ include_internal=include_internal,
+ limit=limit,
+ offset=offset,
+ sort=sort,
+ sort_field=sort_field,
+ request_options=request_options,
)
return _response.data
@@ -2200,7 +2271,7 @@ async def create_balance_order(
balance_definition_id: str,
contact_id: int,
due_at: str,
- source: str,
+ source: CreateBalanceOrderRequestSource,
expires_at: typing.Optional[str] = OMIT,
meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -2225,8 +2296,8 @@ async def create_balance_order(
due_at : str
RFC3339 timestamp specifying when the order is due.
- source : str
- Specifies the origin of the order (`engine` or `user`).
+ source : CreateBalanceOrderRequestSource
+ Specifies the origin of the order.
expires_at : typing.Optional[str]
Optional RFC3339 timestamp defining order expiration.
@@ -2260,7 +2331,7 @@ async def main() -> None:
balance_definition_id="balanceDefinitionId",
contact_id=1,
due_at="dueAt",
- source="source",
+ source="engine",
)
@@ -2395,9 +2466,9 @@ async def get_transaction_history_api(
offset: typing.Optional[int] = None,
sort_field: typing.Optional[typing.Literal["createdAt"]] = None,
sort: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort] = None,
- filters: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
status: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus] = None,
transaction_type: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType] = None,
+ loyalty_subscription_id: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetLoyaltyBalanceProgramsPidTransactionHistoryResponse:
"""
@@ -2424,16 +2495,16 @@ async def get_transaction_history_api(
Field to sort by
sort : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort]
- Sort order, either asc or desc
-
- filters : typing.Optional[typing.Union[str, typing.Sequence[str]]]
- Filters to apply
+ Sort order
status : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus]
- Transaction status filter. Allowed values: draft, completed, rejected, cancelled, expired
+ Transaction status filter
transaction_type : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType]
- Transaction type filter. Allowed values: credit, debit
+ Transaction type filter
+
+ loyalty_subscription_id : typing.Optional[str]
+ Loyalty Subscription ID filter
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2457,7 +2528,7 @@ async def get_transaction_history_api(
async def main() -> None:
await client.balance.get_transaction_history_api(
pid="pid",
- contact_id=1,
+ contact_id=1000000,
balance_definition_id="balanceDefinitionId",
)
@@ -2472,9 +2543,9 @@ async def main() -> None:
offset=offset,
sort_field=sort_field,
sort=sort,
- filters=filters,
status=status,
transaction_type=transaction_type,
+ loyalty_subscription_id=loyalty_subscription_id,
request_options=request_options,
)
return _response.data
@@ -2485,13 +2556,14 @@ async def begin_transaction(
*,
amount: float,
balance_definition_id: str,
- loyalty_subscription_id: typing.Optional[str] = OMIT,
- auto_complete: typing.Optional[bool] = OMIT,
- balance_expiry_in_minutes: typing.Optional[int] = OMIT,
+ transaction_type: typing.Optional[BeginTransactionRequestTransactionType] = OMIT,
contact_id: typing.Optional[int] = OMIT,
- event_time: typing.Optional[str] = OMIT,
+ loyalty_subscription_id: typing.Optional[str] = OMIT,
meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
ttl: typing.Optional[int] = OMIT,
+ event_time: typing.Optional[dt.datetime] = OMIT,
+ auto_complete: typing.Optional[bool] = OMIT,
+ balance_expiry_in_minutes: typing.Optional[int] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> Transaction:
"""
@@ -2503,31 +2575,34 @@ async def begin_transaction(
Loyalty Program Id
amount : float
- Transaction amount (must be provided).
+ Transaction amount. A positive value creates a credit transaction and a negative value creates a debit transaction (unless transactionType is explicitly provided).
balance_definition_id : str
Unique identifier (UUID) of the associated balance definition.
- loyalty_subscription_id : typing.Optional[str]
- Unique identifier for the loyalty subscription (required unless `contactId` is provided).
-
- auto_complete : typing.Optional[bool]
- Whether the transaction should be automatically completed.
-
- balance_expiry_in_minutes : typing.Optional[int]
- Optional expiry time for the balance in minutes (must be greater than 0 if provided).
+ transaction_type : typing.Optional[BeginTransactionRequestTransactionType]
+ Explicit transaction type. If not provided, the type is inferred from the sign of the amount (positive = credit, negative = debit).
contact_id : typing.Optional[int]
- Unique identifier of the contact involved in the transaction (required unless `LoyaltySubscriptionId` is provided).
+ Unique identifier of the contact involved in the transaction. Required unless `LoyaltySubscriptionId` is provided.
- event_time : typing.Optional[str]
- Optional timestamp specifying when the transaction occurred.
+ loyalty_subscription_id : typing.Optional[str]
+ Unique identifier for the loyalty subscription. Required unless `contactId` is provided.
meta : typing.Optional[typing.Dict[str, typing.Any]]
Optional metadata associated with the transaction.
ttl : typing.Optional[int]
- Optional time-to-live for the transaction (must be greater than 0 if provided).
+ Time-to-live for the transaction in seconds. Must be at least 10 seconds if provided.
+
+ event_time : typing.Optional[dt.datetime]
+ Timestamp specifying when the transaction event occurred (ISO 8601 / RFC 3339 format).
+
+ auto_complete : typing.Optional[bool]
+ Whether the transaction should be automatically completed.
+
+ balance_expiry_in_minutes : typing.Optional[int]
+ Expiry time for the balance in minutes. Must be greater than 0 if provided. Only applicable when autoComplete is true.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2535,7 +2610,7 @@ async def begin_transaction(
Returns
-------
Transaction
- Transaction information
+ Transaction created successfully
Examples
--------
@@ -2562,13 +2637,14 @@ async def main() -> None:
pid,
amount=amount,
balance_definition_id=balance_definition_id,
- loyalty_subscription_id=loyalty_subscription_id,
- auto_complete=auto_complete,
- balance_expiry_in_minutes=balance_expiry_in_minutes,
+ transaction_type=transaction_type,
contact_id=contact_id,
- event_time=event_time,
+ loyalty_subscription_id=loyalty_subscription_id,
meta=meta,
ttl=ttl,
+ event_time=event_time,
+ auto_complete=auto_complete,
+ balance_expiry_in_minutes=balance_expiry_in_minutes,
request_options=request_options,
)
return _response.data
diff --git a/src/brevo/balance/raw_client.py b/src/brevo/balance/raw_client.py
index 89a577b..51dd2a8 100644
--- a/src/brevo/balance/raw_client.py
+++ b/src/brevo/balance/raw_client.py
@@ -22,9 +22,11 @@
from ..types.balance_limit import BalanceLimit
from ..types.error_model import ErrorModel
from ..types.transaction import Transaction
+from .types.begin_transaction_request_transaction_type import BeginTransactionRequestTransactionType
from .types.create_balance_limit_request_constraint_type import CreateBalanceLimitRequestConstraintType
from .types.create_balance_limit_request_duration_unit import CreateBalanceLimitRequestDurationUnit
from .types.create_balance_limit_request_transaction_type import CreateBalanceLimitRequestTransactionType
+from .types.create_balance_order_request_source import CreateBalanceOrderRequestSource
from .types.create_balance_order_response import CreateBalanceOrderResponse
from .types.get_balance_definition_list_request_sort import GetBalanceDefinitionListRequestSort
from .types.get_balance_definition_list_request_sort_field import GetBalanceDefinitionListRequestSortField
@@ -32,7 +34,15 @@
from .types.get_balance_definition_list_response import GetBalanceDefinitionListResponse
from .types.get_balance_definition_request_version import GetBalanceDefinitionRequestVersion
from .types.get_balance_limit_request_version import GetBalanceLimitRequestVersion
+from .types.get_contact_balances_request_sort import GetContactBalancesRequestSort
+from .types.get_contact_balances_request_sort_field import GetContactBalancesRequestSortField
from .types.get_contact_balances_response import GetContactBalancesResponse
+from .types.get_loyalty_balance_programs_pid_active_balance_request_sort import (
+ GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort,
+)
+from .types.get_loyalty_balance_programs_pid_active_balance_response import (
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse,
+)
from .types.get_loyalty_balance_programs_pid_transaction_history_request_sort import (
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort,
)
@@ -108,11 +118,11 @@ def get_active_balances_api(
balance_definition_id: str,
limit: typing.Optional[int] = None,
offset: typing.Optional[int] = None,
- sort_field: typing.Optional[str] = None,
- sort: typing.Optional[str] = None,
+ sort_field: typing.Optional[typing.Literal["createdAt"]] = None,
+ sort: typing.Optional[GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort] = None,
include_internal: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
- ) -> HttpResponse[BalanceLimit]:
+ ) -> HttpResponse[GetLoyaltyBalanceProgramsPidActiveBalanceResponse]:
"""
Returns Active Balances
@@ -133,10 +143,10 @@ def get_active_balances_api(
offset : typing.Optional[int]
Offset
- sort_field : typing.Optional[str]
+ sort_field : typing.Optional[typing.Literal["createdAt"]]
Sort Field
- sort : typing.Optional[str]
+ sort : typing.Optional[GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort]
Sort Order
include_internal : typing.Optional[bool]
@@ -147,8 +157,8 @@ def get_active_balances_api(
Returns
-------
- HttpResponse[BalanceLimit]
- Successful retrieval of active balance
+ HttpResponse[GetLoyaltyBalanceProgramsPidActiveBalanceResponse]
+ Successful retrieval of active balances
"""
_response = self._client_wrapper.httpx_client.request(
f"loyalty/balance/programs/{jsonable_encoder(pid)}/active-balance",
@@ -156,10 +166,10 @@ def get_active_balances_api(
params={
"limit": limit,
"offset": offset,
- "sort_field": sort_field,
+ "sortField": sort_field,
"sort": sort,
- "contact_id": contact_id,
- "balance_definition_id": balance_definition_id,
+ "contactId": contact_id,
+ "balanceDefinitionId": balance_definition_id,
"includeInternal": include_internal,
},
request_options=request_options,
@@ -167,9 +177,9 @@ def get_active_balances_api(
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- BalanceLimit,
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse,
construct_type(
- type_=BalanceLimit, # type: ignore
+ type_=GetLoyaltyBalanceProgramsPidActiveBalanceResponse, # type: ignore
object_=_response.json(),
),
)
@@ -1475,20 +1485,40 @@ def get_contact_balances(
self,
pid: str,
*,
+ balance_definition_id: str,
include_internal: typing.Optional[bool] = None,
+ limit: typing.Optional[int] = None,
+ offset: typing.Optional[int] = None,
+ sort: typing.Optional[GetContactBalancesRequestSort] = None,
+ sort_field: typing.Optional[GetContactBalancesRequestSortField] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetContactBalancesResponse]:
"""
- Returns balance list
+ Returns contact balances for a given balance definition across all subscriptions.
Parameters
----------
pid : str
Loyalty Program Id
+ balance_definition_id : str
+ Balance Definition ID (required)
+
include_internal : typing.Optional[bool]
Include balances tied to internal definitions.
+ limit : typing.Optional[int]
+ Limit the number of records returned
+
+ offset : typing.Optional[int]
+ Skip a number of records
+
+ sort : typing.Optional[GetContactBalancesRequestSort]
+ Sort order
+
+ sort_field : typing.Optional[GetContactBalancesRequestSortField]
+ Field to sort by
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1502,6 +1532,11 @@ def get_contact_balances(
method="GET",
params={
"includeInternal": include_internal,
+ "limit": limit,
+ "offset": offset,
+ "sort": sort,
+ "sortField": sort_field,
+ "balanceDefinitionId": balance_definition_id,
},
request_options=request_options,
)
@@ -1587,7 +1622,7 @@ def create_balance_order(
balance_definition_id: str,
contact_id: int,
due_at: str,
- source: str,
+ source: CreateBalanceOrderRequestSource,
expires_at: typing.Optional[str] = OMIT,
meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -1612,8 +1647,8 @@ def create_balance_order(
due_at : str
RFC3339 timestamp specifying when the order is due.
- source : str
- Specifies the origin of the order (`engine` or `user`).
+ source : CreateBalanceOrderRequestSource
+ Specifies the origin of the order.
expires_at : typing.Optional[str]
Optional RFC3339 timestamp defining order expiration.
@@ -1943,9 +1978,9 @@ def get_transaction_history_api(
offset: typing.Optional[int] = None,
sort_field: typing.Optional[typing.Literal["createdAt"]] = None,
sort: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort] = None,
- filters: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
status: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus] = None,
transaction_type: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType] = None,
+ loyalty_subscription_id: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetLoyaltyBalanceProgramsPidTransactionHistoryResponse]:
"""
@@ -1972,16 +2007,16 @@ def get_transaction_history_api(
Field to sort by
sort : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort]
- Sort order, either asc or desc
-
- filters : typing.Optional[typing.Union[str, typing.Sequence[str]]]
- Filters to apply
+ Sort order
status : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus]
- Transaction status filter. Allowed values: draft, completed, rejected, cancelled, expired
+ Transaction status filter
transaction_type : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType]
- Transaction type filter. Allowed values: credit, debit
+ Transaction type filter
+
+ loyalty_subscription_id : typing.Optional[str]
+ Loyalty Subscription ID filter
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2001,9 +2036,9 @@ def get_transaction_history_api(
"sort": sort,
"contactId": contact_id,
"balanceDefinitionId": balance_definition_id,
- "filters": filters,
"status": status,
"transactionType": transaction_type,
+ "loyaltySubscriptionId": loyalty_subscription_id,
},
request_options=request_options,
)
@@ -2087,13 +2122,14 @@ def begin_transaction(
*,
amount: float,
balance_definition_id: str,
- loyalty_subscription_id: typing.Optional[str] = OMIT,
- auto_complete: typing.Optional[bool] = OMIT,
- balance_expiry_in_minutes: typing.Optional[int] = OMIT,
+ transaction_type: typing.Optional[BeginTransactionRequestTransactionType] = OMIT,
contact_id: typing.Optional[int] = OMIT,
- event_time: typing.Optional[str] = OMIT,
+ loyalty_subscription_id: typing.Optional[str] = OMIT,
meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
ttl: typing.Optional[int] = OMIT,
+ event_time: typing.Optional[dt.datetime] = OMIT,
+ auto_complete: typing.Optional[bool] = OMIT,
+ balance_expiry_in_minutes: typing.Optional[int] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[Transaction]:
"""
@@ -2105,31 +2141,34 @@ def begin_transaction(
Loyalty Program Id
amount : float
- Transaction amount (must be provided).
+ Transaction amount. A positive value creates a credit transaction and a negative value creates a debit transaction (unless transactionType is explicitly provided).
balance_definition_id : str
Unique identifier (UUID) of the associated balance definition.
- loyalty_subscription_id : typing.Optional[str]
- Unique identifier for the loyalty subscription (required unless `contactId` is provided).
-
- auto_complete : typing.Optional[bool]
- Whether the transaction should be automatically completed.
-
- balance_expiry_in_minutes : typing.Optional[int]
- Optional expiry time for the balance in minutes (must be greater than 0 if provided).
+ transaction_type : typing.Optional[BeginTransactionRequestTransactionType]
+ Explicit transaction type. If not provided, the type is inferred from the sign of the amount (positive = credit, negative = debit).
contact_id : typing.Optional[int]
- Unique identifier of the contact involved in the transaction (required unless `LoyaltySubscriptionId` is provided).
+ Unique identifier of the contact involved in the transaction. Required unless `LoyaltySubscriptionId` is provided.
- event_time : typing.Optional[str]
- Optional timestamp specifying when the transaction occurred.
+ loyalty_subscription_id : typing.Optional[str]
+ Unique identifier for the loyalty subscription. Required unless `contactId` is provided.
meta : typing.Optional[typing.Dict[str, typing.Any]]
Optional metadata associated with the transaction.
ttl : typing.Optional[int]
- Optional time-to-live for the transaction (must be greater than 0 if provided).
+ Time-to-live for the transaction in seconds. Must be at least 10 seconds if provided.
+
+ event_time : typing.Optional[dt.datetime]
+ Timestamp specifying when the transaction event occurred (ISO 8601 / RFC 3339 format).
+
+ auto_complete : typing.Optional[bool]
+ Whether the transaction should be automatically completed.
+
+ balance_expiry_in_minutes : typing.Optional[int]
+ Expiry time for the balance in minutes. Must be greater than 0 if provided. Only applicable when autoComplete is true.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2137,21 +2176,22 @@ def begin_transaction(
Returns
-------
HttpResponse[Transaction]
- Transaction information
+ Transaction created successfully
"""
_response = self._client_wrapper.httpx_client.request(
f"loyalty/balance/programs/{jsonable_encoder(pid)}/transactions",
method="POST",
json={
- "LoyaltySubscriptionId": loyalty_subscription_id,
"amount": amount,
- "autoComplete": auto_complete,
+ "transactionType": transaction_type,
"balanceDefinitionId": balance_definition_id,
- "balanceExpiryInMinutes": balance_expiry_in_minutes,
"contactId": contact_id,
- "eventTime": event_time,
+ "LoyaltySubscriptionId": loyalty_subscription_id,
"meta": meta,
"ttl": ttl,
+ "eventTime": event_time,
+ "autoComplete": auto_complete,
+ "balanceExpiryInMinutes": balance_expiry_in_minutes,
},
headers={
"content-type": "application/json",
@@ -2448,11 +2488,11 @@ async def get_active_balances_api(
balance_definition_id: str,
limit: typing.Optional[int] = None,
offset: typing.Optional[int] = None,
- sort_field: typing.Optional[str] = None,
- sort: typing.Optional[str] = None,
+ sort_field: typing.Optional[typing.Literal["createdAt"]] = None,
+ sort: typing.Optional[GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort] = None,
include_internal: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
- ) -> AsyncHttpResponse[BalanceLimit]:
+ ) -> AsyncHttpResponse[GetLoyaltyBalanceProgramsPidActiveBalanceResponse]:
"""
Returns Active Balances
@@ -2473,10 +2513,10 @@ async def get_active_balances_api(
offset : typing.Optional[int]
Offset
- sort_field : typing.Optional[str]
+ sort_field : typing.Optional[typing.Literal["createdAt"]]
Sort Field
- sort : typing.Optional[str]
+ sort : typing.Optional[GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort]
Sort Order
include_internal : typing.Optional[bool]
@@ -2487,8 +2527,8 @@ async def get_active_balances_api(
Returns
-------
- AsyncHttpResponse[BalanceLimit]
- Successful retrieval of active balance
+ AsyncHttpResponse[GetLoyaltyBalanceProgramsPidActiveBalanceResponse]
+ Successful retrieval of active balances
"""
_response = await self._client_wrapper.httpx_client.request(
f"loyalty/balance/programs/{jsonable_encoder(pid)}/active-balance",
@@ -2496,10 +2536,10 @@ async def get_active_balances_api(
params={
"limit": limit,
"offset": offset,
- "sort_field": sort_field,
+ "sortField": sort_field,
"sort": sort,
- "contact_id": contact_id,
- "balance_definition_id": balance_definition_id,
+ "contactId": contact_id,
+ "balanceDefinitionId": balance_definition_id,
"includeInternal": include_internal,
},
request_options=request_options,
@@ -2507,9 +2547,9 @@ async def get_active_balances_api(
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- BalanceLimit,
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse,
construct_type(
- type_=BalanceLimit, # type: ignore
+ type_=GetLoyaltyBalanceProgramsPidActiveBalanceResponse, # type: ignore
object_=_response.json(),
),
)
@@ -3815,20 +3855,40 @@ async def get_contact_balances(
self,
pid: str,
*,
+ balance_definition_id: str,
include_internal: typing.Optional[bool] = None,
+ limit: typing.Optional[int] = None,
+ offset: typing.Optional[int] = None,
+ sort: typing.Optional[GetContactBalancesRequestSort] = None,
+ sort_field: typing.Optional[GetContactBalancesRequestSortField] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetContactBalancesResponse]:
"""
- Returns balance list
+ Returns contact balances for a given balance definition across all subscriptions.
Parameters
----------
pid : str
Loyalty Program Id
+ balance_definition_id : str
+ Balance Definition ID (required)
+
include_internal : typing.Optional[bool]
Include balances tied to internal definitions.
+ limit : typing.Optional[int]
+ Limit the number of records returned
+
+ offset : typing.Optional[int]
+ Skip a number of records
+
+ sort : typing.Optional[GetContactBalancesRequestSort]
+ Sort order
+
+ sort_field : typing.Optional[GetContactBalancesRequestSortField]
+ Field to sort by
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -3842,6 +3902,11 @@ async def get_contact_balances(
method="GET",
params={
"includeInternal": include_internal,
+ "limit": limit,
+ "offset": offset,
+ "sort": sort,
+ "sortField": sort_field,
+ "balanceDefinitionId": balance_definition_id,
},
request_options=request_options,
)
@@ -3927,7 +3992,7 @@ async def create_balance_order(
balance_definition_id: str,
contact_id: int,
due_at: str,
- source: str,
+ source: CreateBalanceOrderRequestSource,
expires_at: typing.Optional[str] = OMIT,
meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -3952,8 +4017,8 @@ async def create_balance_order(
due_at : str
RFC3339 timestamp specifying when the order is due.
- source : str
- Specifies the origin of the order (`engine` or `user`).
+ source : CreateBalanceOrderRequestSource
+ Specifies the origin of the order.
expires_at : typing.Optional[str]
Optional RFC3339 timestamp defining order expiration.
@@ -4283,9 +4348,9 @@ async def get_transaction_history_api(
offset: typing.Optional[int] = None,
sort_field: typing.Optional[typing.Literal["createdAt"]] = None,
sort: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort] = None,
- filters: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
status: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus] = None,
transaction_type: typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType] = None,
+ loyalty_subscription_id: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetLoyaltyBalanceProgramsPidTransactionHistoryResponse]:
"""
@@ -4312,16 +4377,16 @@ async def get_transaction_history_api(
Field to sort by
sort : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort]
- Sort order, either asc or desc
-
- filters : typing.Optional[typing.Union[str, typing.Sequence[str]]]
- Filters to apply
+ Sort order
status : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus]
- Transaction status filter. Allowed values: draft, completed, rejected, cancelled, expired
+ Transaction status filter
transaction_type : typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType]
- Transaction type filter. Allowed values: credit, debit
+ Transaction type filter
+
+ loyalty_subscription_id : typing.Optional[str]
+ Loyalty Subscription ID filter
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -4341,9 +4406,9 @@ async def get_transaction_history_api(
"sort": sort,
"contactId": contact_id,
"balanceDefinitionId": balance_definition_id,
- "filters": filters,
"status": status,
"transactionType": transaction_type,
+ "loyaltySubscriptionId": loyalty_subscription_id,
},
request_options=request_options,
)
@@ -4427,13 +4492,14 @@ async def begin_transaction(
*,
amount: float,
balance_definition_id: str,
- loyalty_subscription_id: typing.Optional[str] = OMIT,
- auto_complete: typing.Optional[bool] = OMIT,
- balance_expiry_in_minutes: typing.Optional[int] = OMIT,
+ transaction_type: typing.Optional[BeginTransactionRequestTransactionType] = OMIT,
contact_id: typing.Optional[int] = OMIT,
- event_time: typing.Optional[str] = OMIT,
+ loyalty_subscription_id: typing.Optional[str] = OMIT,
meta: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
ttl: typing.Optional[int] = OMIT,
+ event_time: typing.Optional[dt.datetime] = OMIT,
+ auto_complete: typing.Optional[bool] = OMIT,
+ balance_expiry_in_minutes: typing.Optional[int] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[Transaction]:
"""
@@ -4445,31 +4511,34 @@ async def begin_transaction(
Loyalty Program Id
amount : float
- Transaction amount (must be provided).
+ Transaction amount. A positive value creates a credit transaction and a negative value creates a debit transaction (unless transactionType is explicitly provided).
balance_definition_id : str
Unique identifier (UUID) of the associated balance definition.
- loyalty_subscription_id : typing.Optional[str]
- Unique identifier for the loyalty subscription (required unless `contactId` is provided).
-
- auto_complete : typing.Optional[bool]
- Whether the transaction should be automatically completed.
-
- balance_expiry_in_minutes : typing.Optional[int]
- Optional expiry time for the balance in minutes (must be greater than 0 if provided).
+ transaction_type : typing.Optional[BeginTransactionRequestTransactionType]
+ Explicit transaction type. If not provided, the type is inferred from the sign of the amount (positive = credit, negative = debit).
contact_id : typing.Optional[int]
- Unique identifier of the contact involved in the transaction (required unless `LoyaltySubscriptionId` is provided).
+ Unique identifier of the contact involved in the transaction. Required unless `LoyaltySubscriptionId` is provided.
- event_time : typing.Optional[str]
- Optional timestamp specifying when the transaction occurred.
+ loyalty_subscription_id : typing.Optional[str]
+ Unique identifier for the loyalty subscription. Required unless `contactId` is provided.
meta : typing.Optional[typing.Dict[str, typing.Any]]
Optional metadata associated with the transaction.
ttl : typing.Optional[int]
- Optional time-to-live for the transaction (must be greater than 0 if provided).
+ Time-to-live for the transaction in seconds. Must be at least 10 seconds if provided.
+
+ event_time : typing.Optional[dt.datetime]
+ Timestamp specifying when the transaction event occurred (ISO 8601 / RFC 3339 format).
+
+ auto_complete : typing.Optional[bool]
+ Whether the transaction should be automatically completed.
+
+ balance_expiry_in_minutes : typing.Optional[int]
+ Expiry time for the balance in minutes. Must be greater than 0 if provided. Only applicable when autoComplete is true.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -4477,21 +4546,22 @@ async def begin_transaction(
Returns
-------
AsyncHttpResponse[Transaction]
- Transaction information
+ Transaction created successfully
"""
_response = await self._client_wrapper.httpx_client.request(
f"loyalty/balance/programs/{jsonable_encoder(pid)}/transactions",
method="POST",
json={
- "LoyaltySubscriptionId": loyalty_subscription_id,
"amount": amount,
- "autoComplete": auto_complete,
+ "transactionType": transaction_type,
"balanceDefinitionId": balance_definition_id,
- "balanceExpiryInMinutes": balance_expiry_in_minutes,
"contactId": contact_id,
- "eventTime": event_time,
+ "LoyaltySubscriptionId": loyalty_subscription_id,
"meta": meta,
"ttl": ttl,
+ "eventTime": event_time,
+ "autoComplete": auto_complete,
+ "balanceExpiryInMinutes": balance_expiry_in_minutes,
},
headers={
"content-type": "application/json",
diff --git a/src/brevo/balance/types/__init__.py b/src/brevo/balance/types/__init__.py
index a3dc1a0..93ca897 100644
--- a/src/brevo/balance/types/__init__.py
+++ b/src/brevo/balance/types/__init__.py
@@ -6,9 +6,11 @@
from importlib import import_module
if typing.TYPE_CHECKING:
+ from .begin_transaction_request_transaction_type import BeginTransactionRequestTransactionType
from .create_balance_limit_request_constraint_type import CreateBalanceLimitRequestConstraintType
from .create_balance_limit_request_duration_unit import CreateBalanceLimitRequestDurationUnit
from .create_balance_limit_request_transaction_type import CreateBalanceLimitRequestTransactionType
+ from .create_balance_order_request_source import CreateBalanceOrderRequestSource
from .create_balance_order_response import CreateBalanceOrderResponse
from .get_balance_definition_list_request_sort import GetBalanceDefinitionListRequestSort
from .get_balance_definition_list_request_sort_field import GetBalanceDefinitionListRequestSortField
@@ -16,8 +18,19 @@
from .get_balance_definition_list_response import GetBalanceDefinitionListResponse
from .get_balance_definition_request_version import GetBalanceDefinitionRequestVersion
from .get_balance_limit_request_version import GetBalanceLimitRequestVersion
+ from .get_contact_balances_request_sort import GetContactBalancesRequestSort
+ from .get_contact_balances_request_sort_field import GetContactBalancesRequestSortField
from .get_contact_balances_response import GetContactBalancesResponse
from .get_contact_balances_response_balances_item import GetContactBalancesResponseBalancesItem
+ from .get_loyalty_balance_programs_pid_active_balance_request_sort import (
+ GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort,
+ )
+ from .get_loyalty_balance_programs_pid_active_balance_response import (
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponse,
+ )
+ from .get_loyalty_balance_programs_pid_active_balance_response_active_balances_item import (
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem,
+ )
from .get_loyalty_balance_programs_pid_transaction_history_request_sort import (
GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort,
)
@@ -33,6 +46,9 @@
from .get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item import (
GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem,
)
+ from .get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item_transaction_type import (
+ GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType,
+ )
from .get_subscription_balances_response import GetSubscriptionBalancesResponse
from .get_subscription_balances_response_balance_item import GetSubscriptionBalancesResponseBalanceItem
from .post_loyalty_balance_programs_pid_balance_definitions_request_balance_availability_duration_modifier import (
@@ -80,9 +96,11 @@
from .update_balance_limit_request_duration_unit import UpdateBalanceLimitRequestDurationUnit
from .update_balance_limit_request_transaction_type import UpdateBalanceLimitRequestTransactionType
_dynamic_imports: typing.Dict[str, str] = {
+ "BeginTransactionRequestTransactionType": ".begin_transaction_request_transaction_type",
"CreateBalanceLimitRequestConstraintType": ".create_balance_limit_request_constraint_type",
"CreateBalanceLimitRequestDurationUnit": ".create_balance_limit_request_duration_unit",
"CreateBalanceLimitRequestTransactionType": ".create_balance_limit_request_transaction_type",
+ "CreateBalanceOrderRequestSource": ".create_balance_order_request_source",
"CreateBalanceOrderResponse": ".create_balance_order_response",
"GetBalanceDefinitionListRequestSort": ".get_balance_definition_list_request_sort",
"GetBalanceDefinitionListRequestSortField": ".get_balance_definition_list_request_sort_field",
@@ -90,13 +108,19 @@
"GetBalanceDefinitionListResponse": ".get_balance_definition_list_response",
"GetBalanceDefinitionRequestVersion": ".get_balance_definition_request_version",
"GetBalanceLimitRequestVersion": ".get_balance_limit_request_version",
+ "GetContactBalancesRequestSort": ".get_contact_balances_request_sort",
+ "GetContactBalancesRequestSortField": ".get_contact_balances_request_sort_field",
"GetContactBalancesResponse": ".get_contact_balances_response",
"GetContactBalancesResponseBalancesItem": ".get_contact_balances_response_balances_item",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort": ".get_loyalty_balance_programs_pid_active_balance_request_sort",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponse": ".get_loyalty_balance_programs_pid_active_balance_response",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem": ".get_loyalty_balance_programs_pid_active_balance_response_active_balances_item",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort": ".get_loyalty_balance_programs_pid_transaction_history_request_sort",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus": ".get_loyalty_balance_programs_pid_transaction_history_request_status",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType": ".get_loyalty_balance_programs_pid_transaction_history_request_transaction_type",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponse": ".get_loyalty_balance_programs_pid_transaction_history_response",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem": ".get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item",
+ "GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType": ".get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item_transaction_type",
"GetSubscriptionBalancesResponse": ".get_subscription_balances_response",
"GetSubscriptionBalancesResponseBalanceItem": ".get_subscription_balances_response_balance_item",
"PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier": ".post_loyalty_balance_programs_pid_balance_definitions_request_balance_availability_duration_modifier",
@@ -142,9 +166,11 @@ def __dir__():
__all__ = [
+ "BeginTransactionRequestTransactionType",
"CreateBalanceLimitRequestConstraintType",
"CreateBalanceLimitRequestDurationUnit",
"CreateBalanceLimitRequestTransactionType",
+ "CreateBalanceOrderRequestSource",
"CreateBalanceOrderResponse",
"GetBalanceDefinitionListRequestSort",
"GetBalanceDefinitionListRequestSortField",
@@ -152,13 +178,19 @@ def __dir__():
"GetBalanceDefinitionListResponse",
"GetBalanceDefinitionRequestVersion",
"GetBalanceLimitRequestVersion",
+ "GetContactBalancesRequestSort",
+ "GetContactBalancesRequestSortField",
"GetContactBalancesResponse",
"GetContactBalancesResponseBalancesItem",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponse",
+ "GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestSort",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestStatus",
"GetLoyaltyBalanceProgramsPidTransactionHistoryRequestTransactionType",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponse",
"GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem",
+ "GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType",
"GetSubscriptionBalancesResponse",
"GetSubscriptionBalancesResponseBalanceItem",
"PostLoyaltyBalanceProgramsPidBalanceDefinitionsRequestBalanceAvailabilityDurationModifier",
diff --git a/src/brevo/balance/types/begin_transaction_request_transaction_type.py b/src/brevo/balance/types/begin_transaction_request_transaction_type.py
new file mode 100644
index 0000000..cd3dd90
--- /dev/null
+++ b/src/brevo/balance/types/begin_transaction_request_transaction_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BeginTransactionRequestTransactionType = typing.Union[typing.Literal["credit", "debit"], typing.Any]
diff --git a/src/brevo/balance/types/create_balance_order_request_source.py b/src/brevo/balance/types/create_balance_order_request_source.py
new file mode 100644
index 0000000..b8a27b6
--- /dev/null
+++ b/src/brevo/balance/types/create_balance_order_request_source.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CreateBalanceOrderRequestSource = typing.Union[typing.Literal["engine", "user"], typing.Any]
diff --git a/src/brevo/balance/types/get_contact_balances_request_sort.py b/src/brevo/balance/types/get_contact_balances_request_sort.py
new file mode 100644
index 0000000..f469940
--- /dev/null
+++ b/src/brevo/balance/types/get_contact_balances_request_sort.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetContactBalancesRequestSort = typing.Union[typing.Literal["asc", "desc"], typing.Any]
diff --git a/src/brevo/balance/types/get_contact_balances_request_sort_field.py b/src/brevo/balance/types/get_contact_balances_request_sort_field.py
new file mode 100644
index 0000000..6290feb
--- /dev/null
+++ b/src/brevo/balance/types/get_contact_balances_request_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetContactBalancesRequestSortField = typing.Union[typing.Literal["updatedAt", "value"], typing.Any]
diff --git a/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_request_sort.py b/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_request_sort.py
new file mode 100644
index 0000000..07c384f
--- /dev/null
+++ b/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_request_sort.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetLoyaltyBalanceProgramsPidActiveBalanceRequestSort = typing.Union[typing.Literal["asc", "desc"], typing.Any]
diff --git a/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_response.py b/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_response.py
new file mode 100644
index 0000000..c294c97
--- /dev/null
+++ b/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_response.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.serialization import FieldMetadata
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .get_loyalty_balance_programs_pid_active_balance_response_active_balances_item import (
+ GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem,
+)
+
+
+class GetLoyaltyBalanceProgramsPidActiveBalanceResponse(UncheckedBaseModel):
+ """
+ Active balance response for a specific contact and balance definition.
+ """
+
+ count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Total number of active balances.
+ """
+
+ loyalty_program_id: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="loyaltyProgramId"),
+ pydantic.Field(alias="loyaltyProgramId", description="Unique identifier of the loyalty program."),
+ ] = None
+ contact_id: typing_extensions.Annotated[
+ typing.Optional[int],
+ FieldMetadata(alias="contactId"),
+ pydantic.Field(alias="contactId", description="Unique identifier of the contact."),
+ ] = None
+ balance_definition_id: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="balanceDefinitionId"),
+ pydantic.Field(alias="balanceDefinitionId", description="Unique identifier of the balance definition."),
+ ] = None
+ active_balances: typing_extensions.Annotated[
+ typing.Optional[typing.List[GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem]],
+ FieldMetadata(alias="activeBalances"),
+ pydantic.Field(alias="activeBalances", description="List of active balances."),
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_response_active_balances_item.py b/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_response_active_balances_item.py
new file mode 100644
index 0000000..32efa4c
--- /dev/null
+++ b/src/brevo/balance/types/get_loyalty_balance_programs_pid_active_balance_response_active_balances_item.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+
+import pydantic
+import typing_extensions
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.serialization import FieldMetadata
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class GetLoyaltyBalanceProgramsPidActiveBalanceResponseActiveBalancesItem(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique identifier of the balance entry.
+ """
+
+ amount: typing.Optional[float] = pydantic.Field(default=None)
+ """
+ Current balance amount.
+ """
+
+ created_at: typing_extensions.Annotated[
+ typing.Optional[dt.datetime],
+ FieldMetadata(alias="createdAt"),
+ pydantic.Field(alias="createdAt", description="Timestamp when the balance was created."),
+ ] = None
+ expires_at: typing_extensions.Annotated[
+ typing.Optional[dt.datetime],
+ FieldMetadata(alias="expiresAt"),
+ pydantic.Field(alias="expiresAt", description="Timestamp when the balance expires (if applicable)."),
+ ] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item.py b/src/brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item.py
index 93dacbe..5ef0337 100644
--- a/src/brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item.py
+++ b/src/brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item.py
@@ -7,6 +7,9 @@
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.serialization import FieldMetadata
from ...core.unchecked_base_model import UncheckedBaseModel
+from .get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item_transaction_type import (
+ GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType,
+)
class GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItem(UncheckedBaseModel):
@@ -19,6 +22,11 @@ class GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryIt
The transaction amount.
"""
+ transaction_type: typing_extensions.Annotated[
+ typing.Optional[GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType],
+ FieldMetadata(alias="transactionType"),
+ pydantic.Field(alias="transactionType", description="The type of the transaction."),
+ ] = None
balance_expiration_date: typing_extensions.Annotated[
typing.Optional[str],
FieldMetadata(alias="balanceExpirationDate"),
diff --git a/src/brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item_transaction_type.py b/src/brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item_transaction_type.py
new file mode 100644
index 0000000..148f23e
--- /dev/null
+++ b/src/brevo/balance/types/get_loyalty_balance_programs_pid_transaction_history_response_transaction_history_item_transaction_type.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetLoyaltyBalanceProgramsPidTransactionHistoryResponseTransactionHistoryItemTransactionType = typing.Union[
+ typing.Literal["credit", "debit"], typing.Any
+]
diff --git a/src/brevo/balance/types/get_subscription_balances_response.py b/src/brevo/balance/types/get_subscription_balances_response.py
index 5a87994..e0f3277 100644
--- a/src/brevo/balance/types/get_subscription_balances_response.py
+++ b/src/brevo/balance/types/get_subscription_balances_response.py
@@ -3,13 +3,28 @@
import typing
import pydantic
+import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.serialization import FieldMetadata
from ...core.unchecked_base_model import UncheckedBaseModel
from .get_subscription_balances_response_balance_item import GetSubscriptionBalancesResponseBalanceItem
class GetSubscriptionBalancesResponse(UncheckedBaseModel):
- balance: typing.Optional[typing.List[GetSubscriptionBalancesResponseBalanceItem]] = None
+ loyalty_program_id: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="loyaltyProgramId"),
+ pydantic.Field(alias="loyaltyProgramId", description="Unique identifier of the loyalty program."),
+ ] = None
+ contact_id: typing_extensions.Annotated[
+ typing.Optional[int],
+ FieldMetadata(alias="contactId"),
+ pydantic.Field(alias="contactId", description="Unique identifier of the contact."),
+ ] = None
+ balance: typing.Optional[typing.List[GetSubscriptionBalancesResponseBalanceItem]] = pydantic.Field(default=None)
+ """
+ Aggregate balance per balance definition.
+ """
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
diff --git a/src/brevo/balance/types/get_subscription_balances_response_balance_item.py b/src/brevo/balance/types/get_subscription_balances_response_balance_item.py
index 5119189..cf97ee0 100644
--- a/src/brevo/balance/types/get_subscription_balances_response_balance_item.py
+++ b/src/brevo/balance/types/get_subscription_balances_response_balance_item.py
@@ -13,11 +13,11 @@ class GetSubscriptionBalancesResponseBalanceItem(UncheckedBaseModel):
balance_definition_id: typing_extensions.Annotated[
typing.Optional[str],
FieldMetadata(alias="balanceDefinitionId"),
- pydantic.Field(alias="balanceDefinitionId", description="balance definition ID"),
+ pydantic.Field(alias="balanceDefinitionId", description="Balance definition ID."),
] = None
value: typing.Optional[float] = pydantic.Field(default=None)
"""
- Unique identifier for the balance definition associated with this aggregate balance
+ Aggregate balance value for this definition.
"""
if IS_PYDANTIC_V2:
diff --git a/src/brevo/balance/types/post_loyalty_balance_programs_pid_subscriptions_cid_balances_response.py b/src/brevo/balance/types/post_loyalty_balance_programs_pid_subscriptions_cid_balances_response.py
index e12762d..f14f1c0 100644
--- a/src/brevo/balance/types/post_loyalty_balance_programs_pid_subscriptions_cid_balances_response.py
+++ b/src/brevo/balance/types/post_loyalty_balance_programs_pid_subscriptions_cid_balances_response.py
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.
+import datetime as dt
import typing
import pydantic
@@ -10,50 +11,50 @@
class PostLoyaltyBalanceProgramsPidSubscriptionsCidBalancesResponse(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique identifier for the balance.
+ """
+
amount: typing.Optional[float] = pydantic.Field(default=None)
"""
- The current amount available in the balance
+ The current amount available in the balance.
"""
- balance_definition_id: typing_extensions.Annotated[
+ loyalty_program_id: typing_extensions.Annotated[
typing.Optional[str],
- FieldMetadata(alias="balanceDefinitionId"),
- pydantic.Field(alias="balanceDefinitionId", description="balance definition ID"),
+ FieldMetadata(alias="loyaltyProgramId"),
+ pydantic.Field(alias="loyaltyProgramId", description="Loyalty program ID."),
] = None
- consumed_at: typing_extensions.Annotated[
- typing.Optional[str],
- FieldMetadata(alias="consumedAt"),
- pydantic.Field(alias="consumedAt", description="Timestamp of when the balance was last consumed"),
+ organization_id: typing_extensions.Annotated[
+ typing.Optional[int],
+ FieldMetadata(alias="organizationId"),
+ pydantic.Field(alias="organizationId", description="Organization ID."),
] = None
contact_id: typing_extensions.Annotated[
typing.Optional[int],
FieldMetadata(alias="contactId"),
- pydantic.Field(alias="contactId", description="contact ID"),
+ pydantic.Field(alias="contactId", description="Contact ID."),
] = None
- created_at: typing_extensions.Annotated[
+ balance_definition_id: typing_extensions.Annotated[
typing.Optional[str],
+ FieldMetadata(alias="balanceDefinitionId"),
+ pydantic.Field(alias="balanceDefinitionId", description="Balance definition ID."),
+ ] = None
+ created_at: typing_extensions.Annotated[
+ typing.Optional[dt.datetime],
FieldMetadata(alias="createdAt"),
- pydantic.Field(alias="createdAt", description="Timestamp of when the balance was created"),
+ pydantic.Field(alias="createdAt", description="Timestamp of when the balance was created."),
] = None
expires_at: typing_extensions.Annotated[
- typing.Optional[str],
+ typing.Optional[dt.datetime],
FieldMetadata(alias="expiresAt"),
- pydantic.Field(alias="expiresAt", description="Expiration timestamp of the balance"),
- ] = None
- id: typing.Optional[str] = pydantic.Field(default=None)
- """
- Unique identifier for the balance
- """
-
- loyalty_program_id: typing_extensions.Annotated[
- typing.Optional[str],
- FieldMetadata(alias="loyaltyProgramId"),
- pydantic.Field(alias="loyaltyProgramId", description="loyalty program ID"),
+ pydantic.Field(alias="expiresAt", description="Expiration timestamp of the balance."),
] = None
- organization_id: typing_extensions.Annotated[
- typing.Optional[int],
- FieldMetadata(alias="organizationId"),
- pydantic.Field(alias="organizationId", description="organization ID"),
+ consumed_at: typing_extensions.Annotated[
+ typing.Optional[dt.datetime],
+ FieldMetadata(alias="consumedAt"),
+ pydantic.Field(alias="consumedAt", description="Timestamp of when the balance was last consumed."),
] = None
if IS_PYDANTIC_V2:
diff --git a/src/brevo/companies/__init__.py b/src/brevo/companies/__init__.py
index a7e4416..eba6399 100644
--- a/src/brevo/companies/__init__.py
+++ b/src/brevo/companies/__init__.py
@@ -10,6 +10,7 @@
GetCompaniesRequestSort,
GetCompaniesResponse,
GetCrmAttributesCompaniesResponseItem,
+ GetCrmAttributesCompaniesResponseItemAttributeOptionsItem,
PatchCrmAttributesIdRequestObjectType,
PatchCrmAttributesIdRequestOptionsLabelsItem,
PostCompaniesImportResponse,
@@ -22,6 +23,7 @@
"GetCompaniesRequestSort": ".types",
"GetCompaniesResponse": ".types",
"GetCrmAttributesCompaniesResponseItem": ".types",
+ "GetCrmAttributesCompaniesResponseItemAttributeOptionsItem": ".types",
"PatchCrmAttributesIdRequestObjectType": ".types",
"PatchCrmAttributesIdRequestOptionsLabelsItem": ".types",
"PostCompaniesImportResponse": ".types",
@@ -57,6 +59,7 @@ def __dir__():
"GetCompaniesRequestSort",
"GetCompaniesResponse",
"GetCrmAttributesCompaniesResponseItem",
+ "GetCrmAttributesCompaniesResponseItemAttributeOptionsItem",
"PatchCrmAttributesIdRequestObjectType",
"PatchCrmAttributesIdRequestOptionsLabelsItem",
"PostCompaniesImportResponse",
diff --git a/src/brevo/companies/client.py b/src/brevo/companies/client.py
index ab09ada..b5231a0 100644
--- a/src/brevo/companies/client.py
+++ b/src/brevo/companies/client.py
@@ -40,7 +40,7 @@ def with_raw_response(self) -> RawCompaniesClient:
def get_all_companies(
self,
*,
- filters: typing.Optional[str] = None,
+ filters_attributes_name: typing.Optional[str] = None,
linked_contacts_ids: typing.Optional[int] = None,
linked_deals_ids: typing.Optional[str] = None,
modified_since: typing.Optional[str] = None,
@@ -52,10 +52,12 @@ def get_all_companies(
request_options: typing.Optional[RequestOptions] = None,
) -> GetCompaniesResponse:
"""
+ 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.
+
Parameters
----------
- filters : typing.Optional[str]
- Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"}
+ filters_attributes_name : typing.Optional[str]
+ 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.
linked_contacts_ids : typing.Optional[int]
Filter by linked contacts ids
@@ -64,10 +66,10 @@ def get_all_companies(
Filter by linked Deals ids
modified_since : typing.Optional[str]
- 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.
+ 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.
created_since : typing.Optional[str]
- 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.
+ 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.
page : typing.Optional[int]
Index of the first document of the page
@@ -99,7 +101,7 @@ def get_all_companies(
client.companies.get_all_companies()
"""
_response = self._raw_client.get_all_companies(
- filters=filters,
+ filters_attributes_name=filters_attributes_name,
linked_contacts_ids=linked_contacts_ids,
linked_deals_ids=linked_deals_ids,
modified_since=modified_since,
@@ -123,6 +125,8 @@ def create_a_company(
request_options: typing.Optional[RequestOptions] = None,
) -> PostCompaniesResponse:
"""
+ 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.
+
Parameters
----------
name : str
@@ -225,6 +229,8 @@ def link_and_unlink_company_with_contact_and_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -271,6 +277,8 @@ def link_and_unlink_company_with_contact_and_deal(
def get_a_company(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Company:
"""
+ 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.
+
Parameters
----------
id : str
@@ -300,6 +308,8 @@ def get_a_company(self, id: str, *, request_options: typing.Optional[RequestOpti
def delete_a_company(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -338,6 +348,8 @@ def update_a_company(
request_options: typing.Optional[RequestOptions] = None,
) -> Company:
"""
+ 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.
+
Parameters
----------
id : str
@@ -352,7 +364,7 @@ def update_a_company(
Warning - Using PATCH on linkedContactIds replaces the list of linked contacts. Omitted IDs will be removed.
linked_deals_ids : typing.Optional[typing.Sequence[str]]
- Warning - Using PATCH on linkedDealsIds replaces the list of linked contacts. Omitted IDs will be removed.
+ Warning - Using PATCH on linkedDealsIds replaces the list of linked deals. Omitted IDs will be removed.
name : typing.Optional[str]
Name of company
@@ -398,6 +410,8 @@ def create_a_company_deal_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> PostCrmAttributesResponse:
"""
+ 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.
+
Parameters
----------
attribute_type : PostCrmAttributesRequestAttributeType
@@ -407,7 +421,7 @@ def create_a_company_deal_attribute(
The label for the attribute (max 50 characters, cannot be empty)
object_type : PostCrmAttributesRequestObjectType
- The type of object the attribute belongs to (prefilled with `companies`, mandatory)
+ The type of object the attribute belongs to. Must be either `companies` or `deals`.
description : typing.Optional[str]
A description of the attribute
@@ -448,6 +462,8 @@ def create_a_company_deal_attribute(
def delete_an_attribute(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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
----------
id : str
@@ -484,6 +500,8 @@ def update_an_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -525,6 +543,8 @@ def get_company_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[GetCrmAttributesCompaniesResponseItem]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -566,7 +586,7 @@ def with_raw_response(self) -> AsyncRawCompaniesClient:
async def get_all_companies(
self,
*,
- filters: typing.Optional[str] = None,
+ filters_attributes_name: typing.Optional[str] = None,
linked_contacts_ids: typing.Optional[int] = None,
linked_deals_ids: typing.Optional[str] = None,
modified_since: typing.Optional[str] = None,
@@ -578,10 +598,12 @@ async def get_all_companies(
request_options: typing.Optional[RequestOptions] = None,
) -> GetCompaniesResponse:
"""
+ 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.
+
Parameters
----------
- filters : typing.Optional[str]
- Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"}
+ filters_attributes_name : typing.Optional[str]
+ 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.
linked_contacts_ids : typing.Optional[int]
Filter by linked contacts ids
@@ -590,10 +612,10 @@ async def get_all_companies(
Filter by linked Deals ids
modified_since : typing.Optional[str]
- 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.
+ 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.
created_since : typing.Optional[str]
- 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.
+ 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.
page : typing.Optional[int]
Index of the first document of the page
@@ -633,7 +655,7 @@ async def main() -> None:
asyncio.run(main())
"""
_response = await self._raw_client.get_all_companies(
- filters=filters,
+ filters_attributes_name=filters_attributes_name,
linked_contacts_ids=linked_contacts_ids,
linked_deals_ids=linked_deals_ids,
modified_since=modified_since,
@@ -657,6 +679,8 @@ async def create_a_company(
request_options: typing.Optional[RequestOptions] = None,
) -> PostCompaniesResponse:
"""
+ 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.
+
Parameters
----------
name : str
@@ -775,6 +799,8 @@ async def link_and_unlink_company_with_contact_and_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -829,6 +855,8 @@ async def main() -> None:
async def get_a_company(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Company:
"""
+ 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.
+
Parameters
----------
id : str
@@ -866,6 +894,8 @@ async def main() -> None:
async def delete_a_company(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -912,6 +942,8 @@ async def update_a_company(
request_options: typing.Optional[RequestOptions] = None,
) -> Company:
"""
+ 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.
+
Parameters
----------
id : str
@@ -926,7 +958,7 @@ async def update_a_company(
Warning - Using PATCH on linkedContactIds replaces the list of linked contacts. Omitted IDs will be removed.
linked_deals_ids : typing.Optional[typing.Sequence[str]]
- Warning - Using PATCH on linkedDealsIds replaces the list of linked contacts. Omitted IDs will be removed.
+ Warning - Using PATCH on linkedDealsIds replaces the list of linked deals. Omitted IDs will be removed.
name : typing.Optional[str]
Name of company
@@ -980,6 +1012,8 @@ async def create_a_company_deal_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> PostCrmAttributesResponse:
"""
+ 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.
+
Parameters
----------
attribute_type : PostCrmAttributesRequestAttributeType
@@ -989,7 +1023,7 @@ async def create_a_company_deal_attribute(
The label for the attribute (max 50 characters, cannot be empty)
object_type : PostCrmAttributesRequestObjectType
- The type of object the attribute belongs to (prefilled with `companies`, mandatory)
+ The type of object the attribute belongs to. Must be either `companies` or `deals`.
description : typing.Optional[str]
A description of the attribute
@@ -1038,6 +1072,8 @@ async def main() -> None:
async def delete_an_attribute(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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
----------
id : str
@@ -1082,6 +1118,8 @@ async def update_an_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1131,6 +1169,8 @@ async def get_company_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[GetCrmAttributesCompaniesResponseItem]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
diff --git a/src/brevo/companies/raw_client.py b/src/brevo/companies/raw_client.py
index 12f7f5d..84904b5 100644
--- a/src/brevo/companies/raw_client.py
+++ b/src/brevo/companies/raw_client.py
@@ -39,7 +39,7 @@ def __init__(self, *, client_wrapper: SyncClientWrapper):
def get_all_companies(
self,
*,
- filters: typing.Optional[str] = None,
+ filters_attributes_name: typing.Optional[str] = None,
linked_contacts_ids: typing.Optional[int] = None,
linked_deals_ids: typing.Optional[str] = None,
modified_since: typing.Optional[str] = None,
@@ -51,10 +51,12 @@ def get_all_companies(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetCompaniesResponse]:
"""
+ 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.
+
Parameters
----------
- filters : typing.Optional[str]
- Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"}
+ filters_attributes_name : typing.Optional[str]
+ 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.
linked_contacts_ids : typing.Optional[int]
Filter by linked contacts ids
@@ -63,10 +65,10 @@ def get_all_companies(
Filter by linked Deals ids
modified_since : typing.Optional[str]
- 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.
+ 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.
created_since : typing.Optional[str]
- 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.
+ 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.
page : typing.Optional[int]
Index of the first document of the page
@@ -92,7 +94,7 @@ def get_all_companies(
"companies",
method="GET",
params={
- "filters": filters,
+ "filters[attributes.name]": filters_attributes_name,
"linkedContactsIds": linked_contacts_ids,
"linkedDealsIds": linked_deals_ids,
"modifiedSince": modified_since,
@@ -145,6 +147,8 @@ def create_a_company(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[PostCompaniesResponse]:
"""
+ 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.
+
Parameters
----------
name : str
@@ -301,6 +305,8 @@ def link_and_unlink_company_with_contact_and_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -366,6 +372,8 @@ def get_a_company(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[Company]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -429,6 +437,8 @@ def delete_a_company(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -492,6 +502,8 @@ def update_a_company(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[Company]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -506,7 +518,7 @@ def update_a_company(
Warning - Using PATCH on linkedContactIds replaces the list of linked contacts. Omitted IDs will be removed.
linked_deals_ids : typing.Optional[typing.Sequence[str]]
- Warning - Using PATCH on linkedDealsIds replaces the list of linked contacts. Omitted IDs will be removed.
+ Warning - Using PATCH on linkedDealsIds replaces the list of linked deals. Omitted IDs will be removed.
name : typing.Optional[str]
Name of company
@@ -587,6 +599,8 @@ def create_a_company_deal_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[PostCrmAttributesResponse]:
"""
+ 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.
+
Parameters
----------
attribute_type : PostCrmAttributesRequestAttributeType
@@ -596,7 +610,7 @@ def create_a_company_deal_attribute(
The label for the attribute (max 50 characters, cannot be empty)
object_type : PostCrmAttributesRequestObjectType
- The type of object the attribute belongs to (prefilled with `companies`, mandatory)
+ The type of object the attribute belongs to. Must be either `companies` or `deals`.
description : typing.Optional[str]
A description of the attribute
@@ -662,6 +676,8 @@ def delete_an_attribute(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
+ 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
----------
id : str
@@ -723,6 +739,8 @@ def update_an_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -800,6 +818,8 @@ def get_company_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[typing.List[GetCrmAttributesCompaniesResponseItem]]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -825,6 +845,17 @@ def get_company_attributes(
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -842,7 +873,7 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper):
async def get_all_companies(
self,
*,
- filters: typing.Optional[str] = None,
+ filters_attributes_name: typing.Optional[str] = None,
linked_contacts_ids: typing.Optional[int] = None,
linked_deals_ids: typing.Optional[str] = None,
modified_since: typing.Optional[str] = None,
@@ -854,10 +885,12 @@ async def get_all_companies(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetCompaniesResponse]:
"""
+ 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.
+
Parameters
----------
- filters : typing.Optional[str]
- Filter by attrbutes. If you have filter for owner on your side please send it as {"attributes.owner":"6299dcf3874a14eacbc65c46"}
+ filters_attributes_name : typing.Optional[str]
+ 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.
linked_contacts_ids : typing.Optional[int]
Filter by linked contacts ids
@@ -866,10 +899,10 @@ async def get_all_companies(
Filter by linked Deals ids
modified_since : typing.Optional[str]
- 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.
+ 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.
created_since : typing.Optional[str]
- 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.
+ 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.
page : typing.Optional[int]
Index of the first document of the page
@@ -895,7 +928,7 @@ async def get_all_companies(
"companies",
method="GET",
params={
- "filters": filters,
+ "filters[attributes.name]": filters_attributes_name,
"linkedContactsIds": linked_contacts_ids,
"linkedDealsIds": linked_deals_ids,
"modifiedSince": modified_since,
@@ -948,6 +981,8 @@ async def create_a_company(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[PostCompaniesResponse]:
"""
+ 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.
+
Parameters
----------
name : str
@@ -1104,6 +1139,8 @@ async def link_and_unlink_company_with_contact_and_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1169,6 +1206,8 @@ async def get_a_company(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[Company]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1232,6 +1271,8 @@ async def delete_a_company(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1295,6 +1336,8 @@ async def update_a_company(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[Company]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1309,7 +1352,7 @@ async def update_a_company(
Warning - Using PATCH on linkedContactIds replaces the list of linked contacts. Omitted IDs will be removed.
linked_deals_ids : typing.Optional[typing.Sequence[str]]
- Warning - Using PATCH on linkedDealsIds replaces the list of linked contacts. Omitted IDs will be removed.
+ Warning - Using PATCH on linkedDealsIds replaces the list of linked deals. Omitted IDs will be removed.
name : typing.Optional[str]
Name of company
@@ -1390,6 +1433,8 @@ async def create_a_company_deal_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[PostCrmAttributesResponse]:
"""
+ 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.
+
Parameters
----------
attribute_type : PostCrmAttributesRequestAttributeType
@@ -1399,7 +1444,7 @@ async def create_a_company_deal_attribute(
The label for the attribute (max 50 characters, cannot be empty)
object_type : PostCrmAttributesRequestObjectType
- The type of object the attribute belongs to (prefilled with `companies`, mandatory)
+ The type of object the attribute belongs to. Must be either `companies` or `deals`.
description : typing.Optional[str]
A description of the attribute
@@ -1465,6 +1510,8 @@ async def delete_an_attribute(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ 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
----------
id : str
@@ -1526,6 +1573,8 @@ async def update_an_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1603,6 +1652,8 @@ async def get_company_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[typing.List[GetCrmAttributesCompaniesResponseItem]]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -1628,6 +1679,17 @@ async def get_company_attributes(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
diff --git a/src/brevo/companies/types/__init__.py b/src/brevo/companies/types/__init__.py
index 3edf93b..b74323b 100644
--- a/src/brevo/companies/types/__init__.py
+++ b/src/brevo/companies/types/__init__.py
@@ -9,6 +9,9 @@
from .get_companies_request_sort import GetCompaniesRequestSort
from .get_companies_response import GetCompaniesResponse
from .get_crm_attributes_companies_response_item import GetCrmAttributesCompaniesResponseItem
+ from .get_crm_attributes_companies_response_item_attribute_options_item import (
+ GetCrmAttributesCompaniesResponseItemAttributeOptionsItem,
+ )
from .patch_crm_attributes_id_request_object_type import PatchCrmAttributesIdRequestObjectType
from .patch_crm_attributes_id_request_options_labels_item import PatchCrmAttributesIdRequestOptionsLabelsItem
from .post_companies_import_response import PostCompaniesImportResponse
@@ -20,6 +23,7 @@
"GetCompaniesRequestSort": ".get_companies_request_sort",
"GetCompaniesResponse": ".get_companies_response",
"GetCrmAttributesCompaniesResponseItem": ".get_crm_attributes_companies_response_item",
+ "GetCrmAttributesCompaniesResponseItemAttributeOptionsItem": ".get_crm_attributes_companies_response_item_attribute_options_item",
"PatchCrmAttributesIdRequestObjectType": ".patch_crm_attributes_id_request_object_type",
"PatchCrmAttributesIdRequestOptionsLabelsItem": ".patch_crm_attributes_id_request_options_labels_item",
"PostCompaniesImportResponse": ".post_companies_import_response",
@@ -55,6 +59,7 @@ def __dir__():
"GetCompaniesRequestSort",
"GetCompaniesResponse",
"GetCrmAttributesCompaniesResponseItem",
+ "GetCrmAttributesCompaniesResponseItemAttributeOptionsItem",
"PatchCrmAttributesIdRequestObjectType",
"PatchCrmAttributesIdRequestOptionsLabelsItem",
"PostCompaniesImportResponse",
diff --git a/src/brevo/companies/types/get_crm_attributes_companies_response_item.py b/src/brevo/companies/types/get_crm_attributes_companies_response_item.py
index c79536c..a557f49 100644
--- a/src/brevo/companies/types/get_crm_attributes_companies_response_item.py
+++ b/src/brevo/companies/types/get_crm_attributes_companies_response_item.py
@@ -7,28 +7,46 @@
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.serialization import FieldMetadata
from ...core.unchecked_base_model import UncheckedBaseModel
+from .get_crm_attributes_companies_response_item_attribute_options_item import (
+ GetCrmAttributesCompaniesResponseItemAttributeOptionsItem,
+)
class GetCrmAttributesCompaniesResponseItem(UncheckedBaseModel):
"""
- List of attributes
+ Company attribute details
"""
- attribute_options: typing_extensions.Annotated[
- typing.Optional[typing.List[typing.Dict[str, typing.Any]]],
- FieldMetadata(alias="attributeOptions"),
- pydantic.Field(alias="attributeOptions"),
+ internal_name: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="internalName"),
+ pydantic.Field(alias="internalName", description="Internal name of the attribute"),
] = None
attribute_type_name: typing_extensions.Annotated[
- typing.Optional[str], FieldMetadata(alias="attributeTypeName"), pydantic.Field(alias="attributeTypeName")
+ typing.Optional[str],
+ FieldMetadata(alias="attributeTypeName"),
+ pydantic.Field(alias="attributeTypeName", description="Type of the attribute"),
] = None
- internal_name: typing_extensions.Annotated[
- typing.Optional[str], FieldMetadata(alias="internalName"), pydantic.Field(alias="internalName")
+ label: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Display label of the attribute
+ """
+
+ attribute_options: typing_extensions.Annotated[
+ typing.Optional[typing.List[GetCrmAttributesCompaniesResponseItemAttributeOptionsItem]],
+ FieldMetadata(alias="attributeOptions"),
+ pydantic.Field(alias="attributeOptions", description="Options for single-select or multi-choice attributes"),
] = None
is_required: typing_extensions.Annotated[
- typing.Optional[bool], FieldMetadata(alias="isRequired"), pydantic.Field(alias="isRequired")
+ typing.Optional[bool],
+ FieldMetadata(alias="isRequired"),
+ pydantic.Field(alias="isRequired", description="Whether this attribute is required"),
+ ] = None
+ is_value_readonly: typing_extensions.Annotated[
+ typing.Optional[bool],
+ FieldMetadata(alias="isValueReadonly"),
+ pydantic.Field(alias="isValueReadonly", description="Whether this attribute value is read-only"),
] = None
- label: typing.Optional[str] = None
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_one.py b/src/brevo/companies/types/get_crm_attributes_companies_response_item_attribute_options_item.py
similarity index 75%
rename from src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_one.py
rename to src/brevo/companies/types/get_crm_attributes_companies_response_item_attribute_options_item.py
index 4ef760f..879d3ec 100644
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_one.py
+++ b/src/brevo/companies/types/get_crm_attributes_companies_response_item_attribute_options_item.py
@@ -7,8 +7,9 @@
from ...core.unchecked_base_model import UncheckedBaseModel
-class UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne(UncheckedBaseModel):
- identifiers: typing.Optional[typing.Dict[str, typing.Any]] = None
+class GetCrmAttributesCompaniesResponseItemAttributeOptionsItem(UncheckedBaseModel):
+ key: typing.Optional[str] = None
+ value: typing.Optional[str] = None
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
diff --git a/src/brevo/contacts/client.py b/src/brevo/contacts/client.py
index 51f75d2..4fd68bf 100644
--- a/src/brevo/contacts/client.py
+++ b/src/brevo/contacts/client.py
@@ -77,12 +77,15 @@ def get_contacts(
modified_since: typing.Optional[str] = None,
created_since: typing.Optional[str] = None,
sort: typing.Optional[GetContactsRequestSort] = None,
+ ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
segment_id: typing.Optional[int] = None,
list_ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
filter: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetContacts:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -100,8 +103,11 @@ def get_contacts(
sort : typing.Optional[GetContactsRequestSort]
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
+ ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
+ Filter by a list of contact IDs. You can pass a **maximum of 20 IDs**. All elements must be integers.
+
segment_id : typing.Optional[int]
- Id of the segment. **Either listIds or segmentId can be passed.**
+ Id of the segment. **Either listIds or segmentId can be passed.** Must be a positive integer (minimum value of 1).
list_ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
Ids of the list. **Either listIds or segmentId can be passed.**
@@ -132,6 +138,7 @@ def get_contacts(
modified_since=modified_since,
created_since=created_since,
sort=sort,
+ ids=ids,
segment_id=segment_id,
list_ids=list_ids,
filter=filter,
@@ -150,6 +157,8 @@ def create_contact(
sms_blacklisted: typing.Optional[bool] = OMIT,
smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
update_enabled: typing.Optional[bool] = OMIT,
+ force_merge: typing.Optional[bool] = OMIT,
+ get_id: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[CreateContactResponse]:
"""
@@ -183,6 +192,12 @@ def create_contact(
update_enabled : typing.Optional[bool]
Facilitate to update the existing contact in the same request (updateEnabled = true)
+ force_merge : typing.Optional[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.
+
+ get_id : typing.Optional[bool]
+ When true, the response returns the `id` of the surviving contact after merge.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -209,12 +224,16 @@ def create_contact(
sms_blacklisted=sms_blacklisted,
smtp_blacklist_sender=smtp_blacklist_sender,
update_enabled=update_enabled,
+ force_merge=force_merge,
+ get_id=get_id,
request_options=request_options,
)
return _response.data
def get_attributes(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetAttributesResponse:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -250,6 +269,8 @@ def create_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
attribute_category : CreateAttributeRequestAttributeCategory
@@ -315,6 +336,8 @@ def update_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
attribute_category : UpdateAttributeRequestAttributeCategory
@@ -369,6 +392,8 @@ def delete_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
attribute_category : DeleteAttributeRequestAttributeCategory
@@ -409,6 +434,8 @@ def delete_multi_attribute_options(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
multiple_choice_attribute : str
@@ -448,6 +475,8 @@ def update_batch_contacts(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
contacts : typing.Optional[typing.Sequence[UpdateBatchContactsRequestContactsItem]]
@@ -663,6 +692,8 @@ def create_folder(
self, *, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
) -> CreateFolderResponse:
"""
+ 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.
+
Parameters
----------
name : typing.Optional[str]
@@ -729,6 +760,8 @@ def update_folder(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -760,6 +793,8 @@ def update_folder(
def delete_folder(self, folder_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -973,6 +1008,8 @@ def create_list(
self, *, folder_id: int, name: str, request_options: typing.Optional[RequestOptions] = None
) -> CreateListResponse:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -1013,13 +1050,15 @@ def get_list(
request_options: typing.Optional[RequestOptions] = None,
) -> GetListResponse:
"""
+ 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
----------
list_id : int
Id of the list
start_date : typing.Optional[str]
- **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**
+ **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**
end_date : typing.Optional[str]
**Mandatory if startDate 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**
@@ -1057,6 +1096,8 @@ def update_list(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -1093,6 +1134,8 @@ def update_list(
def delete_list(self, list_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -1130,6 +1173,8 @@ def get_contacts_from_list(
request_options: typing.Optional[RequestOptions] = None,
) -> GetContacts:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -1267,6 +1312,8 @@ def get_segments(
request_options: typing.Optional[RequestOptions] = None,
) -> GetSegmentsResponse:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -1323,10 +1370,10 @@ def get_contact_info(
email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
start_date : typing.Optional[str]
- **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
+ **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.
end_date : typing.Optional[str]
- **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.
+ **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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1368,6 +1415,7 @@ def update_contact(
sms_blacklisted: typing.Optional[bool] = OMIT,
smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
unlink_list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
+ force_merge: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
@@ -1378,10 +1426,10 @@ def update_contact(
Parameters
----------
identifier : UpdateContactRequestIdentifier
- 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
+ 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
identifier_type : typing.Optional[UpdateContactRequestIdentifierType]
- 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
+ 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
attributes : typing.Optional[typing.Dict[str, UpdateContactRequestAttributesValue]]
Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger", "COUNTRIES":["India","China"]}**. The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored .Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}**
@@ -1404,6 +1452,9 @@ def update_contact(
unlink_list_ids : typing.Optional[typing.Sequence[int]]
Ids of the lists to remove the contact from
+ force_merge : typing.Optional[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.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1432,6 +1483,7 @@ def update_contact(
sms_blacklisted=sms_blacklisted,
smtp_blacklist_sender=smtp_blacklist_sender,
unlink_list_ids=unlink_list_ids,
+ force_merge=force_merge,
request_options=request_options,
)
return _response.data
@@ -1486,16 +1538,18 @@ def get_contact_stats(
request_options: typing.Optional[RequestOptions] = None,
) -> GetContactStatsResponse:
"""
+ 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.
+
Parameters
----------
identifier : GetContactStatsRequestIdentifier
Email (urlencoded) OR ID of the contact
start_date : typing.Optional[str]
- **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
+ **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.
end_date : typing.Optional[str]
- **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
+ **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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1545,12 +1599,15 @@ async def get_contacts(
modified_since: typing.Optional[str] = None,
created_since: typing.Optional[str] = None,
sort: typing.Optional[GetContactsRequestSort] = None,
+ ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
segment_id: typing.Optional[int] = None,
list_ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
filter: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetContacts:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -1568,8 +1625,11 @@ async def get_contacts(
sort : typing.Optional[GetContactsRequestSort]
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
+ ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
+ Filter by a list of contact IDs. You can pass a **maximum of 20 IDs**. All elements must be integers.
+
segment_id : typing.Optional[int]
- Id of the segment. **Either listIds or segmentId can be passed.**
+ Id of the segment. **Either listIds or segmentId can be passed.** Must be a positive integer (minimum value of 1).
list_ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
Ids of the list. **Either listIds or segmentId can be passed.**
@@ -1608,6 +1668,7 @@ async def main() -> None:
modified_since=modified_since,
created_since=created_since,
sort=sort,
+ ids=ids,
segment_id=segment_id,
list_ids=list_ids,
filter=filter,
@@ -1626,6 +1687,8 @@ async def create_contact(
sms_blacklisted: typing.Optional[bool] = OMIT,
smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
update_enabled: typing.Optional[bool] = OMIT,
+ force_merge: typing.Optional[bool] = OMIT,
+ get_id: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[CreateContactResponse]:
"""
@@ -1659,6 +1722,12 @@ async def create_contact(
update_enabled : typing.Optional[bool]
Facilitate to update the existing contact in the same request (updateEnabled = true)
+ force_merge : typing.Optional[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.
+
+ get_id : typing.Optional[bool]
+ When true, the response returns the `id` of the surviving contact after merge.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1693,12 +1762,16 @@ async def main() -> None:
sms_blacklisted=sms_blacklisted,
smtp_blacklist_sender=smtp_blacklist_sender,
update_enabled=update_enabled,
+ force_merge=force_merge,
+ get_id=get_id,
request_options=request_options,
)
return _response.data
async def get_attributes(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetAttributesResponse:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -1742,6 +1815,8 @@ async def create_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
attribute_category : CreateAttributeRequestAttributeCategory
@@ -1815,6 +1890,8 @@ async def update_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
attribute_category : UpdateAttributeRequestAttributeCategory
@@ -1877,6 +1954,8 @@ async def delete_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
attribute_category : DeleteAttributeRequestAttributeCategory
@@ -1925,6 +2004,8 @@ async def delete_multi_attribute_options(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
multiple_choice_attribute : str
@@ -1972,6 +2053,8 @@ async def update_batch_contacts(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
contacts : typing.Optional[typing.Sequence[UpdateBatchContactsRequestContactsItem]]
@@ -2221,6 +2304,8 @@ async def create_folder(
self, *, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
) -> CreateFolderResponse:
"""
+ 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.
+
Parameters
----------
name : typing.Optional[str]
@@ -2303,6 +2388,8 @@ async def update_folder(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -2342,6 +2429,8 @@ async def main() -> None:
async def delete_folder(self, folder_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -2589,6 +2678,8 @@ async def create_list(
self, *, folder_id: int, name: str, request_options: typing.Optional[RequestOptions] = None
) -> CreateListResponse:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -2637,13 +2728,15 @@ async def get_list(
request_options: typing.Optional[RequestOptions] = None,
) -> GetListResponse:
"""
+ 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
----------
list_id : int
Id of the list
start_date : typing.Optional[str]
- **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**
+ **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**
end_date : typing.Optional[str]
**Mandatory if startDate 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**
@@ -2689,6 +2782,8 @@ async def update_list(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -2733,6 +2828,8 @@ async def main() -> None:
async def delete_list(self, list_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -2778,6 +2875,8 @@ async def get_contacts_from_list(
request_options: typing.Optional[RequestOptions] = None,
) -> GetContacts:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -2943,6 +3042,8 @@ async def get_segments(
request_options: typing.Optional[RequestOptions] = None,
) -> GetSegmentsResponse:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -3007,10 +3108,10 @@ async def get_contact_info(
email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
start_date : typing.Optional[str]
- **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
+ **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.
end_date : typing.Optional[str]
- **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.
+ **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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -3060,6 +3161,7 @@ async def update_contact(
sms_blacklisted: typing.Optional[bool] = OMIT,
smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
unlink_list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
+ force_merge: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
@@ -3070,10 +3172,10 @@ async def update_contact(
Parameters
----------
identifier : UpdateContactRequestIdentifier
- 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
+ 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
identifier_type : typing.Optional[UpdateContactRequestIdentifierType]
- 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
+ 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
attributes : typing.Optional[typing.Dict[str, UpdateContactRequestAttributesValue]]
Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger", "COUNTRIES":["India","China"]}**. The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored .Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}**
@@ -3096,6 +3198,9 @@ async def update_contact(
unlink_list_ids : typing.Optional[typing.Sequence[int]]
Ids of the lists to remove the contact from
+ force_merge : typing.Optional[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.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -3132,6 +3237,7 @@ async def main() -> None:
sms_blacklisted=sms_blacklisted,
smtp_blacklist_sender=smtp_blacklist_sender,
unlink_list_ids=unlink_list_ids,
+ force_merge=force_merge,
request_options=request_options,
)
return _response.data
@@ -3194,16 +3300,18 @@ async def get_contact_stats(
request_options: typing.Optional[RequestOptions] = None,
) -> GetContactStatsResponse:
"""
+ 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.
+
Parameters
----------
identifier : GetContactStatsRequestIdentifier
Email (urlencoded) OR ID of the contact
start_date : typing.Optional[str]
- **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
+ **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.
end_date : typing.Optional[str]
- **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
+ **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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
diff --git a/src/brevo/contacts/raw_client.py b/src/brevo/contacts/raw_client.py
index 250bf3d..7c5ad3e 100644
--- a/src/brevo/contacts/raw_client.py
+++ b/src/brevo/contacts/raw_client.py
@@ -80,12 +80,15 @@ def get_contacts(
modified_since: typing.Optional[str] = None,
created_since: typing.Optional[str] = None,
sort: typing.Optional[GetContactsRequestSort] = None,
+ ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
segment_id: typing.Optional[int] = None,
list_ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
filter: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetContacts]:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -103,8 +106,11 @@ def get_contacts(
sort : typing.Optional[GetContactsRequestSort]
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
+ ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
+ Filter by a list of contact IDs. You can pass a **maximum of 20 IDs**. All elements must be integers.
+
segment_id : typing.Optional[int]
- Id of the segment. **Either listIds or segmentId can be passed.**
+ Id of the segment. **Either listIds or segmentId can be passed.** Must be a positive integer (minimum value of 1).
list_ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
Ids of the list. **Either listIds or segmentId can be passed.**
@@ -129,6 +135,7 @@ def get_contacts(
"modifiedSince": modified_since,
"createdSince": created_since,
"sort": sort,
+ "ids": ids,
"segmentId": segment_id,
"listIds": list_ids,
"filter": filter,
@@ -187,6 +194,8 @@ def create_contact(
sms_blacklisted: typing.Optional[bool] = OMIT,
smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
update_enabled: typing.Optional[bool] = OMIT,
+ force_merge: typing.Optional[bool] = OMIT,
+ get_id: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[typing.Optional[CreateContactResponse]]:
"""
@@ -220,6 +229,12 @@ def create_contact(
update_enabled : typing.Optional[bool]
Facilitate to update the existing contact in the same request (updateEnabled = true)
+ force_merge : typing.Optional[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.
+
+ get_id : typing.Optional[bool]
+ When true, the response returns the `id` of the surviving contact after merge.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -244,6 +259,8 @@ def create_contact(
"smsBlacklisted": sms_blacklisted,
"smtpBlacklistSender": smtp_blacklist_sender,
"updateEnabled": update_enabled,
+ "forceMerge": force_merge,
+ "getId": get_id,
},
headers={
"content-type": "application/json",
@@ -298,6 +315,8 @@ def get_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[GetAttributesResponse]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -323,6 +342,17 @@ def get_attributes(
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -345,6 +375,8 @@ def create_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
attribute_category : CreateAttributeRequestAttributeCategory
@@ -429,6 +461,8 @@ def update_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
attribute_category : UpdateAttributeRequestAttributeCategory
@@ -513,6 +547,8 @@ def delete_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
attribute_category : DeleteAttributeRequestAttributeCategory
@@ -575,6 +611,8 @@ def delete_multi_attribute_options(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
multiple_choice_attribute : str
@@ -636,6 +674,8 @@ def update_batch_contacts(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
contacts : typing.Optional[typing.Sequence[UpdateBatchContactsRequestContactsItem]]
@@ -964,6 +1004,8 @@ def create_folder(
self, *, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[CreateFolderResponse]:
"""
+ 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.
+
Parameters
----------
name : typing.Optional[str]
@@ -1094,6 +1136,8 @@ def update_folder(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -1159,6 +1203,8 @@ def delete_folder(
self, folder_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -1491,6 +1537,8 @@ def create_list(
self, *, folder_id: int, name: str, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[CreateListResponse]:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -1559,13 +1607,15 @@ def get_list(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetListResponse]:
"""
+ 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
----------
list_id : int
Id of the list
start_date : typing.Optional[str]
- **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**
+ **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**
end_date : typing.Optional[str]
**Mandatory if startDate 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**
@@ -1637,6 +1687,8 @@ def update_list(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -1706,6 +1758,8 @@ def delete_list(
self, list_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -1768,6 +1822,8 @@ def get_contacts_from_list(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetContacts]:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -1836,6 +1892,17 @@ def get_contacts_from_list(
),
),
)
+ if _response.status_code == 429:
+ raise TooManyRequestsError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ ErrorModel,
+ construct_type(
+ type_=ErrorModel, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -2006,6 +2073,8 @@ def get_segments(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetSegmentsResponse]:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -2088,10 +2157,10 @@ def get_contact_info(
email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
start_date : typing.Optional[str]
- **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
+ **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.
end_date : typing.Optional[str]
- **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.
+ **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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2164,6 +2233,7 @@ def update_contact(
sms_blacklisted: typing.Optional[bool] = OMIT,
smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
unlink_list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
+ force_merge: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
@@ -2174,10 +2244,10 @@ def update_contact(
Parameters
----------
identifier : UpdateContactRequestIdentifier
- 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
+ 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
identifier_type : typing.Optional[UpdateContactRequestIdentifierType]
- 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
+ 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
attributes : typing.Optional[typing.Dict[str, UpdateContactRequestAttributesValue]]
Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger", "COUNTRIES":["India","China"]}**. The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored .Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}**
@@ -2200,6 +2270,9 @@ def update_contact(
unlink_list_ids : typing.Optional[typing.Sequence[int]]
Ids of the lists to remove the contact from
+ force_merge : typing.Optional[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.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2225,6 +2298,7 @@ def update_contact(
"smsBlacklisted": sms_blacklisted,
"smtpBlacklistSender": smtp_blacklist_sender,
"unlinkListIds": unlink_list_ids,
+ "forceMerge": force_merge,
},
headers={
"content-type": "application/json",
@@ -2364,16 +2438,18 @@ def get_contact_stats(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetContactStatsResponse]:
"""
+ 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.
+
Parameters
----------
identifier : GetContactStatsRequestIdentifier
Email (urlencoded) OR ID of the contact
start_date : typing.Optional[str]
- **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
+ **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.
end_date : typing.Optional[str]
- **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
+ **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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2446,12 +2522,15 @@ async def get_contacts(
modified_since: typing.Optional[str] = None,
created_since: typing.Optional[str] = None,
sort: typing.Optional[GetContactsRequestSort] = None,
+ ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
segment_id: typing.Optional[int] = None,
list_ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
filter: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetContacts]:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -2469,8 +2548,11 @@ async def get_contacts(
sort : typing.Optional[GetContactsRequestSort]
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
+ ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
+ Filter by a list of contact IDs. You can pass a **maximum of 20 IDs**. All elements must be integers.
+
segment_id : typing.Optional[int]
- Id of the segment. **Either listIds or segmentId can be passed.**
+ Id of the segment. **Either listIds or segmentId can be passed.** Must be a positive integer (minimum value of 1).
list_ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
Ids of the list. **Either listIds or segmentId can be passed.**
@@ -2495,6 +2577,7 @@ async def get_contacts(
"modifiedSince": modified_since,
"createdSince": created_since,
"sort": sort,
+ "ids": ids,
"segmentId": segment_id,
"listIds": list_ids,
"filter": filter,
@@ -2553,6 +2636,8 @@ async def create_contact(
sms_blacklisted: typing.Optional[bool] = OMIT,
smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
update_enabled: typing.Optional[bool] = OMIT,
+ force_merge: typing.Optional[bool] = OMIT,
+ get_id: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[typing.Optional[CreateContactResponse]]:
"""
@@ -2586,6 +2671,12 @@ async def create_contact(
update_enabled : typing.Optional[bool]
Facilitate to update the existing contact in the same request (updateEnabled = true)
+ force_merge : typing.Optional[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.
+
+ get_id : typing.Optional[bool]
+ When true, the response returns the `id` of the surviving contact after merge.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2610,6 +2701,8 @@ async def create_contact(
"smsBlacklisted": sms_blacklisted,
"smtpBlacklistSender": smtp_blacklist_sender,
"updateEnabled": update_enabled,
+ "forceMerge": force_merge,
+ "getId": get_id,
},
headers={
"content-type": "application/json",
@@ -2664,6 +2757,8 @@ async def get_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[GetAttributesResponse]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -2689,6 +2784,17 @@ async def get_attributes(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -2711,6 +2817,8 @@ async def create_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
attribute_category : CreateAttributeRequestAttributeCategory
@@ -2795,6 +2903,8 @@ async def update_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
attribute_category : UpdateAttributeRequestAttributeCategory
@@ -2879,6 +2989,8 @@ async def delete_attribute(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
attribute_category : DeleteAttributeRequestAttributeCategory
@@ -2941,6 +3053,8 @@ async def delete_multi_attribute_options(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
multiple_choice_attribute : str
@@ -3002,6 +3116,8 @@ async def update_batch_contacts(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
contacts : typing.Optional[typing.Sequence[UpdateBatchContactsRequestContactsItem]]
@@ -3330,6 +3446,8 @@ async def create_folder(
self, *, name: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[CreateFolderResponse]:
"""
+ 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.
+
Parameters
----------
name : typing.Optional[str]
@@ -3460,6 +3578,8 @@ async def update_folder(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -3525,6 +3645,8 @@ async def delete_folder(
self, folder_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -3857,6 +3979,8 @@ async def create_list(
self, *, folder_id: int, name: str, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[CreateListResponse]:
"""
+ 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.
+
Parameters
----------
folder_id : int
@@ -3925,13 +4049,15 @@ async def get_list(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetListResponse]:
"""
+ 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
----------
list_id : int
Id of the list
start_date : typing.Optional[str]
- **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**
+ **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**
end_date : typing.Optional[str]
**Mandatory if startDate 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**
@@ -4003,6 +4129,8 @@ async def update_list(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -4072,6 +4200,8 @@ async def delete_list(
self, list_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -4134,6 +4264,8 @@ async def get_contacts_from_list(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetContacts]:
"""
+ 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.
+
Parameters
----------
list_id : int
@@ -4202,6 +4334,17 @@ async def get_contacts_from_list(
),
),
)
+ if _response.status_code == 429:
+ raise TooManyRequestsError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ ErrorModel,
+ construct_type(
+ type_=ErrorModel, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -4372,6 +4515,8 @@ async def get_segments(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetSegmentsResponse]:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -4454,10 +4599,10 @@ async def get_contact_info(
email_id for Email, phone_id for SMS attribute, contact_id for ID of the contact, ext_id for EXT_ID attribute, whatsapp_id for WHATSAPP attribute, landline_number_id for LANDLINE_NUMBER attribute
start_date : typing.Optional[str]
- **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
+ **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.
end_date : typing.Optional[str]
- **Mandatory if startDate is used.** Ending date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be greater than equal to startDate.
+ **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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -4530,6 +4675,7 @@ async def update_contact(
sms_blacklisted: typing.Optional[bool] = OMIT,
smtp_blacklist_sender: typing.Optional[typing.Sequence[str]] = OMIT,
unlink_list_ids: typing.Optional[typing.Sequence[int]] = OMIT,
+ force_merge: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
@@ -4540,10 +4686,10 @@ async def update_contact(
Parameters
----------
identifier : UpdateContactRequestIdentifier
- 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
+ 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
identifier_type : typing.Optional[UpdateContactRequestIdentifierType]
- 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
+ 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
attributes : typing.Optional[typing.Dict[str, UpdateContactRequestAttributesValue]]
Pass the set of attributes to be updated. **These attributes must be present in your account**. To update existing email address of a contact with the new one please pass EMAIL in attributes. For example, **{ "EMAIL":"newemail@domain.com", "FNAME":"Ellie", "LNAME":"Roger", "COUNTRIES":["India","China"]}**. The attribute's parameter should be passed in capital letter while updating a contact. Values that don't match the attribute type (e.g. text or string in a date attribute) will be ignored .Keep in mind transactional attributes can be updated the same way as normal attributes. Mobile Number in **SMS** field should be passed with proper country code. For example: **{"SMS":"+91xxxxxxxxxx"} or {"SMS":"0091xxxxxxxxxx"}**
@@ -4566,6 +4712,9 @@ async def update_contact(
unlink_list_ids : typing.Optional[typing.Sequence[int]]
Ids of the lists to remove the contact from
+ force_merge : typing.Optional[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.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -4591,6 +4740,7 @@ async def update_contact(
"smsBlacklisted": sms_blacklisted,
"smtpBlacklistSender": smtp_blacklist_sender,
"unlinkListIds": unlink_list_ids,
+ "forceMerge": force_merge,
},
headers={
"content-type": "application/json",
@@ -4730,16 +4880,18 @@ async def get_contact_stats(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetContactStatsResponse]:
"""
+ 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.
+
Parameters
----------
identifier : GetContactStatsRequestIdentifier
Email (urlencoded) OR ID of the contact
start_date : typing.Optional[str]
- **Mandatory if endDate is used.** Starting date (YYYY-MM-DD) of the statistic events specific to campaigns. Must be lower than equal to endDate
+ **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.
end_date : typing.Optional[str]
- **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
+ **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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
diff --git a/src/brevo/contacts/types/get_attributes_response_attributes_item_enumeration_item.py b/src/brevo/contacts/types/get_attributes_response_attributes_item_enumeration_item.py
index dd26404..a465f89 100644
--- a/src/brevo/contacts/types/get_attributes_response_attributes_item_enumeration_item.py
+++ b/src/brevo/contacts/types/get_attributes_response_attributes_item_enumeration_item.py
@@ -3,7 +3,9 @@
import typing
import pydantic
+import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.serialization import FieldMetadata
from ...core.unchecked_base_model import UncheckedBaseModel
@@ -15,9 +17,18 @@ class GetAttributesResponseAttributesItemEnumerationItem(UncheckedBaseModel):
value: int = pydantic.Field()
"""
- ID of Value of the "category" type attribute
+ 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.
"""
+ value_str: typing_extensions.Annotated[
+ str,
+ FieldMetadata(alias="valueStr"),
+ pydantic.Field(
+ alias="valueStr",
+ description='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`.',
+ ),
+ ]
+
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
diff --git a/src/brevo/contacts/types/get_contact_info_response.py b/src/brevo/contacts/types/get_contact_info_response.py
index 559a8c8..fa113e0 100644
--- a/src/brevo/contacts/types/get_contact_info_response.py
+++ b/src/brevo/contacts/types/get_contact_info_response.py
@@ -65,6 +65,14 @@ class GetContactInfoResponse(UncheckedBaseModel):
description="Blacklist status for SMS campaigns (true=blacklisted, false=not blacklisted)",
),
]
+ whatsapp_blacklisted: typing_extensions.Annotated[
+ bool,
+ FieldMetadata(alias="whatsappBlacklisted"),
+ pydantic.Field(
+ alias="whatsappBlacklisted",
+ description="Blacklist status for WhatsApp campaigns (true=blacklisted, false=not blacklisted)",
+ ),
+ ]
statistics: GetContactInfoResponseStatistics = pydantic.Field()
"""
Campaign statistics of the contact
diff --git a/src/brevo/contacts/types/get_contact_info_response_statistics.py b/src/brevo/contacts/types/get_contact_info_response_statistics.py
index f595610..fef7343 100644
--- a/src/brevo/contacts/types/get_contact_info_response_statistics.py
+++ b/src/brevo/contacts/types/get_contact_info_response_statistics.py
@@ -47,7 +47,7 @@ class GetContactInfoResponseStatistics(UncheckedBaseModel):
hard_bounces: typing_extensions.Annotated[
typing.Optional[typing.List[GetContactInfoResponseStatisticsHardBouncesItem]],
FieldMetadata(alias="hardBounces"),
- pydantic.Field(alias="hardBounces", description="Listing of the hardbounes generated by the contact"),
+ pydantic.Field(alias="hardBounces", description="Listing of the hard bounces generated by the contact"),
] = None
messages_sent: typing_extensions.Annotated[
typing.Optional[typing.List[GetContactInfoResponseStatisticsMessagesSentItem]],
@@ -62,7 +62,7 @@ class GetContactInfoResponseStatistics(UncheckedBaseModel):
soft_bounces: typing_extensions.Annotated[
typing.Optional[typing.List[GetContactInfoResponseStatisticsSoftBouncesItem]],
FieldMetadata(alias="softBounces"),
- pydantic.Field(alias="softBounces", description="Listing of the softbounes generated by the contact"),
+ pydantic.Field(alias="softBounces", description="Listing of the soft bounces generated by the contact"),
] = None
transac_attributes: typing_extensions.Annotated[
typing.Optional[typing.List[GetContactInfoResponseStatisticsTransacAttributesItem]],
diff --git a/src/brevo/contacts/types/get_segments_response_segments_item.py b/src/brevo/contacts/types/get_segments_response_segments_item.py
index 5684aa6..f976f15 100644
--- a/src/brevo/contacts/types/get_segments_response_segments_item.py
+++ b/src/brevo/contacts/types/get_segments_response_segments_item.py
@@ -17,7 +17,7 @@ class GetSegmentsResponseSegmentsItem(UncheckedBaseModel):
]
id: int = pydantic.Field()
"""
- ID of the list
+ ID of the segment
"""
segment_name: typing_extensions.Annotated[
@@ -27,7 +27,7 @@ class GetSegmentsResponseSegmentsItem(UncheckedBaseModel):
typing.Optional[str],
FieldMetadata(alias="updatedAt"),
pydantic.Field(
- alias="updatedAt", description="Updation UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ)"
+ alias="updatedAt", description="Last update UTC date-time of the segment (YYYY-MM-DDTHH:mm:ss.SSSZ)"
),
] = None
diff --git a/src/brevo/conversations/client.py b/src/brevo/conversations/client.py
index cbf5a03..4d2587f 100644
--- a/src/brevo/conversations/client.py
+++ b/src/brevo/conversations/client.py
@@ -30,28 +30,28 @@ def with_raw_response(self) -> RawConversationsClient:
def sets_agents_status_to_online_for23minutes(
self,
*,
- agent_email: typing.Optional[typing.Any] = OMIT,
- agent_id: typing.Optional[typing.Any] = OMIT,
- agent_name: typing.Optional[typing.Any] = OMIT,
- received_from: typing.Optional[typing.Any] = OMIT,
+ agent_email: typing.Optional[str] = OMIT,
+ agent_id: typing.Optional[str] = OMIT,
+ agent_name: typing.Optional[str] = OMIT,
+ received_from: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
- 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`.
Parameters
----------
- agent_email : typing.Optional[typing.Any]
- 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.
+ agent_email : typing.Optional[str]
+ 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.
- agent_id : typing.Optional[typing.Any]
- 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).
+ agent_id : typing.Optional[str]
+ 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).
- agent_name : typing.Optional[typing.Any]
- agent name
+ agent_name : typing.Optional[str]
+ Agent's name.
- received_from : typing.Optional[typing.Any]
- mark your messages to distinguish messages created by you from the others.
+ received_from : typing.Optional[str]
+ Mark your messages to distinguish messages created by you from the others.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -83,32 +83,36 @@ def sets_agents_status_to_online_for23minutes(
def send_a_message_as_an_agent(
self,
*,
- text: typing.Any,
- visitor_id: typing.Any,
- agent_email: typing.Optional[typing.Any] = OMIT,
- agent_id: typing.Optional[typing.Any] = OMIT,
- agent_name: typing.Optional[typing.Any] = OMIT,
- received_from: typing.Optional[typing.Any] = OMIT,
+ text: str,
+ visitor_id: str,
+ agent_email: typing.Optional[str] = OMIT,
+ agent_id: typing.Optional[str] = OMIT,
+ agent_name: typing.Optional[str] = OMIT,
+ received_from: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> ConversationsMessage:
"""
+ 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.
+
Parameters
----------
- text : typing.Any
+ text : str
+ Message text.
- visitor_id : typing.Any
+ visitor_id : str
+ Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
- agent_email : typing.Optional[typing.Any]
- 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.
+ agent_email : typing.Optional[str]
+ 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.
- agent_id : typing.Optional[typing.Any]
- 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).
+ agent_id : typing.Optional[str]
+ 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).
- agent_name : typing.Optional[typing.Any]
- agent name
+ agent_name : typing.Optional[str]
+ Agent's name.
- received_from : typing.Optional[typing.Any]
- mark your messages to distinguish messages created by you from the others.
+ received_from : typing.Optional[str]
+ Mark your messages to distinguish messages created by you from the others.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -116,7 +120,7 @@ def send_a_message_as_an_agent(
Returns
-------
ConversationsMessage
- Newly created message is returned as a response
+ Newly created message is returned as a response.
Examples
--------
@@ -146,6 +150,8 @@ def get_a_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> ConversationsMessage:
"""
+ Retrieve a single message by its ID.
+
Parameters
----------
id : str
@@ -157,7 +163,7 @@ def get_a_message(
Returns
-------
ConversationsMessage
- Requested message is returned as a response
+ Requested message is returned as a response.
Examples
--------
@@ -177,7 +183,7 @@ def update_a_message_sent_by_an_agent(
self, id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
) -> 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.
Parameters
----------
@@ -185,7 +191,7 @@ def update_a_message_sent_by_an_agent(
ID of the message
text : str
- edited message text
+ The new message text.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -193,7 +199,7 @@ def update_a_message_sent_by_an_agent(
Returns
-------
ConversationsMessage
- Updated message is returned as a response
+ Updated message is returned as a response.
Examples
--------
@@ -214,7 +220,7 @@ def delete_a_message_sent_by_an_agent(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
- Only agentsβ messages can be deleted.
+ Delete a message sent by an agent. Only messages of type `agent` can be deleted.
Parameters
----------
@@ -245,26 +251,28 @@ def delete_a_message_sent_by_an_agent(
def send_an_automated_message_to_a_visitor(
self,
*,
- text: typing.Any,
- visitor_id: typing.Any,
- agent_id: typing.Optional[typing.Any] = OMIT,
- group_id: typing.Optional[typing.Any] = OMIT,
+ text: str,
+ visitor_id: str,
+ agent_id: typing.Optional[str] = OMIT,
+ group_id: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> ConversationsMessage:
"""
- 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.
Parameters
----------
- text : typing.Any
+ text : str
+ Message text.
- visitor_id : typing.Any
+ visitor_id : str
+ Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
- agent_id : typing.Optional[typing.Any]
- agent ID. It can be found on agentβs page or received from a webhook.
+ agent_id : typing.Optional[str]
+ Agent ID. It can be found on the agent's page or received from a webhook.
- group_id : typing.Optional[typing.Any]
- group ID. It can be found on groupβs page.
+ group_id : typing.Optional[str]
+ Group ID. It can be found on the group's page.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -272,7 +280,7 @@ def send_an_automated_message_to_a_visitor(
Returns
-------
ConversationsMessage
- Newly created message is returned as a response
+ Newly created message is returned as a response.
Examples
--------
@@ -283,7 +291,7 @@ def send_an_automated_message_to_a_visitor(
)
client.conversations.send_an_automated_message_to_a_visitor(
group_id="PjRBMhWGen6aRHjif",
- text="Your order has shipped! Hereβs your tracking number: 9114 5847 3325 9667 4328 88",
+ text="Your order has shipped! Here's your tracking number: 9114 5847 3325 9667 4328 88",
visitor_id="kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg",
)
"""
@@ -296,6 +304,8 @@ def get_an_automated_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> ConversationsMessage:
"""
+ Retrieve a single automated (pushed) message by its ID.
+
Parameters
----------
id : str
@@ -307,7 +317,7 @@ def get_an_automated_message(
Returns
-------
ConversationsMessage
- Requested message is returned as a response
+ Requested message is returned as a response.
Examples
--------
@@ -327,13 +337,15 @@ def update_an_automated_message(
self, id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
) -> ConversationsMessage:
"""
+ Update the text of an automated (pushed) message. The `text` and `html` fields of the message will be updated.
+
Parameters
----------
id : str
ID of the message
text : str
- edited message text
+ The new message text.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -341,7 +353,7 @@ def update_an_automated_message(
Returns
-------
ConversationsMessage
- Updated message is returned as a response
+ Updated message is returned as a response.
Examples
--------
@@ -352,7 +364,7 @@ def update_an_automated_message(
)
client.conversations.update_an_automated_message(
id="id",
- 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",
)
"""
_response = self._raw_client.update_an_automated_message(id, text=text, request_options=request_options)
@@ -360,6 +372,8 @@ def update_an_automated_message(
def delete_an_automated_message(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ Delete an automated (pushed) message by its ID.
+
Parameters
----------
id : str
@@ -437,28 +451,28 @@ def with_raw_response(self) -> AsyncRawConversationsClient:
async def sets_agents_status_to_online_for23minutes(
self,
*,
- agent_email: typing.Optional[typing.Any] = OMIT,
- agent_id: typing.Optional[typing.Any] = OMIT,
- agent_name: typing.Optional[typing.Any] = OMIT,
- received_from: typing.Optional[typing.Any] = OMIT,
+ agent_email: typing.Optional[str] = OMIT,
+ agent_id: typing.Optional[str] = OMIT,
+ agent_name: typing.Optional[str] = OMIT,
+ received_from: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
- 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`.
Parameters
----------
- agent_email : typing.Optional[typing.Any]
- 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.
+ agent_email : typing.Optional[str]
+ 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.
- agent_id : typing.Optional[typing.Any]
- 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).
+ agent_id : typing.Optional[str]
+ 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).
- agent_name : typing.Optional[typing.Any]
- agent name
+ agent_name : typing.Optional[str]
+ Agent's name.
- received_from : typing.Optional[typing.Any]
- mark your messages to distinguish messages created by you from the others.
+ received_from : typing.Optional[str]
+ Mark your messages to distinguish messages created by you from the others.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -498,32 +512,36 @@ async def main() -> None:
async def send_a_message_as_an_agent(
self,
*,
- text: typing.Any,
- visitor_id: typing.Any,
- agent_email: typing.Optional[typing.Any] = OMIT,
- agent_id: typing.Optional[typing.Any] = OMIT,
- agent_name: typing.Optional[typing.Any] = OMIT,
- received_from: typing.Optional[typing.Any] = OMIT,
+ text: str,
+ visitor_id: str,
+ agent_email: typing.Optional[str] = OMIT,
+ agent_id: typing.Optional[str] = OMIT,
+ agent_name: typing.Optional[str] = OMIT,
+ received_from: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> ConversationsMessage:
"""
+ 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.
+
Parameters
----------
- text : typing.Any
+ text : str
+ Message text.
- visitor_id : typing.Any
+ visitor_id : str
+ Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
- agent_email : typing.Optional[typing.Any]
- 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.
+ agent_email : typing.Optional[str]
+ 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.
- agent_id : typing.Optional[typing.Any]
- 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).
+ agent_id : typing.Optional[str]
+ 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).
- agent_name : typing.Optional[typing.Any]
- agent name
+ agent_name : typing.Optional[str]
+ Agent's name.
- received_from : typing.Optional[typing.Any]
- mark your messages to distinguish messages created by you from the others.
+ received_from : typing.Optional[str]
+ Mark your messages to distinguish messages created by you from the others.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -531,7 +549,7 @@ async def send_a_message_as_an_agent(
Returns
-------
ConversationsMessage
- Newly created message is returned as a response
+ Newly created message is returned as a response.
Examples
--------
@@ -569,6 +587,8 @@ async def get_a_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> ConversationsMessage:
"""
+ Retrieve a single message by its ID.
+
Parameters
----------
id : str
@@ -580,7 +600,7 @@ async def get_a_message(
Returns
-------
ConversationsMessage
- Requested message is returned as a response
+ Requested message is returned as a response.
Examples
--------
@@ -608,7 +628,7 @@ async def update_a_message_sent_by_an_agent(
self, id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
) -> 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.
Parameters
----------
@@ -616,7 +636,7 @@ async def update_a_message_sent_by_an_agent(
ID of the message
text : str
- edited message text
+ The new message text.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -624,7 +644,7 @@ async def update_a_message_sent_by_an_agent(
Returns
-------
ConversationsMessage
- Updated message is returned as a response
+ Updated message is returned as a response.
Examples
--------
@@ -655,7 +675,7 @@ async def delete_a_message_sent_by_an_agent(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
- Only agentsβ messages can be deleted.
+ Delete a message sent by an agent. Only messages of type `agent` can be deleted.
Parameters
----------
@@ -694,26 +714,28 @@ async def main() -> None:
async def send_an_automated_message_to_a_visitor(
self,
*,
- text: typing.Any,
- visitor_id: typing.Any,
- agent_id: typing.Optional[typing.Any] = OMIT,
- group_id: typing.Optional[typing.Any] = OMIT,
+ text: str,
+ visitor_id: str,
+ agent_id: typing.Optional[str] = OMIT,
+ group_id: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> ConversationsMessage:
"""
- 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.
Parameters
----------
- text : typing.Any
+ text : str
+ Message text.
- visitor_id : typing.Any
+ visitor_id : str
+ Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
- agent_id : typing.Optional[typing.Any]
- agent ID. It can be found on agentβs page or received from a webhook.
+ agent_id : typing.Optional[str]
+ Agent ID. It can be found on the agent's page or received from a webhook.
- group_id : typing.Optional[typing.Any]
- group ID. It can be found on groupβs page.
+ group_id : typing.Optional[str]
+ Group ID. It can be found on the group's page.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -721,7 +743,7 @@ async def send_an_automated_message_to_a_visitor(
Returns
-------
ConversationsMessage
- Newly created message is returned as a response
+ Newly created message is returned as a response.
Examples
--------
@@ -737,7 +759,7 @@ async def send_an_automated_message_to_a_visitor(
async def main() -> None:
await client.conversations.send_an_automated_message_to_a_visitor(
group_id="PjRBMhWGen6aRHjif",
- text="Your order has shipped! Hereβs your tracking number: 9114 5847 3325 9667 4328 88",
+ text="Your order has shipped! Here's your tracking number: 9114 5847 3325 9667 4328 88",
visitor_id="kZMvWhf8npAu3H6qd57w2Hv6nh6rnxvg",
)
@@ -753,6 +775,8 @@ async def get_an_automated_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> ConversationsMessage:
"""
+ Retrieve a single automated (pushed) message by its ID.
+
Parameters
----------
id : str
@@ -764,7 +788,7 @@ async def get_an_automated_message(
Returns
-------
ConversationsMessage
- Requested message is returned as a response
+ Requested message is returned as a response.
Examples
--------
@@ -792,13 +816,15 @@ async def update_an_automated_message(
self, id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
) -> ConversationsMessage:
"""
+ Update the text of an automated (pushed) message. The `text` and `html` fields of the message will be updated.
+
Parameters
----------
id : str
ID of the message
text : str
- edited message text
+ The new message text.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -806,7 +832,7 @@ async def update_an_automated_message(
Returns
-------
ConversationsMessage
- Updated message is returned as a response
+ Updated message is returned as a response.
Examples
--------
@@ -822,7 +848,7 @@ async def update_an_automated_message(
async def main() -> None:
await client.conversations.update_an_automated_message(
id="id",
- 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",
)
@@ -835,6 +861,8 @@ async def delete_an_automated_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
+ Delete an automated (pushed) message by its ID.
+
Parameters
----------
id : str
diff --git a/src/brevo/conversations/raw_client.py b/src/brevo/conversations/raw_client.py
index 74d76fd..df67d8c 100644
--- a/src/brevo/conversations/raw_client.py
+++ b/src/brevo/conversations/raw_client.py
@@ -27,28 +27,28 @@ def __init__(self, *, client_wrapper: SyncClientWrapper):
def sets_agents_status_to_online_for23minutes(
self,
*,
- agent_email: typing.Optional[typing.Any] = OMIT,
- agent_id: typing.Optional[typing.Any] = OMIT,
- agent_name: typing.Optional[typing.Any] = OMIT,
- received_from: typing.Optional[typing.Any] = OMIT,
+ agent_email: typing.Optional[str] = OMIT,
+ agent_id: typing.Optional[str] = OMIT,
+ agent_name: typing.Optional[str] = OMIT,
+ received_from: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
- 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`.
Parameters
----------
- agent_email : typing.Optional[typing.Any]
- 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.
+ agent_email : typing.Optional[str]
+ 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.
- agent_id : typing.Optional[typing.Any]
- 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).
+ agent_id : typing.Optional[str]
+ 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).
- agent_name : typing.Optional[typing.Any]
- agent name
+ agent_name : typing.Optional[str]
+ Agent's name.
- received_from : typing.Optional[typing.Any]
- mark your messages to distinguish messages created by you from the others.
+ received_from : typing.Optional[str]
+ Mark your messages to distinguish messages created by you from the others.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -98,32 +98,36 @@ def sets_agents_status_to_online_for23minutes(
def send_a_message_as_an_agent(
self,
*,
- text: typing.Any,
- visitor_id: typing.Any,
- agent_email: typing.Optional[typing.Any] = OMIT,
- agent_id: typing.Optional[typing.Any] = OMIT,
- agent_name: typing.Optional[typing.Any] = OMIT,
- received_from: typing.Optional[typing.Any] = OMIT,
+ text: str,
+ visitor_id: str,
+ agent_email: typing.Optional[str] = OMIT,
+ agent_id: typing.Optional[str] = OMIT,
+ agent_name: typing.Optional[str] = OMIT,
+ received_from: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[ConversationsMessage]:
"""
+ 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.
+
Parameters
----------
- text : typing.Any
+ text : str
+ Message text.
- visitor_id : typing.Any
+ visitor_id : str
+ Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
- agent_email : typing.Optional[typing.Any]
- 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.
+ agent_email : typing.Optional[str]
+ 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.
- agent_id : typing.Optional[typing.Any]
- 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).
+ agent_id : typing.Optional[str]
+ 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).
- agent_name : typing.Optional[typing.Any]
- agent name
+ agent_name : typing.Optional[str]
+ Agent's name.
- received_from : typing.Optional[typing.Any]
- mark your messages to distinguish messages created by you from the others.
+ received_from : typing.Optional[str]
+ Mark your messages to distinguish messages created by you from the others.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -131,7 +135,7 @@ def send_a_message_as_an_agent(
Returns
-------
HttpResponse[ConversationsMessage]
- Newly created message is returned as a response
+ Newly created message is returned as a response.
"""
_response = self._client_wrapper.httpx_client.request(
"conversations/messages",
@@ -184,6 +188,8 @@ def get_a_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[ConversationsMessage]:
"""
+ Retrieve a single message by its ID.
+
Parameters
----------
id : str
@@ -195,7 +201,7 @@ def get_a_message(
Returns
-------
HttpResponse[ConversationsMessage]
- Requested message is returned as a response
+ Requested message is returned as a response.
"""
_response = self._client_wrapper.httpx_client.request(
f"conversations/messages/{jsonable_encoder(id)}",
@@ -247,7 +253,7 @@ def update_a_message_sent_by_an_agent(
self, id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[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.
Parameters
----------
@@ -255,7 +261,7 @@ def update_a_message_sent_by_an_agent(
ID of the message
text : str
- edited message text
+ The new message text.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -263,7 +269,7 @@ def update_a_message_sent_by_an_agent(
Returns
-------
HttpResponse[ConversationsMessage]
- Updated message is returned as a response
+ Updated message is returned as a response.
"""
_response = self._client_wrapper.httpx_client.request(
f"conversations/messages/{jsonable_encoder(id)}",
@@ -322,7 +328,7 @@ def delete_a_message_sent_by_an_agent(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
- Only agentsβ messages can be deleted.
+ Delete a message sent by an agent. Only messages of type `agent` can be deleted.
Parameters
----------
@@ -378,26 +384,28 @@ def delete_a_message_sent_by_an_agent(
def send_an_automated_message_to_a_visitor(
self,
*,
- text: typing.Any,
- visitor_id: typing.Any,
- agent_id: typing.Optional[typing.Any] = OMIT,
- group_id: typing.Optional[typing.Any] = OMIT,
+ text: str,
+ visitor_id: str,
+ agent_id: typing.Optional[str] = OMIT,
+ group_id: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[ConversationsMessage]:
"""
- 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.
Parameters
----------
- text : typing.Any
+ text : str
+ Message text.
- visitor_id : typing.Any
+ visitor_id : str
+ Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
- agent_id : typing.Optional[typing.Any]
- agent ID. It can be found on agentβs page or received from a webhook.
+ agent_id : typing.Optional[str]
+ Agent ID. It can be found on the agent's page or received from a webhook.
- group_id : typing.Optional[typing.Any]
- group ID. It can be found on groupβs page.
+ group_id : typing.Optional[str]
+ Group ID. It can be found on the group's page.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -405,7 +413,7 @@ def send_an_automated_message_to_a_visitor(
Returns
-------
HttpResponse[ConversationsMessage]
- Newly created message is returned as a response
+ Newly created message is returned as a response.
"""
_response = self._client_wrapper.httpx_client.request(
"conversations/pushedMessages",
@@ -456,6 +464,8 @@ def get_an_automated_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[ConversationsMessage]:
"""
+ Retrieve a single automated (pushed) message by its ID.
+
Parameters
----------
id : str
@@ -467,7 +477,7 @@ def get_an_automated_message(
Returns
-------
HttpResponse[ConversationsMessage]
- Requested message is returned as a response
+ Requested message is returned as a response.
"""
_response = self._client_wrapper.httpx_client.request(
f"conversations/pushedMessages/{jsonable_encoder(id)}",
@@ -519,13 +529,15 @@ def update_an_automated_message(
self, id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[ConversationsMessage]:
"""
+ Update the text of an automated (pushed) message. The `text` and `html` fields of the message will be updated.
+
Parameters
----------
id : str
ID of the message
text : str
- edited message text
+ The new message text.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -533,7 +545,7 @@ def update_an_automated_message(
Returns
-------
HttpResponse[ConversationsMessage]
- Updated message is returned as a response
+ Updated message is returned as a response.
"""
_response = self._client_wrapper.httpx_client.request(
f"conversations/pushedMessages/{jsonable_encoder(id)}",
@@ -592,6 +604,8 @@ def delete_an_automated_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
+ Delete an automated (pushed) message by its ID.
+
Parameters
----------
id : str
@@ -722,28 +736,28 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper):
async def sets_agents_status_to_online_for23minutes(
self,
*,
- agent_email: typing.Optional[typing.Any] = OMIT,
- agent_id: typing.Optional[typing.Any] = OMIT,
- agent_name: typing.Optional[typing.Any] = OMIT,
- received_from: typing.Optional[typing.Any] = OMIT,
+ agent_email: typing.Optional[str] = OMIT,
+ agent_id: typing.Optional[str] = OMIT,
+ agent_name: typing.Optional[str] = OMIT,
+ received_from: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
- 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`.
Parameters
----------
- agent_email : typing.Optional[typing.Any]
- 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.
+ agent_email : typing.Optional[str]
+ 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.
- agent_id : typing.Optional[typing.Any]
- 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).
+ agent_id : typing.Optional[str]
+ 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).
- agent_name : typing.Optional[typing.Any]
- agent name
+ agent_name : typing.Optional[str]
+ Agent's name.
- received_from : typing.Optional[typing.Any]
- mark your messages to distinguish messages created by you from the others.
+ received_from : typing.Optional[str]
+ Mark your messages to distinguish messages created by you from the others.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -793,32 +807,36 @@ async def sets_agents_status_to_online_for23minutes(
async def send_a_message_as_an_agent(
self,
*,
- text: typing.Any,
- visitor_id: typing.Any,
- agent_email: typing.Optional[typing.Any] = OMIT,
- agent_id: typing.Optional[typing.Any] = OMIT,
- agent_name: typing.Optional[typing.Any] = OMIT,
- received_from: typing.Optional[typing.Any] = OMIT,
+ text: str,
+ visitor_id: str,
+ agent_email: typing.Optional[str] = OMIT,
+ agent_id: typing.Optional[str] = OMIT,
+ agent_name: typing.Optional[str] = OMIT,
+ received_from: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[ConversationsMessage]:
"""
+ 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.
+
Parameters
----------
- text : typing.Any
+ text : str
+ Message text.
- visitor_id : typing.Any
+ visitor_id : str
+ Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
- agent_email : typing.Optional[typing.Any]
- 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.
+ agent_email : typing.Optional[str]
+ 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.
- agent_id : typing.Optional[typing.Any]
- 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).
+ agent_id : typing.Optional[str]
+ 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).
- agent_name : typing.Optional[typing.Any]
- agent name
+ agent_name : typing.Optional[str]
+ Agent's name.
- received_from : typing.Optional[typing.Any]
- mark your messages to distinguish messages created by you from the others.
+ received_from : typing.Optional[str]
+ Mark your messages to distinguish messages created by you from the others.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -826,7 +844,7 @@ async def send_a_message_as_an_agent(
Returns
-------
AsyncHttpResponse[ConversationsMessage]
- Newly created message is returned as a response
+ Newly created message is returned as a response.
"""
_response = await self._client_wrapper.httpx_client.request(
"conversations/messages",
@@ -879,6 +897,8 @@ async def get_a_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[ConversationsMessage]:
"""
+ Retrieve a single message by its ID.
+
Parameters
----------
id : str
@@ -890,7 +910,7 @@ async def get_a_message(
Returns
-------
AsyncHttpResponse[ConversationsMessage]
- Requested message is returned as a response
+ Requested message is returned as a response.
"""
_response = await self._client_wrapper.httpx_client.request(
f"conversations/messages/{jsonable_encoder(id)}",
@@ -942,7 +962,7 @@ async def update_a_message_sent_by_an_agent(
self, id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[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.
Parameters
----------
@@ -950,7 +970,7 @@ async def update_a_message_sent_by_an_agent(
ID of the message
text : str
- edited message text
+ The new message text.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -958,7 +978,7 @@ async def update_a_message_sent_by_an_agent(
Returns
-------
AsyncHttpResponse[ConversationsMessage]
- Updated message is returned as a response
+ Updated message is returned as a response.
"""
_response = await self._client_wrapper.httpx_client.request(
f"conversations/messages/{jsonable_encoder(id)}",
@@ -1017,7 +1037,7 @@ async def delete_a_message_sent_by_an_agent(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
- Only agentsβ messages can be deleted.
+ Delete a message sent by an agent. Only messages of type `agent` can be deleted.
Parameters
----------
@@ -1073,26 +1093,28 @@ async def delete_a_message_sent_by_an_agent(
async def send_an_automated_message_to_a_visitor(
self,
*,
- text: typing.Any,
- visitor_id: typing.Any,
- agent_id: typing.Optional[typing.Any] = OMIT,
- group_id: typing.Optional[typing.Any] = OMIT,
+ text: str,
+ visitor_id: str,
+ agent_id: typing.Optional[str] = OMIT,
+ group_id: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[ConversationsMessage]:
"""
- 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.
Parameters
----------
- text : typing.Any
+ text : str
+ Message text.
- visitor_id : typing.Any
+ visitor_id : str
+ Visitor's ID received from a webhook or generated by you to bind an existing user account to Conversations.
- agent_id : typing.Optional[typing.Any]
- agent ID. It can be found on agentβs page or received from a webhook.
+ agent_id : typing.Optional[str]
+ Agent ID. It can be found on the agent's page or received from a webhook.
- group_id : typing.Optional[typing.Any]
- group ID. It can be found on groupβs page.
+ group_id : typing.Optional[str]
+ Group ID. It can be found on the group's page.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1100,7 +1122,7 @@ async def send_an_automated_message_to_a_visitor(
Returns
-------
AsyncHttpResponse[ConversationsMessage]
- Newly created message is returned as a response
+ Newly created message is returned as a response.
"""
_response = await self._client_wrapper.httpx_client.request(
"conversations/pushedMessages",
@@ -1151,6 +1173,8 @@ async def get_an_automated_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[ConversationsMessage]:
"""
+ Retrieve a single automated (pushed) message by its ID.
+
Parameters
----------
id : str
@@ -1162,7 +1186,7 @@ async def get_an_automated_message(
Returns
-------
AsyncHttpResponse[ConversationsMessage]
- Requested message is returned as a response
+ Requested message is returned as a response.
"""
_response = await self._client_wrapper.httpx_client.request(
f"conversations/pushedMessages/{jsonable_encoder(id)}",
@@ -1214,13 +1238,15 @@ async def update_an_automated_message(
self, id: str, *, text: str, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[ConversationsMessage]:
"""
+ Update the text of an automated (pushed) message. The `text` and `html` fields of the message will be updated.
+
Parameters
----------
id : str
ID of the message
text : str
- edited message text
+ The new message text.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1228,7 +1254,7 @@ async def update_an_automated_message(
Returns
-------
AsyncHttpResponse[ConversationsMessage]
- Updated message is returned as a response
+ Updated message is returned as a response.
"""
_response = await self._client_wrapper.httpx_client.request(
f"conversations/pushedMessages/{jsonable_encoder(id)}",
@@ -1287,6 +1313,8 @@ async def delete_an_automated_message(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ Delete an automated (pushed) message by its ID.
+
Parameters
----------
id : str
diff --git a/src/brevo/core/client_wrapper.py b/src/brevo/core/client_wrapper.py
index 8d7b089..9d24c09 100644
--- a/src/brevo/core/client_wrapper.py
+++ b/src/brevo/core/client_wrapper.py
@@ -27,12 +27,12 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform
headers: typing.Dict[str, str] = {
- "User-Agent": "brevo-python/4.0.10",
+ "User-Agent": "brevo-python/v5.0.0-rc.1",
"X-Fern-Language": "Python",
"X-Fern-Runtime": f"python/{platform.python_version()}",
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
"X-Fern-SDK-Name": "brevo-python",
- "X-Fern-SDK-Version": "4.0.10",
+ "X-Fern-SDK-Version": "v5.0.0-rc.1",
**(self.get_custom_headers() or {}),
}
headers["api-key"] = self.api_key
diff --git a/src/brevo/coupons/client.py b/src/brevo/coupons/client.py
index 2b19b58..176222c 100644
--- a/src/brevo/coupons/client.py
+++ b/src/brevo/coupons/client.py
@@ -41,6 +41,8 @@ def get_coupon_collections(
request_options: typing.Optional[RequestOptions] = None,
) -> GetCouponCollection:
"""
+ 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).
+
Parameters
----------
limit : typing.Optional[int]
@@ -88,6 +90,8 @@ def create_coupon_collection(
request_options: typing.Optional[RequestOptions] = None,
) -> CreateCouponCollectionResponse:
"""
+ 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.
+
Parameters
----------
default_coupon : str
@@ -139,6 +143,8 @@ def get_coupon_collection(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetCouponCollection:
"""
+ 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.
+
Parameters
----------
id : str
@@ -177,6 +183,8 @@ def update_coupon_collection(
request_options: typing.Optional[RequestOptions] = None,
) -> UpdateCouponCollectionResponse:
"""
+ 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.
+
Parameters
----------
id : str
@@ -231,6 +239,8 @@ def create_coupons(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
collection_id : str
@@ -288,6 +298,8 @@ async def get_coupon_collections(
request_options: typing.Optional[RequestOptions] = None,
) -> GetCouponCollection:
"""
+ 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).
+
Parameters
----------
limit : typing.Optional[int]
@@ -343,6 +355,8 @@ async def create_coupon_collection(
request_options: typing.Optional[RequestOptions] = None,
) -> CreateCouponCollectionResponse:
"""
+ 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.
+
Parameters
----------
default_coupon : str
@@ -402,6 +416,8 @@ async def get_coupon_collection(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetCouponCollection:
"""
+ 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.
+
Parameters
----------
id : str
@@ -448,6 +464,8 @@ async def update_coupon_collection(
request_options: typing.Optional[RequestOptions] = None,
) -> UpdateCouponCollectionResponse:
"""
+ 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.
+
Parameters
----------
id : str
@@ -510,6 +528,8 @@ async def create_coupons(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
collection_id : str
diff --git a/src/brevo/coupons/raw_client.py b/src/brevo/coupons/raw_client.py
index 474a06c..33e476e 100644
--- a/src/brevo/coupons/raw_client.py
+++ b/src/brevo/coupons/raw_client.py
@@ -39,6 +39,8 @@ def get_coupon_collections(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetCouponCollection]:
"""
+ 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).
+
Parameters
----------
limit : typing.Optional[int]
@@ -124,6 +126,8 @@ def create_coupon_collection(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[CreateCouponCollectionResponse]:
"""
+ 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.
+
Parameters
----------
default_coupon : str
@@ -210,6 +214,8 @@ def get_coupon_collection(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[GetCouponCollection]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -291,6 +297,8 @@ def update_coupon_collection(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[UpdateCouponCollectionResponse]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -380,6 +388,8 @@ def create_coupons(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
collection_id : str
@@ -467,6 +477,8 @@ async def get_coupon_collections(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetCouponCollection]:
"""
+ 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).
+
Parameters
----------
limit : typing.Optional[int]
@@ -552,6 +564,8 @@ async def create_coupon_collection(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[CreateCouponCollectionResponse]:
"""
+ 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.
+
Parameters
----------
default_coupon : str
@@ -638,6 +652,8 @@ async def get_coupon_collection(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[GetCouponCollection]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -719,6 +735,8 @@ async def update_coupon_collection(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[UpdateCouponCollectionResponse]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -808,6 +826,8 @@ async def create_coupons(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
collection_id : str
diff --git a/src/brevo/custom_objects/__init__.py b/src/brevo/custom_objects/__init__.py
index 17a7597..b7dd4bb 100644
--- a/src/brevo/custom_objects/__init__.py
+++ b/src/brevo/custom_objects/__init__.py
@@ -31,14 +31,9 @@
GetrecordsResponseRecordsItemIdentifiers,
UpsertrecordsRequestRecordsItem,
UpsertrecordsRequestRecordsItemAssociationsItem,
- UpsertrecordsRequestRecordsItemAssociationsItemOne,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers,
- UpsertrecordsRequestRecordsItemAssociationsItemZero,
- UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem,
- UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers,
+ UpsertrecordsRequestRecordsItemAssociationsItemAction,
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem,
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers,
UpsertrecordsRequestRecordsItemIdentifiers,
UpsertrecordsResponse,
)
@@ -67,14 +62,9 @@
"GetrecordsResponseRecordsItemIdentifiers": ".types",
"UpsertrecordsRequestRecordsItem": ".types",
"UpsertrecordsRequestRecordsItemAssociationsItem": ".types",
- "UpsertrecordsRequestRecordsItemAssociationsItemOne": ".types",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem": ".types",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne": ".types",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero": ".types",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers": ".types",
- "UpsertrecordsRequestRecordsItemAssociationsItemZero": ".types",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem": ".types",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers": ".types",
+ "UpsertrecordsRequestRecordsItemAssociationsItemAction": ".types",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem": ".types",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers": ".types",
"UpsertrecordsRequestRecordsItemIdentifiers": ".types",
"UpsertrecordsResponse": ".types",
}
@@ -126,14 +116,9 @@ def __dir__():
"GetrecordsResponseRecordsItemIdentifiers",
"UpsertrecordsRequestRecordsItem",
"UpsertrecordsRequestRecordsItemAssociationsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemOne",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers",
- "UpsertrecordsRequestRecordsItemAssociationsItemZero",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers",
+ "UpsertrecordsRequestRecordsItemAssociationsItemAction",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers",
"UpsertrecordsRequestRecordsItemIdentifiers",
"UpsertrecordsResponse",
]
diff --git a/src/brevo/custom_objects/client.py b/src/brevo/custom_objects/client.py
index e60c8bc..ff4a289 100644
--- a/src/brevo/custom_objects/client.py
+++ b/src/brevo/custom_objects/client.py
@@ -42,29 +42,56 @@ def upsertrecords(
"""
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".
Parameters
----------
object_type : str
- object type for the attribute
+ 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).
records : typing.Sequence[UpsertrecordsRequestRecordsItem]
List of object records to be upsert. Each record can have attributes, identifiers, and associations.
@@ -80,14 +107,56 @@ def upsertrecords(
Examples
--------
from brevo import Brevo
- from brevo.custom_objects import UpsertrecordsRequestRecordsItem
+ from brevo.custom_objects import (
+ UpsertrecordsRequestRecordsItem,
+ UpsertrecordsRequestRecordsItemAssociationsItem,
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem,
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers,
+ UpsertrecordsRequestRecordsItemIdentifiers,
+ )
client = Brevo(
api_key="YOUR_API_KEY",
)
client.custom_objects.upsertrecords(
object_type="vehicle",
- records=[UpsertrecordsRequestRecordsItem()],
+ records=[
+ UpsertrecordsRequestRecordsItem(
+ associations=[
+ UpsertrecordsRequestRecordsItemAssociationsItem(
+ object_type="garage",
+ action="link",
+ records=[
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem(
+ identifiers=UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers(
+ id=435435,
+ ),
+ )
+ ],
+ ),
+ UpsertrecordsRequestRecordsItemAssociationsItem(
+ object_type="garage",
+ action="unlink",
+ records=[
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem(
+ identifiers=UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers(
+ ext_id="old-garage-001",
+ ),
+ )
+ ],
+ ),
+ ],
+ attributes={
+ "make": "Toyota",
+ "model": "Camry",
+ "year": 2020,
+ "engine_type": "hybrid",
+ },
+ identifiers=UpsertrecordsRequestRecordsItemIdentifiers(
+ ext_id="VIN123",
+ ),
+ )
+ ],
)
"""
_response = self._raw_client.upsertrecords(object_type, records=records, request_options=request_options)
@@ -111,7 +180,7 @@ def getrecords(
Parameters
----------
object_type : str
- object type for the attribute
+ 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.
limit : int
Number of records returned per page
@@ -165,8 +234,8 @@ def batch_delete_object_records(
) -> BatchDeleteObjectRecordsResponse:
"""
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
Parameters
----------
@@ -174,7 +243,7 @@ def batch_delete_object_records(
Object type for the records to delete
identifiers : typing.Optional[BatchDeleteObjectRecordsRequestIdentifiers]
- One of the below must be provided
+ Either `ids` or `ext_ids` must be provided, but not both in the same request.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -232,29 +301,56 @@ async def upsertrecords(
"""
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".
Parameters
----------
object_type : str
- object type for the attribute
+ 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).
records : typing.Sequence[UpsertrecordsRequestRecordsItem]
List of object records to be upsert. Each record can have attributes, identifiers, and associations.
@@ -272,7 +368,13 @@ async def upsertrecords(
import asyncio
from brevo import AsyncBrevo
- from brevo.custom_objects import UpsertrecordsRequestRecordsItem
+ from brevo.custom_objects import (
+ UpsertrecordsRequestRecordsItem,
+ UpsertrecordsRequestRecordsItemAssociationsItem,
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem,
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers,
+ UpsertrecordsRequestRecordsItemIdentifiers,
+ )
client = AsyncBrevo(
api_key="YOUR_API_KEY",
@@ -282,7 +384,43 @@ async def upsertrecords(
async def main() -> None:
await client.custom_objects.upsertrecords(
object_type="vehicle",
- records=[UpsertrecordsRequestRecordsItem()],
+ records=[
+ UpsertrecordsRequestRecordsItem(
+ associations=[
+ UpsertrecordsRequestRecordsItemAssociationsItem(
+ object_type="garage",
+ action="link",
+ records=[
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem(
+ identifiers=UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers(
+ id=435435,
+ ),
+ )
+ ],
+ ),
+ UpsertrecordsRequestRecordsItemAssociationsItem(
+ object_type="garage",
+ action="unlink",
+ records=[
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem(
+ identifiers=UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers(
+ ext_id="old-garage-001",
+ ),
+ )
+ ],
+ ),
+ ],
+ attributes={
+ "make": "Toyota",
+ "model": "Camry",
+ "year": 2020,
+ "engine_type": "hybrid",
+ },
+ identifiers=UpsertrecordsRequestRecordsItemIdentifiers(
+ ext_id="VIN123",
+ ),
+ )
+ ],
)
@@ -309,7 +447,7 @@ async def getrecords(
Parameters
----------
object_type : str
- object type for the attribute
+ 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.
limit : int
Number of records returned per page
@@ -371,8 +509,8 @@ async def batch_delete_object_records(
) -> BatchDeleteObjectRecordsResponse:
"""
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
Parameters
----------
@@ -380,7 +518,7 @@ async def batch_delete_object_records(
Object type for the records to delete
identifiers : typing.Optional[BatchDeleteObjectRecordsRequestIdentifiers]
- One of the below must be provided
+ Either `ids` or `ext_ids` must be provided, but not both in the same request.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
diff --git a/src/brevo/custom_objects/raw_client.py b/src/brevo/custom_objects/raw_client.py
index 9c6201f..8dce55b 100644
--- a/src/brevo/custom_objects/raw_client.py
+++ b/src/brevo/custom_objects/raw_client.py
@@ -43,29 +43,56 @@ def upsertrecords(
"""
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".
Parameters
----------
object_type : str
- object type for the attribute
+ 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).
records : typing.Sequence[UpsertrecordsRequestRecordsItem]
List of object records to be upsert. Each record can have attributes, identifiers, and associations.
@@ -173,7 +200,7 @@ def getrecords(
Parameters
----------
object_type : str
- object type for the attribute
+ 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.
limit : int
Number of records returned per page
@@ -278,8 +305,8 @@ def batch_delete_object_records(
) -> HttpResponse[BatchDeleteObjectRecordsResponse]:
"""
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
Parameters
----------
@@ -287,7 +314,7 @@ def batch_delete_object_records(
Object type for the records to delete
identifiers : typing.Optional[BatchDeleteObjectRecordsRequestIdentifiers]
- One of the below must be provided
+ Either `ids` or `ext_ids` must be provided, but not both in the same request.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -343,17 +370,6 @@ def batch_delete_object_records(
),
),
)
- if _response.status_code == 404:
- raise NotFoundError(
- headers=dict(_response.headers),
- body=typing.cast(
- typing.Any,
- construct_type(
- type_=typing.Any, # type: ignore
- object_=_response.json(),
- ),
- ),
- )
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
@@ -389,29 +405,56 @@ async def upsertrecords(
"""
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".
Parameters
----------
object_type : str
- object type for the attribute
+ 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).
records : typing.Sequence[UpsertrecordsRequestRecordsItem]
List of object records to be upsert. Each record can have attributes, identifiers, and associations.
@@ -519,7 +562,7 @@ async def getrecords(
Parameters
----------
object_type : str
- object type for the attribute
+ 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.
limit : int
Number of records returned per page
@@ -624,8 +667,8 @@ async def batch_delete_object_records(
) -> AsyncHttpResponse[BatchDeleteObjectRecordsResponse]:
"""
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
Parameters
----------
@@ -633,7 +676,7 @@ async def batch_delete_object_records(
Object type for the records to delete
identifiers : typing.Optional[BatchDeleteObjectRecordsRequestIdentifiers]
- One of the below must be provided
+ Either `ids` or `ext_ids` must be provided, but not both in the same request.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -689,17 +732,6 @@ async def batch_delete_object_records(
),
),
)
- if _response.status_code == 404:
- raise NotFoundError(
- headers=dict(_response.headers),
- body=typing.cast(
- typing.Any,
- construct_type(
- type_=typing.Any, # type: ignore
- object_=_response.json(),
- ),
- ),
- )
if _response.status_code == 500:
raise InternalServerError(
headers=dict(_response.headers),
diff --git a/src/brevo/custom_objects/types/__init__.py b/src/brevo/custom_objects/types/__init__.py
index 9b69374..a293d7e 100644
--- a/src/brevo/custom_objects/types/__init__.py
+++ b/src/brevo/custom_objects/types/__init__.py
@@ -54,29 +54,14 @@
from .getrecords_response_records_item_identifiers import GetrecordsResponseRecordsItemIdentifiers
from .upsertrecords_request_records_item import UpsertrecordsRequestRecordsItem
from .upsertrecords_request_records_item_associations_item import UpsertrecordsRequestRecordsItemAssociationsItem
- from .upsertrecords_request_records_item_associations_item_one import (
- UpsertrecordsRequestRecordsItemAssociationsItemOne,
+ from .upsertrecords_request_records_item_associations_item_action import (
+ UpsertrecordsRequestRecordsItemAssociationsItemAction,
)
- from .upsertrecords_request_records_item_associations_item_one_records_item import (
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem,
+ from .upsertrecords_request_records_item_associations_item_records_item import (
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem,
)
- from .upsertrecords_request_records_item_associations_item_one_records_item_one import (
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne,
- )
- from .upsertrecords_request_records_item_associations_item_one_records_item_zero import (
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero,
- )
- from .upsertrecords_request_records_item_associations_item_one_records_item_zero_identifiers import (
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers,
- )
- from .upsertrecords_request_records_item_associations_item_zero import (
- UpsertrecordsRequestRecordsItemAssociationsItemZero,
- )
- from .upsertrecords_request_records_item_associations_item_zero_records_item import (
- UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem,
- )
- from .upsertrecords_request_records_item_associations_item_zero_records_item_identifiers import (
- UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers,
+ from .upsertrecords_request_records_item_associations_item_records_item_identifiers import (
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers,
)
from .upsertrecords_request_records_item_identifiers import UpsertrecordsRequestRecordsItemIdentifiers
from .upsertrecords_response import UpsertrecordsResponse
@@ -105,14 +90,9 @@
"GetrecordsResponseRecordsItemIdentifiers": ".getrecords_response_records_item_identifiers",
"UpsertrecordsRequestRecordsItem": ".upsertrecords_request_records_item",
"UpsertrecordsRequestRecordsItemAssociationsItem": ".upsertrecords_request_records_item_associations_item",
- "UpsertrecordsRequestRecordsItemAssociationsItemOne": ".upsertrecords_request_records_item_associations_item_one",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem": ".upsertrecords_request_records_item_associations_item_one_records_item",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne": ".upsertrecords_request_records_item_associations_item_one_records_item_one",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero": ".upsertrecords_request_records_item_associations_item_one_records_item_zero",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers": ".upsertrecords_request_records_item_associations_item_one_records_item_zero_identifiers",
- "UpsertrecordsRequestRecordsItemAssociationsItemZero": ".upsertrecords_request_records_item_associations_item_zero",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem": ".upsertrecords_request_records_item_associations_item_zero_records_item",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers": ".upsertrecords_request_records_item_associations_item_zero_records_item_identifiers",
+ "UpsertrecordsRequestRecordsItemAssociationsItemAction": ".upsertrecords_request_records_item_associations_item_action",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem": ".upsertrecords_request_records_item_associations_item_records_item",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers": ".upsertrecords_request_records_item_associations_item_records_item_identifiers",
"UpsertrecordsRequestRecordsItemIdentifiers": ".upsertrecords_request_records_item_identifiers",
"UpsertrecordsResponse": ".upsertrecords_response",
}
@@ -164,14 +144,9 @@ def __dir__():
"GetrecordsResponseRecordsItemIdentifiers",
"UpsertrecordsRequestRecordsItem",
"UpsertrecordsRequestRecordsItemAssociationsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemOne",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero",
- "UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers",
- "UpsertrecordsRequestRecordsItemAssociationsItemZero",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem",
- "UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers",
+ "UpsertrecordsRequestRecordsItemAssociationsItemAction",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem",
+ "UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers",
"UpsertrecordsRequestRecordsItemIdentifiers",
"UpsertrecordsResponse",
]
diff --git a/src/brevo/custom_objects/types/getrecords_response_records_item.py b/src/brevo/custom_objects/types/getrecords_response_records_item.py
index 7f97e54..25b2b4d 100644
--- a/src/brevo/custom_objects/types/getrecords_response_records_item.py
+++ b/src/brevo/custom_objects/types/getrecords_response_records_item.py
@@ -22,7 +22,8 @@ class GetrecordsResponseRecordsItem(UncheckedBaseModel):
attributes: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
"""
- 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).
"""
created_at: typing_extensions.Annotated[
@@ -32,7 +33,9 @@ class GetrecordsResponseRecordsItem(UncheckedBaseModel):
] = None
identifiers: typing.Optional[GetrecordsResponseRecordsItemIdentifiers] = pydantic.Field(default=None)
"""
- 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.
"""
updated_at: typing_extensions.Annotated[
diff --git a/src/brevo/custom_objects/types/getrecords_response_records_item_identifiers.py b/src/brevo/custom_objects/types/getrecords_response_records_item_identifiers.py
index 42abd91..30cf471 100644
--- a/src/brevo/custom_objects/types/getrecords_response_records_item_identifiers.py
+++ b/src/brevo/custom_objects/types/getrecords_response_records_item_identifiers.py
@@ -9,17 +9,19 @@
class GetrecordsResponseRecordsItemIdentifiers(UncheckedBaseModel):
"""
- 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.
"""
ext_id: typing.Optional[str] = pydantic.Field(default=None)
"""
- ext_id is ID of record in the external system that client_dev want to store in the object system.
+ External ID of the record in your system.
"""
id: typing.Optional[int] = pydantic.Field(default=None)
"""
- Internal ID of the object record generated by Brevo
+ Internal ID of the object record generated by Brevo.
"""
if IS_PYDANTIC_V2:
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item.py
index 151d903..d97c297 100644
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item.py
+++ b/src/brevo/custom_objects/types/upsertrecords_request_records_item.py
@@ -10,15 +10,32 @@
class UpsertrecordsRequestRecordsItem(UncheckedBaseModel):
- associations: typing.Optional[typing.List[UpsertrecordsRequestRecordsItemAssociationsItem]] = None
+ associations: typing.Optional[typing.List[UpsertrecordsRequestRecordsItemAssociationsItem]] = pydantic.Field(
+ default=None
+ )
+ """
+ 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.
+ """
+
attributes: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
"""
- 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"]`.
"""
identifiers: typing.Optional[UpsertrecordsRequestRecordsItemIdentifiers] = pydantic.Field(default=None)
"""
- 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.
"""
if IS_PYDANTIC_V2:
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item.py
index 64ebc4c..b3e7b3a 100644
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item.py
+++ b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item.py
@@ -2,11 +2,35 @@
import typing
-from .upsertrecords_request_records_item_associations_item_one import UpsertrecordsRequestRecordsItemAssociationsItemOne
-from .upsertrecords_request_records_item_associations_item_zero import (
- UpsertrecordsRequestRecordsItemAssociationsItemZero,
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .upsertrecords_request_records_item_associations_item_action import (
+ UpsertrecordsRequestRecordsItemAssociationsItemAction,
)
+from .upsertrecords_request_records_item_associations_item_records_item import (
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem,
+)
+
+
+class UpsertrecordsRequestRecordsItemAssociationsItem(UncheckedBaseModel):
+ object_type: str = pydantic.Field()
+ """
+ Type of the associated object
+ """
+
+ action: typing.Optional[UpsertrecordsRequestRecordsItemAssociationsItemAction] = pydantic.Field(default=None)
+ """
+ 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.
+ """
+
+ records: typing.List[UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
-UpsertrecordsRequestRecordsItemAssociationsItem = typing.Union[
- UpsertrecordsRequestRecordsItemAssociationsItemZero, UpsertrecordsRequestRecordsItemAssociationsItemOne
-]
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_action.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_action.py
new file mode 100644
index 0000000..2400de9
--- /dev/null
+++ b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_action.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+UpsertrecordsRequestRecordsItemAssociationsItemAction = typing.Union[typing.Literal["link", "unlink"], typing.Any]
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one.py
deleted file mode 100644
index 2530883..0000000
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ...core.pydantic_utilities import IS_PYDANTIC_V2
-from ...core.unchecked_base_model import UncheckedBaseModel
-from .upsertrecords_request_records_item_associations_item_one_records_item import (
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem,
-)
-
-
-class UpsertrecordsRequestRecordsItemAssociationsItemOne(UncheckedBaseModel):
- object_type: typing.Optional[str] = pydantic.Field(default=None)
- """
- Type of the associated object
- """
-
- records: typing.Optional[typing.List[UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem]] = None
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item.py
deleted file mode 100644
index 718b141..0000000
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-from .upsertrecords_request_records_item_associations_item_one_records_item_one import (
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne,
-)
-from .upsertrecords_request_records_item_associations_item_one_records_item_zero import (
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero,
-)
-
-UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItem = typing.Union[
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero,
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemOne,
-]
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero.py
deleted file mode 100644
index dc07d72..0000000
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ...core.pydantic_utilities import IS_PYDANTIC_V2
-from ...core.unchecked_base_model import UncheckedBaseModel
-from .upsertrecords_request_records_item_associations_item_one_records_item_zero_identifiers import (
- UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers,
-)
-
-
-class UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZero(UncheckedBaseModel):
- identifiers: typing.Optional[UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers] = (
- pydantic.Field(default=None)
- )
- """
- Identifiers attached with the associated object record. It can be ext_id or id. NOTE: - Either ext_id or id is required, if both are not provided, then error will be returned. - Both ext_id and id cannot be provided in the same request.
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero_identifiers.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero_identifiers.py
deleted file mode 100644
index 9ae5150..0000000
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_one_records_item_zero_identifiers.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ...core.pydantic_utilities import IS_PYDANTIC_V2
-from ...core.unchecked_base_model import UncheckedBaseModel
-
-
-class UpsertrecordsRequestRecordsItemAssociationsItemOneRecordsItemZeroIdentifiers(UncheckedBaseModel):
- """
- Identifiers attached with the associated object record. It can be ext_id or id. NOTE: - Either ext_id or id is required, if both are not provided, then error will be returned. - Both ext_id and id cannot be provided in the same request.
- """
-
- ext_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- ext_id is ID of record in the external system that client_dev want to store in the object system.
- """
-
- id: typing.Optional[int] = pydantic.Field(default=None)
- """
- Internal ID of the object record generated by Brevo
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_records_item.py
similarity index 56%
rename from src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item.py
rename to src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_records_item.py
index a037621..6694092 100644
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item.py
+++ b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_records_item.py
@@ -5,13 +5,18 @@
import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.unchecked_base_model import UncheckedBaseModel
-from .upsertrecords_request_records_item_associations_item_zero_records_item_identifiers import (
- UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers,
+from .upsertrecords_request_records_item_associations_item_records_item_identifiers import (
+ UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers,
)
-class UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem(UncheckedBaseModel):
- identifiers: typing.Optional[UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers] = None
+class UpsertrecordsRequestRecordsItemAssociationsItemRecordsItem(UncheckedBaseModel):
+ identifiers: typing.Optional[UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers] = (
+ pydantic.Field(default=None)
+ )
+ """
+ Identifiers for the associated object record. Provide either `ext_id` or `id`.
+ """
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item_identifiers.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_records_item_identifiers.py
similarity index 67%
rename from src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item_identifiers.py
rename to src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_records_item_identifiers.py
index 92c4e9e..7177c38 100644
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero_records_item_identifiers.py
+++ b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_records_item_identifiers.py
@@ -7,15 +7,19 @@
from ...core.unchecked_base_model import UncheckedBaseModel
-class UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItemIdentifiers(UncheckedBaseModel):
+class UpsertrecordsRequestRecordsItemAssociationsItemRecordsItemIdentifiers(UncheckedBaseModel):
+ """
+ Identifiers for the associated object record. Provide either `ext_id` or `id`.
+ """
+
ext_id: typing.Optional[str] = pydantic.Field(default=None)
"""
- ext_id is ID of record in the external system that client_dev want to store in the object system.
+ External ID of the associated record in your system.
"""
id: typing.Optional[int] = pydantic.Field(default=None)
"""
- Internal ID of the object record generated by Brevo
+ Internal ID of the associated object record generated by Brevo.
"""
if IS_PYDANTIC_V2:
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero.py
deleted file mode 100644
index b2b870b..0000000
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_associations_item_zero.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ...core.pydantic_utilities import IS_PYDANTIC_V2
-from ...core.unchecked_base_model import UncheckedBaseModel
-from .upsertrecords_request_records_item_associations_item_zero_records_item import (
- UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem,
-)
-
-
-class UpsertrecordsRequestRecordsItemAssociationsItemZero(UncheckedBaseModel):
- object_type: typing.Optional[str] = pydantic.Field(default=None)
- """
- Type of the associated object
- """
-
- records: typing.Optional[typing.List[UpsertrecordsRequestRecordsItemAssociationsItemZeroRecordsItem]] = None
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/brevo/custom_objects/types/upsertrecords_request_records_item_identifiers.py b/src/brevo/custom_objects/types/upsertrecords_request_records_item_identifiers.py
index e56e74b..7d15097 100644
--- a/src/brevo/custom_objects/types/upsertrecords_request_records_item_identifiers.py
+++ b/src/brevo/custom_objects/types/upsertrecords_request_records_item_identifiers.py
@@ -9,12 +9,17 @@
class UpsertrecordsRequestRecordsItemIdentifiers(UncheckedBaseModel):
"""
- 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.
"""
ext_id: typing.Optional[str] = pydantic.Field(default=None)
"""
- ext_id is ID of record in the external system that client_dev want to store in the object system.
+ ext_id is ID of record in the external system that client wants to store in the object system.
"""
id: typing.Optional[int] = pydantic.Field(default=None)
diff --git a/src/brevo/deals/__init__.py b/src/brevo/deals/__init__.py
index 4344771..f426944 100644
--- a/src/brevo/deals/__init__.py
+++ b/src/brevo/deals/__init__.py
@@ -8,6 +8,7 @@
if typing.TYPE_CHECKING:
from .types import (
GetCrmAttributesDealsResponseItem,
+ GetCrmAttributesDealsResponseItemAttributeOptionsItem,
GetCrmDealsRequestSort,
GetCrmDealsResponse,
PostCrmDealsImportResponse,
@@ -15,6 +16,7 @@
)
_dynamic_imports: typing.Dict[str, str] = {
"GetCrmAttributesDealsResponseItem": ".types",
+ "GetCrmAttributesDealsResponseItemAttributeOptionsItem": ".types",
"GetCrmDealsRequestSort": ".types",
"GetCrmDealsResponse": ".types",
"PostCrmDealsImportResponse": ".types",
@@ -45,6 +47,7 @@ def __dir__():
__all__ = [
"GetCrmAttributesDealsResponseItem",
+ "GetCrmAttributesDealsResponseItemAttributeOptionsItem",
"GetCrmDealsRequestSort",
"GetCrmDealsResponse",
"PostCrmDealsImportResponse",
diff --git a/src/brevo/deals/client.py b/src/brevo/deals/client.py
index 6ec5a44..de40ac8 100644
--- a/src/brevo/deals/client.py
+++ b/src/brevo/deals/client.py
@@ -38,6 +38,8 @@ def get_deal_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[GetCrmAttributesDealsResponseItem]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -71,9 +73,12 @@ def get_all_deals(
offset: typing.Optional[int] = None,
limit: typing.Optional[int] = None,
sort: typing.Optional[GetCrmDealsRequestSort] = None,
+ sort_by: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetCrmDealsResponse:
"""
+ 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.
+
Parameters
----------
filters_attributes_deal_name : typing.Optional[str]
@@ -83,13 +88,13 @@ def get_all_deals(
Filter by linked companies ids
filters_linked_contacts_ids : typing.Optional[str]
- Filter by linked companies ids
+ Filter by linked contacts ids
modified_since : typing.Optional[str]
- 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.
+ 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.
created_since : typing.Optional[str]
- 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.
+ 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.
offset : typing.Optional[int]
Index of the first document of the page
@@ -100,6 +105,9 @@ def get_all_deals(
sort : typing.Optional[GetCrmDealsRequestSort]
Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed
+ sort_by : typing.Optional[str]
+ The field used to sort field names.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -126,6 +134,7 @@ def get_all_deals(
offset=offset,
limit=limit,
sort=sort,
+ sort_by=sort_by,
request_options=request_options,
)
return _response.data
@@ -140,6 +149,8 @@ def create_a_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> PostCrmDealsResponse:
"""
+ 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.
+
Parameters
----------
name : str
@@ -201,7 +212,7 @@ def import_deals_creation_and_updation(
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
} ```
@@ -238,6 +249,8 @@ def link_and_unlink_a_deal_with_contacts_and_companies(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -284,6 +297,8 @@ def link_and_unlink_a_deal_with_contacts_and_companies(
def get_a_deal(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Deal:
"""
+ 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.
+
Parameters
----------
id : str
@@ -312,6 +327,8 @@ def get_a_deal(self, id: str, *, request_options: typing.Optional[RequestOptions
def delete_a_deal(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -348,6 +365,8 @@ def update_a_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -356,7 +375,7 @@ def update_a_deal(
Attributes for deal update To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}`
linked_companies_ids : typing.Optional[typing.Sequence[str]]
- Warning - Using PATCH on linkedCompaniesIds replaces the list of linked contacts. Omitted IDs will be removed.
+ Warning - Using PATCH on linkedCompaniesIds replaces the list of linked companies. Omitted IDs will be removed.
linked_contacts_ids : typing.Optional[typing.Sequence[int]]
Warning - Using PATCH on linkedContactIds replaces the list of linked contacts. Omitted IDs will be removed.
@@ -420,6 +439,8 @@ def get_pipeline_stages(self, *, request_options: typing.Optional[RequestOptions
def get_all_pipelines(self, *, request_options: typing.Optional[RequestOptions] = None) -> Pipelines:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -428,7 +449,7 @@ def get_all_pipelines(self, *, request_options: typing.Optional[RequestOptions]
Returns
-------
Pipelines
- Returns list of pipelines and and there details
+ Returns list of pipelines and their details
Examples
--------
@@ -444,6 +465,8 @@ def get_all_pipelines(self, *, request_options: typing.Optional[RequestOptions]
def get_a_pipeline(self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Pipelines:
"""
+ 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.
+
Parameters
----------
pipeline_id : str
@@ -490,6 +513,8 @@ async def get_deal_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[GetCrmAttributesDealsResponseItem]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -531,9 +556,12 @@ async def get_all_deals(
offset: typing.Optional[int] = None,
limit: typing.Optional[int] = None,
sort: typing.Optional[GetCrmDealsRequestSort] = None,
+ sort_by: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetCrmDealsResponse:
"""
+ 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.
+
Parameters
----------
filters_attributes_deal_name : typing.Optional[str]
@@ -543,13 +571,13 @@ async def get_all_deals(
Filter by linked companies ids
filters_linked_contacts_ids : typing.Optional[str]
- Filter by linked companies ids
+ Filter by linked contacts ids
modified_since : typing.Optional[str]
- 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.
+ 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.
created_since : typing.Optional[str]
- 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.
+ 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.
offset : typing.Optional[int]
Index of the first document of the page
@@ -560,6 +588,9 @@ async def get_all_deals(
sort : typing.Optional[GetCrmDealsRequestSort]
Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed
+ sort_by : typing.Optional[str]
+ The field used to sort field names.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -594,6 +625,7 @@ async def main() -> None:
offset=offset,
limit=limit,
sort=sort,
+ sort_by=sort_by,
request_options=request_options,
)
return _response.data
@@ -608,6 +640,8 @@ async def create_a_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> PostCrmDealsResponse:
"""
+ 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.
+
Parameters
----------
name : str
@@ -677,7 +711,7 @@ async def import_deals_creation_and_updation(
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
} ```
@@ -722,6 +756,8 @@ async def link_and_unlink_a_deal_with_contacts_and_companies(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -776,6 +812,8 @@ async def main() -> None:
async def get_a_deal(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Deal:
"""
+ 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.
+
Parameters
----------
id : str
@@ -812,6 +850,8 @@ async def main() -> None:
async def delete_a_deal(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -856,6 +896,8 @@ async def update_a_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -864,7 +906,7 @@ async def update_a_deal(
Attributes for deal update To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}`
linked_companies_ids : typing.Optional[typing.Sequence[str]]
- Warning - Using PATCH on linkedCompaniesIds replaces the list of linked contacts. Omitted IDs will be removed.
+ Warning - Using PATCH on linkedCompaniesIds replaces the list of linked companies. Omitted IDs will be removed.
linked_contacts_ids : typing.Optional[typing.Sequence[int]]
Warning - Using PATCH on linkedContactIds replaces the list of linked contacts. Omitted IDs will be removed.
@@ -944,6 +986,8 @@ async def main() -> None:
async def get_all_pipelines(self, *, request_options: typing.Optional[RequestOptions] = None) -> Pipelines:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -952,7 +996,7 @@ async def get_all_pipelines(self, *, request_options: typing.Optional[RequestOpt
Returns
-------
Pipelines
- Returns list of pipelines and and there details
+ Returns list of pipelines and their details
Examples
--------
@@ -978,6 +1022,8 @@ async def get_a_pipeline(
self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> Pipelines:
"""
+ 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.
+
Parameters
----------
pipeline_id : str
diff --git a/src/brevo/deals/raw_client.py b/src/brevo/deals/raw_client.py
index f241764..3fa1865 100644
--- a/src/brevo/deals/raw_client.py
+++ b/src/brevo/deals/raw_client.py
@@ -36,6 +36,8 @@ def get_deal_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[typing.List[GetCrmAttributesDealsResponseItem]]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -61,6 +63,17 @@ def get_deal_attributes(
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -81,9 +94,12 @@ def get_all_deals(
offset: typing.Optional[int] = None,
limit: typing.Optional[int] = None,
sort: typing.Optional[GetCrmDealsRequestSort] = None,
+ sort_by: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetCrmDealsResponse]:
"""
+ 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.
+
Parameters
----------
filters_attributes_deal_name : typing.Optional[str]
@@ -93,13 +109,13 @@ def get_all_deals(
Filter by linked companies ids
filters_linked_contacts_ids : typing.Optional[str]
- Filter by linked companies ids
+ Filter by linked contacts ids
modified_since : typing.Optional[str]
- 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.
+ 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.
created_since : typing.Optional[str]
- 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.
+ 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.
offset : typing.Optional[int]
Index of the first document of the page
@@ -110,6 +126,9 @@ def get_all_deals(
sort : typing.Optional[GetCrmDealsRequestSort]
Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed
+ sort_by : typing.Optional[str]
+ The field used to sort field names.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -130,6 +149,7 @@ def get_all_deals(
"offset": offset,
"limit": limit,
"sort": sort,
+ "sortBy": sort_by,
},
request_options=request_options,
)
@@ -173,6 +193,8 @@ def create_a_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[PostCrmDealsResponse]:
"""
+ 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.
+
Parameters
----------
name : str
@@ -259,7 +281,7 @@ def import_deals_creation_and_updation(
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
} ```
@@ -325,6 +347,8 @@ def link_and_unlink_a_deal_with_contacts_and_companies(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -388,6 +412,8 @@ def link_and_unlink_a_deal_with_contacts_and_companies(
def get_a_deal(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Deal]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -448,6 +474,8 @@ def get_a_deal(self, id: str, *, request_options: typing.Optional[RequestOptions
def delete_a_deal(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -509,6 +537,8 @@ def update_a_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -517,7 +547,7 @@ def update_a_deal(
Attributes for deal update To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}`
linked_companies_ids : typing.Optional[typing.Sequence[str]]
- Warning - Using PATCH on linkedCompaniesIds replaces the list of linked contacts. Omitted IDs will be removed.
+ Warning - Using PATCH on linkedCompaniesIds replaces the list of linked companies. Omitted IDs will be removed.
linked_contacts_ids : typing.Optional[typing.Sequence[int]]
Warning - Using PATCH on linkedContactIds replaces the list of linked contacts. Omitted IDs will be removed.
@@ -610,6 +640,17 @@ def get_pipeline_stages(self, *, request_options: typing.Optional[RequestOptions
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -621,6 +662,8 @@ def get_pipeline_stages(self, *, request_options: typing.Optional[RequestOptions
def get_all_pipelines(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Pipelines]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -629,7 +672,7 @@ def get_all_pipelines(self, *, request_options: typing.Optional[RequestOptions]
Returns
-------
HttpResponse[Pipelines]
- Returns list of pipelines and and there details
+ Returns list of pipelines and their details
"""
_response = self._client_wrapper.httpx_client.request(
"crm/pipeline/details/all",
@@ -670,6 +713,8 @@ def get_a_pipeline(
self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[Pipelines]:
"""
+ 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.
+
Parameters
----------
pipeline_id : str
@@ -726,6 +771,8 @@ async def get_deal_attributes(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[typing.List[GetCrmAttributesDealsResponseItem]]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -751,6 +798,17 @@ async def get_deal_attributes(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -771,9 +829,12 @@ async def get_all_deals(
offset: typing.Optional[int] = None,
limit: typing.Optional[int] = None,
sort: typing.Optional[GetCrmDealsRequestSort] = None,
+ sort_by: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetCrmDealsResponse]:
"""
+ 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.
+
Parameters
----------
filters_attributes_deal_name : typing.Optional[str]
@@ -783,13 +844,13 @@ async def get_all_deals(
Filter by linked companies ids
filters_linked_contacts_ids : typing.Optional[str]
- Filter by linked companies ids
+ Filter by linked contacts ids
modified_since : typing.Optional[str]
- 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.
+ 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.
created_since : typing.Optional[str]
- 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.
+ 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.
offset : typing.Optional[int]
Index of the first document of the page
@@ -800,6 +861,9 @@ async def get_all_deals(
sort : typing.Optional[GetCrmDealsRequestSort]
Sort the results in the ascending/descending order. Default order is **descending** by creation if `sort` is not passed
+ sort_by : typing.Optional[str]
+ The field used to sort field names.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -820,6 +884,7 @@ async def get_all_deals(
"offset": offset,
"limit": limit,
"sort": sort,
+ "sortBy": sort_by,
},
request_options=request_options,
)
@@ -863,6 +928,8 @@ async def create_a_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[PostCrmDealsResponse]:
"""
+ 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.
+
Parameters
----------
name : str
@@ -949,7 +1016,7 @@ async def import_deals_creation_and_updation(
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
} ```
@@ -1015,6 +1082,8 @@ async def link_and_unlink_a_deal_with_contacts_and_companies(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1080,6 +1149,8 @@ async def get_a_deal(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[Deal]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1142,6 +1213,8 @@ async def delete_a_deal(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1203,6 +1276,8 @@ async def update_a_deal(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1211,7 +1286,7 @@ async def update_a_deal(
Attributes for deal update To assign owner of a Deal you can send attributes.deal_owner and utilize the account email or ID. If you wish to update the pipeline of a deal you need to provide the `pipeline` and the `deal_stage` Pipeline and deal_stage are ids you can fetch using this endpoint `/crm/pipeline/details/{pipelineID}`
linked_companies_ids : typing.Optional[typing.Sequence[str]]
- Warning - Using PATCH on linkedCompaniesIds replaces the list of linked contacts. Omitted IDs will be removed.
+ Warning - Using PATCH on linkedCompaniesIds replaces the list of linked companies. Omitted IDs will be removed.
linked_contacts_ids : typing.Optional[typing.Sequence[int]]
Warning - Using PATCH on linkedContactIds replaces the list of linked contacts. Omitted IDs will be removed.
@@ -1306,6 +1381,17 @@ async def get_pipeline_stages(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -1319,6 +1405,8 @@ async def get_all_pipelines(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[Pipelines]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -1327,7 +1415,7 @@ async def get_all_pipelines(
Returns
-------
AsyncHttpResponse[Pipelines]
- Returns list of pipelines and and there details
+ Returns list of pipelines and their details
"""
_response = await self._client_wrapper.httpx_client.request(
"crm/pipeline/details/all",
@@ -1368,6 +1456,8 @@ async def get_a_pipeline(
self, pipeline_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[Pipelines]:
"""
+ 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.
+
Parameters
----------
pipeline_id : str
diff --git a/src/brevo/deals/types/__init__.py b/src/brevo/deals/types/__init__.py
index 1c7b99e..e297ed1 100644
--- a/src/brevo/deals/types/__init__.py
+++ b/src/brevo/deals/types/__init__.py
@@ -7,12 +7,16 @@
if typing.TYPE_CHECKING:
from .get_crm_attributes_deals_response_item import GetCrmAttributesDealsResponseItem
+ from .get_crm_attributes_deals_response_item_attribute_options_item import (
+ GetCrmAttributesDealsResponseItemAttributeOptionsItem,
+ )
from .get_crm_deals_request_sort import GetCrmDealsRequestSort
from .get_crm_deals_response import GetCrmDealsResponse
from .post_crm_deals_import_response import PostCrmDealsImportResponse
from .post_crm_deals_response import PostCrmDealsResponse
_dynamic_imports: typing.Dict[str, str] = {
"GetCrmAttributesDealsResponseItem": ".get_crm_attributes_deals_response_item",
+ "GetCrmAttributesDealsResponseItemAttributeOptionsItem": ".get_crm_attributes_deals_response_item_attribute_options_item",
"GetCrmDealsRequestSort": ".get_crm_deals_request_sort",
"GetCrmDealsResponse": ".get_crm_deals_response",
"PostCrmDealsImportResponse": ".post_crm_deals_import_response",
@@ -43,6 +47,7 @@ def __dir__():
__all__ = [
"GetCrmAttributesDealsResponseItem",
+ "GetCrmAttributesDealsResponseItemAttributeOptionsItem",
"GetCrmDealsRequestSort",
"GetCrmDealsResponse",
"PostCrmDealsImportResponse",
diff --git a/src/brevo/deals/types/get_crm_attributes_deals_response_item.py b/src/brevo/deals/types/get_crm_attributes_deals_response_item.py
index 1ded485..2da71d3 100644
--- a/src/brevo/deals/types/get_crm_attributes_deals_response_item.py
+++ b/src/brevo/deals/types/get_crm_attributes_deals_response_item.py
@@ -7,28 +7,46 @@
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.serialization import FieldMetadata
from ...core.unchecked_base_model import UncheckedBaseModel
+from .get_crm_attributes_deals_response_item_attribute_options_item import (
+ GetCrmAttributesDealsResponseItemAttributeOptionsItem,
+)
class GetCrmAttributesDealsResponseItem(UncheckedBaseModel):
"""
- List of attributes
+ Deal attribute details
"""
- attribute_options: typing_extensions.Annotated[
- typing.Optional[typing.List[typing.Dict[str, typing.Any]]],
- FieldMetadata(alias="attributeOptions"),
- pydantic.Field(alias="attributeOptions"),
+ internal_name: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="internalName"),
+ pydantic.Field(alias="internalName", description="Internal name of the attribute"),
] = None
attribute_type_name: typing_extensions.Annotated[
- typing.Optional[str], FieldMetadata(alias="attributeTypeName"), pydantic.Field(alias="attributeTypeName")
+ typing.Optional[str],
+ FieldMetadata(alias="attributeTypeName"),
+ pydantic.Field(alias="attributeTypeName", description="Type of the attribute"),
] = None
- internal_name: typing_extensions.Annotated[
- typing.Optional[str], FieldMetadata(alias="internalName"), pydantic.Field(alias="internalName")
+ label: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Display label of the attribute
+ """
+
+ attribute_options: typing_extensions.Annotated[
+ typing.Optional[typing.List[GetCrmAttributesDealsResponseItemAttributeOptionsItem]],
+ FieldMetadata(alias="attributeOptions"),
+ pydantic.Field(alias="attributeOptions", description="Options for single-select or multi-choice attributes"),
] = None
is_required: typing_extensions.Annotated[
- typing.Optional[bool], FieldMetadata(alias="isRequired"), pydantic.Field(alias="isRequired")
+ typing.Optional[bool],
+ FieldMetadata(alias="isRequired"),
+ pydantic.Field(alias="isRequired", description="Whether this attribute is required"),
+ ] = None
+ is_value_readonly: typing_extensions.Annotated[
+ typing.Optional[bool],
+ FieldMetadata(alias="isValueReadonly"),
+ pydantic.Field(alias="isValueReadonly", description="Whether this attribute value is read-only"),
] = None
- label: typing.Optional[str] = None
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
diff --git a/src/brevo/deals/types/get_crm_attributes_deals_response_item_attribute_options_item.py b/src/brevo/deals/types/get_crm_attributes_deals_response_item_attribute_options_item.py
new file mode 100644
index 0000000..f3a0142
--- /dev/null
+++ b/src/brevo/deals/types/get_crm_attributes_deals_response_item_attribute_options_item.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class GetCrmAttributesDealsResponseItemAttributeOptionsItem(UncheckedBaseModel):
+ key: typing.Optional[str] = None
+ value: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/brevo/ecommerce/__init__.py b/src/brevo/ecommerce/__init__.py
index 2ec6dc8..01ae7dd 100644
--- a/src/brevo/ecommerce/__init__.py
+++ b/src/brevo/ecommerce/__init__.py
@@ -30,6 +30,7 @@
GetEcommerceConfigDisplayCurrencyResponse,
GetOrdersRequestSort,
GetProductsRequestSort,
+ GetProductsRequestSortByField,
GetProductsResponse,
SetConfigDisplayCurrencyResponse,
)
@@ -57,6 +58,7 @@
"GetEcommerceConfigDisplayCurrencyResponse": ".types",
"GetOrdersRequestSort": ".types",
"GetProductsRequestSort": ".types",
+ "GetProductsRequestSortByField": ".types",
"GetProductsResponse": ".types",
"SetConfigDisplayCurrencyResponse": ".types",
}
@@ -107,6 +109,7 @@ def __dir__():
"GetEcommerceConfigDisplayCurrencyResponse",
"GetOrdersRequestSort",
"GetProductsRequestSort",
+ "GetProductsRequestSortByField",
"GetProductsResponse",
"SetConfigDisplayCurrencyResponse",
]
diff --git a/src/brevo/ecommerce/client.py b/src/brevo/ecommerce/client.py
index 51c8a2e..4088d41 100644
--- a/src/brevo/ecommerce/client.py
+++ b/src/brevo/ecommerce/client.py
@@ -40,6 +40,7 @@
from .types.get_ecommerce_config_display_currency_response import GetEcommerceConfigDisplayCurrencyResponse
from .types.get_orders_request_sort import GetOrdersRequestSort
from .types.get_products_request_sort import GetProductsRequestSort
+from .types.get_products_request_sort_by_field import GetProductsRequestSortByField
from .types.get_products_response import GetProductsResponse
from .types.set_config_display_currency_response import SetConfigDisplayCurrencyResponse
@@ -76,6 +77,8 @@ def get_categories(
request_options: typing.Optional[RequestOptions] = None,
) -> GetCategoriesResponse:
"""
+ 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).
+
Parameters
----------
limit : typing.Optional[int]
@@ -144,6 +147,8 @@ def create_update_category(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[CreateUpdateCategoryResponse]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -202,6 +207,8 @@ def create_update_batch_category(
request_options: typing.Optional[RequestOptions] = None,
) -> CreateUpdateBatchCategoryResponse:
"""
+ 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.
+
Parameters
----------
categories : typing.Sequence[CreateUpdateBatchCategoryRequestCategoriesItem]
@@ -243,6 +250,8 @@ def get_category_info(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetCategoryDetails:
"""
+ 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.
+
Parameters
----------
id : str
@@ -254,7 +263,7 @@ def get_category_info(
Returns
-------
GetCategoryDetails
- Category informations
+ Category details
Examples
--------
@@ -307,6 +316,8 @@ def get_attribution_metrics_for_one_or_more_brevo_campaigns_or_workflows(
request_options: typing.Optional[RequestOptions] = None,
) -> GetEcommerceAttributionMetricsResponse:
"""
+ 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.
+
Parameters
----------
period_from : typing.Optional[dt.datetime]
@@ -351,6 +362,7 @@ def get_attribution_metrics_for_one_or_more_brevo_campaigns_or_workflows(
period_to=datetime.datetime.fromisoformat(
"2022-01-03 00:00:00+00:00",
),
+ email_campaign_id_array=["sale"],
)
"""
_response = self._raw_client.get_attribution_metrics_for_one_or_more_brevo_campaigns_or_workflows(
@@ -372,6 +384,8 @@ def get_detailed_attribution_metrics_for_a_single_brevo_campaign_or_workflow(
request_options: typing.Optional[RequestOptions] = None,
) -> GetEcommerceAttributionMetricsConversionSourceConversionSourceIdResponse:
"""
+ 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.
+
Parameters
----------
conversion_source : GetEcommerceAttributionMetricsConversionSourceConversionSourceIdRequestConversionSource
@@ -413,6 +427,8 @@ def get_attributed_product_sales_for_a_single_brevo_campaign_or_workflow(
request_options: typing.Optional[RequestOptions] = None,
) -> GetEcommerceAttributionProductsConversionSourceConversionSourceIdResponse:
"""
+ 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`.
+
Parameters
----------
conversion_source : GetEcommerceAttributionProductsConversionSourceConversionSourceIdRequestConversionSource
@@ -450,6 +466,8 @@ def get_the_iso4217compliant_display_currency_code_for_your_brevo_account(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> GetEcommerceConfigDisplayCurrencyResponse:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -478,6 +496,8 @@ def set_config_display_currency(
self, *, code: str, request_options: typing.Optional[RequestOptions] = None
) -> SetConfigDisplayCurrencyResponse:
"""
+ 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.
+
Parameters
----------
code : str
@@ -610,7 +630,7 @@ def create_order(
Identifies the contact associated with the order.
meta_info : typing.Optional[typing.Dict[str, OrderMetaInfoValue]]
- Meta data of order to store additional detal such as custom message, customer type, source.
+ Meta data of order to store additional detail such as custom message, customer type, source.
store_id : typing.Optional[str]
ID of store where the order is placed
@@ -676,10 +696,10 @@ def create_batch_order(
array of order objects
historical : typing.Optional[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.
+ 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.
notify_url : typing.Optional[str]
- Notify Url provided by client_dev to get the status of batch request
+ Webhook URL to receive the status of the batch request
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -726,6 +746,7 @@ def get_products(
offset: typing.Optional[int] = None,
sort: typing.Optional[GetProductsRequestSort] = None,
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
+ search: typing.Optional[str] = None,
name: typing.Optional[str] = None,
price_lte: typing.Optional[float] = None,
price_gte: typing.Optional[float] = None,
@@ -733,13 +754,22 @@ def get_products(
price_gt: typing.Optional[float] = None,
price_eq: typing.Optional[float] = None,
price_ne: typing.Optional[float] = None,
+ alternative_price_lte: typing.Optional[float] = None,
+ alternative_price_gte: typing.Optional[float] = None,
+ alternative_price_lt: typing.Optional[float] = None,
+ alternative_price_gt: typing.Optional[float] = None,
+ alternative_price_eq: typing.Optional[float] = None,
+ alternative_price_ne: typing.Optional[float] = None,
categories: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
modified_since: typing.Optional[str] = None,
created_since: typing.Optional[str] = None,
+ sort_by_field: typing.Optional[GetProductsRequestSortByField] = None,
is_deleted: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetProductsResponse:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -754,6 +784,9 @@ def get_products(
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Filter by product ids
+ search : typing.Optional[str]
+ 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 : typing.Optional[str]
Filter by product name, minimum 3 characters should be present for search.
@@ -775,14 +808,35 @@ def get_products(
price_ne : typing.Optional[float]
Price filter for products not equals to particular amount
+ alternative_price_lte : typing.Optional[float]
+ Alternative price filter for products less than and equals to particular amount
+
+ alternative_price_gte : typing.Optional[float]
+ Alternative price filter for products greater than and equals to particular amount
+
+ alternative_price_lt : typing.Optional[float]
+ Alternative price filter for products less than particular amount
+
+ alternative_price_gt : typing.Optional[float]
+ Alternative price filter for products greater than particular amount
+
+ alternative_price_eq : typing.Optional[float]
+ Alternative price filter for products equals to particular amount
+
+ alternative_price_ne : typing.Optional[float]
+ Alternative price filter for products not equals to particular amount
+
categories : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Filter by categories ids
modified_since : typing.Optional[str]
- 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.**
+ 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.**
created_since : typing.Optional[str]
- 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.**
+ 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.**
+
+ sort_by_field : typing.Optional[GetProductsRequestSortByField]
+ Sort the results by a specific field. Default sort field is `created_at` when not passed.
is_deleted : typing.Optional[str]
Filter products by their deletion status. If `false` is passed, only products that are not deleted will be returned.
@@ -809,6 +863,7 @@ def get_products(
offset=offset,
sort=sort,
ids=ids,
+ search=search,
name=name,
price_lte=price_lte,
price_gte=price_gte,
@@ -816,9 +871,16 @@ def get_products(
price_gt=price_gt,
price_eq=price_eq,
price_ne=price_ne,
+ alternative_price_lte=alternative_price_lte,
+ alternative_price_gte=alternative_price_gte,
+ alternative_price_lt=alternative_price_lt,
+ alternative_price_gt=alternative_price_gt,
+ alternative_price_eq=alternative_price_eq,
+ alternative_price_ne=alternative_price_ne,
categories=categories,
modified_since=modified_since,
created_since=created_since,
+ sort_by_field=sort_by_field,
is_deleted=is_deleted,
request_options=request_options,
)
@@ -838,6 +900,7 @@ def create_update_product(
meta_info: typing.Optional[typing.Dict[str, CreateUpdateProductRequestMetaInfoValue]] = OMIT,
parent_id: typing.Optional[str] = OMIT,
price: typing.Optional[float] = OMIT,
+ alternative_price: typing.Optional[float] = OMIT,
sku: typing.Optional[str] = OMIT,
stock: typing.Optional[float] = OMIT,
update_enabled: typing.Optional[bool] = OMIT,
@@ -845,13 +908,15 @@ def create_update_product(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[CreateUpdateProductResponse]:
"""
+ 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.
+
Parameters
----------
id : str
Product ID for which you requested the details
name : str
- Mandatory in case of creation**. Name of the product for which you requested the details
+ **Mandatory in case of creation**. Name of the product, as displayed in the shop
brand : typing.Optional[str]
Brand of the product
@@ -880,6 +945,9 @@ def create_update_product(
price : typing.Optional[float]
Price of the product
+ alternative_price : typing.Optional[float]
+ Alternative price of the product
+
sku : typing.Optional[str]
Product identifier from the shop
@@ -887,7 +955,7 @@ def create_update_product(
Current stock value of the product from the shop's database
update_enabled : typing.Optional[bool]
- Facilitate to update the existing category in the same request (updateEnabled = true)
+ Facilitate to update the existing product in the same request (updateEnabled = true)
url : typing.Optional[str]
URL to the product
@@ -924,6 +992,7 @@ def create_update_product(
meta_info=meta_info,
parent_id=parent_id,
price=price,
+ alternative_price=alternative_price,
sku=sku,
stock=stock,
update_enabled=update_enabled,
@@ -940,13 +1009,15 @@ def create_update_batch_products(
request_options: typing.Optional[RequestOptions] = None,
) -> CreateUpdateBatchProductsResponse:
"""
+ 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.
+
Parameters
----------
products : typing.Sequence[CreateUpdateBatchProductsRequestProductsItem]
array of products objects
update_enabled : typing.Optional[bool]
- Facilitate to update the existing categories in the same request (updateEnabled = true)
+ Facilitate to update the existing products in the same request (updateEnabled = true)
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -982,6 +1053,8 @@ def get_product_info(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetProductDetails:
"""
+ 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.
+
Parameters
----------
id : str
@@ -993,7 +1066,7 @@ def get_product_info(
Returns
-------
GetProductDetails
- Product informations
+ Product details
Examples
--------
@@ -1017,6 +1090,8 @@ def create_product_alert(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1077,6 +1152,8 @@ async def get_categories(
request_options: typing.Optional[RequestOptions] = None,
) -> GetCategoriesResponse:
"""
+ 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).
+
Parameters
----------
limit : typing.Optional[int]
@@ -1153,6 +1230,8 @@ async def create_update_category(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[CreateUpdateCategoryResponse]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1219,6 +1298,8 @@ async def create_update_batch_category(
request_options: typing.Optional[RequestOptions] = None,
) -> CreateUpdateBatchCategoryResponse:
"""
+ 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.
+
Parameters
----------
categories : typing.Sequence[CreateUpdateBatchCategoryRequestCategoriesItem]
@@ -1268,6 +1349,8 @@ async def get_category_info(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetCategoryDetails:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1279,7 +1362,7 @@ async def get_category_info(
Returns
-------
GetCategoryDetails
- Category informations
+ Category details
Examples
--------
@@ -1348,6 +1431,8 @@ async def get_attribution_metrics_for_one_or_more_brevo_campaigns_or_workflows(
request_options: typing.Optional[RequestOptions] = None,
) -> GetEcommerceAttributionMetricsResponse:
"""
+ 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.
+
Parameters
----------
period_from : typing.Optional[dt.datetime]
@@ -1396,6 +1481,7 @@ async def main() -> None:
period_to=datetime.datetime.fromisoformat(
"2022-01-03 00:00:00+00:00",
),
+ email_campaign_id_array=["sale"],
)
@@ -1420,6 +1506,8 @@ async def get_detailed_attribution_metrics_for_a_single_brevo_campaign_or_workfl
request_options: typing.Optional[RequestOptions] = None,
) -> GetEcommerceAttributionMetricsConversionSourceConversionSourceIdResponse:
"""
+ 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.
+
Parameters
----------
conversion_source : GetEcommerceAttributionMetricsConversionSourceConversionSourceIdRequestConversionSource
@@ -1469,6 +1557,8 @@ async def get_attributed_product_sales_for_a_single_brevo_campaign_or_workflow(
request_options: typing.Optional[RequestOptions] = None,
) -> GetEcommerceAttributionProductsConversionSourceConversionSourceIdResponse:
"""
+ 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`.
+
Parameters
----------
conversion_source : GetEcommerceAttributionProductsConversionSourceConversionSourceIdRequestConversionSource
@@ -1514,6 +1604,8 @@ async def get_the_iso4217compliant_display_currency_code_for_your_brevo_account(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> GetEcommerceConfigDisplayCurrencyResponse:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -1550,6 +1642,8 @@ async def set_config_display_currency(
self, *, code: str, request_options: typing.Optional[RequestOptions] = None
) -> SetConfigDisplayCurrencyResponse:
"""
+ 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.
+
Parameters
----------
code : str
@@ -1698,7 +1792,7 @@ async def create_order(
Identifies the contact associated with the order.
meta_info : typing.Optional[typing.Dict[str, OrderMetaInfoValue]]
- Meta data of order to store additional detal such as custom message, customer type, source.
+ Meta data of order to store additional detail such as custom message, customer type, source.
store_id : typing.Optional[str]
ID of store where the order is placed
@@ -1772,10 +1866,10 @@ async def create_batch_order(
array of order objects
historical : typing.Optional[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.
+ 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.
notify_url : typing.Optional[str]
- Notify Url provided by client_dev to get the status of batch request
+ Webhook URL to receive the status of the batch request
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1830,6 +1924,7 @@ async def get_products(
offset: typing.Optional[int] = None,
sort: typing.Optional[GetProductsRequestSort] = None,
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
+ search: typing.Optional[str] = None,
name: typing.Optional[str] = None,
price_lte: typing.Optional[float] = None,
price_gte: typing.Optional[float] = None,
@@ -1837,13 +1932,22 @@ async def get_products(
price_gt: typing.Optional[float] = None,
price_eq: typing.Optional[float] = None,
price_ne: typing.Optional[float] = None,
+ alternative_price_lte: typing.Optional[float] = None,
+ alternative_price_gte: typing.Optional[float] = None,
+ alternative_price_lt: typing.Optional[float] = None,
+ alternative_price_gt: typing.Optional[float] = None,
+ alternative_price_eq: typing.Optional[float] = None,
+ alternative_price_ne: typing.Optional[float] = None,
categories: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
modified_since: typing.Optional[str] = None,
created_since: typing.Optional[str] = None,
+ sort_by_field: typing.Optional[GetProductsRequestSortByField] = None,
is_deleted: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetProductsResponse:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -1858,6 +1962,9 @@ async def get_products(
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Filter by product ids
+ search : typing.Optional[str]
+ 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 : typing.Optional[str]
Filter by product name, minimum 3 characters should be present for search.
@@ -1879,14 +1986,35 @@ async def get_products(
price_ne : typing.Optional[float]
Price filter for products not equals to particular amount
+ alternative_price_lte : typing.Optional[float]
+ Alternative price filter for products less than and equals to particular amount
+
+ alternative_price_gte : typing.Optional[float]
+ Alternative price filter for products greater than and equals to particular amount
+
+ alternative_price_lt : typing.Optional[float]
+ Alternative price filter for products less than particular amount
+
+ alternative_price_gt : typing.Optional[float]
+ Alternative price filter for products greater than particular amount
+
+ alternative_price_eq : typing.Optional[float]
+ Alternative price filter for products equals to particular amount
+
+ alternative_price_ne : typing.Optional[float]
+ Alternative price filter for products not equals to particular amount
+
categories : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Filter by categories ids
modified_since : typing.Optional[str]
- 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.**
+ 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.**
created_since : typing.Optional[str]
- 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.**
+ 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.**
+
+ sort_by_field : typing.Optional[GetProductsRequestSortByField]
+ Sort the results by a specific field. Default sort field is `created_at` when not passed.
is_deleted : typing.Optional[str]
Filter products by their deletion status. If `false` is passed, only products that are not deleted will be returned.
@@ -1921,6 +2049,7 @@ async def main() -> None:
offset=offset,
sort=sort,
ids=ids,
+ search=search,
name=name,
price_lte=price_lte,
price_gte=price_gte,
@@ -1928,9 +2057,16 @@ async def main() -> None:
price_gt=price_gt,
price_eq=price_eq,
price_ne=price_ne,
+ alternative_price_lte=alternative_price_lte,
+ alternative_price_gte=alternative_price_gte,
+ alternative_price_lt=alternative_price_lt,
+ alternative_price_gt=alternative_price_gt,
+ alternative_price_eq=alternative_price_eq,
+ alternative_price_ne=alternative_price_ne,
categories=categories,
modified_since=modified_since,
created_since=created_since,
+ sort_by_field=sort_by_field,
is_deleted=is_deleted,
request_options=request_options,
)
@@ -1950,6 +2086,7 @@ async def create_update_product(
meta_info: typing.Optional[typing.Dict[str, CreateUpdateProductRequestMetaInfoValue]] = OMIT,
parent_id: typing.Optional[str] = OMIT,
price: typing.Optional[float] = OMIT,
+ alternative_price: typing.Optional[float] = OMIT,
sku: typing.Optional[str] = OMIT,
stock: typing.Optional[float] = OMIT,
update_enabled: typing.Optional[bool] = OMIT,
@@ -1957,13 +2094,15 @@ async def create_update_product(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[CreateUpdateProductResponse]:
"""
+ 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.
+
Parameters
----------
id : str
Product ID for which you requested the details
name : str
- Mandatory in case of creation**. Name of the product for which you requested the details
+ **Mandatory in case of creation**. Name of the product, as displayed in the shop
brand : typing.Optional[str]
Brand of the product
@@ -1992,6 +2131,9 @@ async def create_update_product(
price : typing.Optional[float]
Price of the product
+ alternative_price : typing.Optional[float]
+ Alternative price of the product
+
sku : typing.Optional[str]
Product identifier from the shop
@@ -1999,7 +2141,7 @@ async def create_update_product(
Current stock value of the product from the shop's database
update_enabled : typing.Optional[bool]
- Facilitate to update the existing category in the same request (updateEnabled = true)
+ Facilitate to update the existing product in the same request (updateEnabled = true)
url : typing.Optional[str]
URL to the product
@@ -2044,6 +2186,7 @@ async def main() -> None:
meta_info=meta_info,
parent_id=parent_id,
price=price,
+ alternative_price=alternative_price,
sku=sku,
stock=stock,
update_enabled=update_enabled,
@@ -2060,13 +2203,15 @@ async def create_update_batch_products(
request_options: typing.Optional[RequestOptions] = None,
) -> CreateUpdateBatchProductsResponse:
"""
+ 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.
+
Parameters
----------
products : typing.Sequence[CreateUpdateBatchProductsRequestProductsItem]
array of products objects
update_enabled : typing.Optional[bool]
- Facilitate to update the existing categories in the same request (updateEnabled = true)
+ Facilitate to update the existing products in the same request (updateEnabled = true)
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2110,6 +2255,8 @@ async def get_product_info(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetProductDetails:
"""
+ 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.
+
Parameters
----------
id : str
@@ -2121,7 +2268,7 @@ async def get_product_info(
Returns
-------
GetProductDetails
- Product informations
+ Product details
Examples
--------
@@ -2153,6 +2300,8 @@ async def create_product_alert(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
diff --git a/src/brevo/ecommerce/raw_client.py b/src/brevo/ecommerce/raw_client.py
index b876dd4..1a3741e 100644
--- a/src/brevo/ecommerce/raw_client.py
+++ b/src/brevo/ecommerce/raw_client.py
@@ -53,6 +53,7 @@
from .types.get_ecommerce_config_display_currency_response import GetEcommerceConfigDisplayCurrencyResponse
from .types.get_orders_request_sort import GetOrdersRequestSort
from .types.get_products_request_sort import GetProductsRequestSort
+from .types.get_products_request_sort_by_field import GetProductsRequestSortByField
from .types.get_products_response import GetProductsResponse
from .types.set_config_display_currency_response import SetConfigDisplayCurrencyResponse
from pydantic import ValidationError
@@ -79,6 +80,8 @@ def get_categories(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetCategoriesResponse]:
"""
+ 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).
+
Parameters
----------
limit : typing.Optional[int]
@@ -170,6 +173,8 @@ def create_update_category(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[typing.Optional[CreateUpdateCategoryResponse]]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -255,6 +260,8 @@ def create_update_batch_category(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[CreateUpdateBatchCategoryResponse]:
"""
+ 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.
+
Parameters
----------
categories : typing.Sequence[CreateUpdateBatchCategoryRequestCategoriesItem]
@@ -322,6 +329,8 @@ def get_category_info(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[GetCategoryDetails]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -333,7 +342,7 @@ def get_category_info(
Returns
-------
HttpResponse[GetCategoryDetails]
- Category informations
+ Category details
"""
_response = self._client_wrapper.httpx_client.request(
f"categories/{jsonable_encoder(id)}",
@@ -447,6 +456,8 @@ def get_attribution_metrics_for_one_or_more_brevo_campaigns_or_workflows(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetEcommerceAttributionMetricsResponse]:
"""
+ 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.
+
Parameters
----------
period_from : typing.Optional[dt.datetime]
@@ -526,6 +537,8 @@ def get_detailed_attribution_metrics_for_a_single_brevo_campaign_or_workflow(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetEcommerceAttributionMetricsConversionSourceConversionSourceIdResponse]:
"""
+ 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.
+
Parameters
----------
conversion_source : GetEcommerceAttributionMetricsConversionSourceConversionSourceIdRequestConversionSource
@@ -585,6 +598,8 @@ def get_attributed_product_sales_for_a_single_brevo_campaign_or_workflow(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetEcommerceAttributionProductsConversionSourceConversionSourceIdResponse]:
"""
+ 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`.
+
Parameters
----------
conversion_source : GetEcommerceAttributionProductsConversionSourceConversionSourceIdRequestConversionSource
@@ -640,6 +655,8 @@ def get_the_iso4217compliant_display_currency_code_for_your_brevo_account(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[GetEcommerceConfigDisplayCurrencyResponse]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -711,6 +728,8 @@ def set_config_display_currency(
self, *, code: str, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[SetConfigDisplayCurrencyResponse]:
"""
+ 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.
+
Parameters
----------
code : str
@@ -929,7 +948,7 @@ def create_order(
Identifies the contact associated with the order.
meta_info : typing.Optional[typing.Dict[str, OrderMetaInfoValue]]
- Meta data of order to store additional detal such as custom message, customer type, source.
+ Meta data of order to store additional detail such as custom message, customer type, source.
store_id : typing.Optional[str]
ID of store where the order is placed
@@ -1011,10 +1030,10 @@ def create_batch_order(
array of order objects
historical : typing.Optional[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.
+ 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.
notify_url : typing.Optional[str]
- Notify Url provided by client_dev to get the status of batch request
+ Webhook URL to receive the status of the batch request
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1077,6 +1096,7 @@ def get_products(
offset: typing.Optional[int] = None,
sort: typing.Optional[GetProductsRequestSort] = None,
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
+ search: typing.Optional[str] = None,
name: typing.Optional[str] = None,
price_lte: typing.Optional[float] = None,
price_gte: typing.Optional[float] = None,
@@ -1084,13 +1104,22 @@ def get_products(
price_gt: typing.Optional[float] = None,
price_eq: typing.Optional[float] = None,
price_ne: typing.Optional[float] = None,
+ alternative_price_lte: typing.Optional[float] = None,
+ alternative_price_gte: typing.Optional[float] = None,
+ alternative_price_lt: typing.Optional[float] = None,
+ alternative_price_gt: typing.Optional[float] = None,
+ alternative_price_eq: typing.Optional[float] = None,
+ alternative_price_ne: typing.Optional[float] = None,
categories: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
modified_since: typing.Optional[str] = None,
created_since: typing.Optional[str] = None,
+ sort_by_field: typing.Optional[GetProductsRequestSortByField] = None,
is_deleted: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetProductsResponse]:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -1105,6 +1134,9 @@ def get_products(
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Filter by product ids
+ search : typing.Optional[str]
+ 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 : typing.Optional[str]
Filter by product name, minimum 3 characters should be present for search.
@@ -1126,14 +1158,35 @@ def get_products(
price_ne : typing.Optional[float]
Price filter for products not equals to particular amount
+ alternative_price_lte : typing.Optional[float]
+ Alternative price filter for products less than and equals to particular amount
+
+ alternative_price_gte : typing.Optional[float]
+ Alternative price filter for products greater than and equals to particular amount
+
+ alternative_price_lt : typing.Optional[float]
+ Alternative price filter for products less than particular amount
+
+ alternative_price_gt : typing.Optional[float]
+ Alternative price filter for products greater than particular amount
+
+ alternative_price_eq : typing.Optional[float]
+ Alternative price filter for products equals to particular amount
+
+ alternative_price_ne : typing.Optional[float]
+ Alternative price filter for products not equals to particular amount
+
categories : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Filter by categories ids
modified_since : typing.Optional[str]
- 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.**
+ 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.**
created_since : typing.Optional[str]
- 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.**
+ 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.**
+
+ sort_by_field : typing.Optional[GetProductsRequestSortByField]
+ Sort the results by a specific field. Default sort field is `created_at` when not passed.
is_deleted : typing.Optional[str]
Filter products by their deletion status. If `false` is passed, only products that are not deleted will be returned.
@@ -1154,6 +1207,7 @@ def get_products(
"offset": offset,
"sort": sort,
"ids": ids,
+ "search": search,
"name": name,
"price[lte]": price_lte,
"price[gte]": price_gte,
@@ -1161,9 +1215,16 @@ def get_products(
"price[gt]": price_gt,
"price[eq]": price_eq,
"price[ne]": price_ne,
+ "alternativePrice[lte]": alternative_price_lte,
+ "alternativePrice[gte]": alternative_price_gte,
+ "alternativePrice[lt]": alternative_price_lt,
+ "alternativePrice[gt]": alternative_price_gt,
+ "alternativePrice[eq]": alternative_price_eq,
+ "alternativePrice[ne]": alternative_price_ne,
"categories": categories,
"modifiedSince": modified_since,
"createdSince": created_since,
+ "sortByField": sort_by_field,
"isDeleted": is_deleted,
},
request_options=request_options,
@@ -1212,6 +1273,7 @@ def create_update_product(
meta_info: typing.Optional[typing.Dict[str, CreateUpdateProductRequestMetaInfoValue]] = OMIT,
parent_id: typing.Optional[str] = OMIT,
price: typing.Optional[float] = OMIT,
+ alternative_price: typing.Optional[float] = OMIT,
sku: typing.Optional[str] = OMIT,
stock: typing.Optional[float] = OMIT,
update_enabled: typing.Optional[bool] = OMIT,
@@ -1219,13 +1281,15 @@ def create_update_product(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[typing.Optional[CreateUpdateProductResponse]]:
"""
+ 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.
+
Parameters
----------
id : str
Product ID for which you requested the details
name : str
- Mandatory in case of creation**. Name of the product for which you requested the details
+ **Mandatory in case of creation**. Name of the product, as displayed in the shop
brand : typing.Optional[str]
Brand of the product
@@ -1254,6 +1318,9 @@ def create_update_product(
price : typing.Optional[float]
Price of the product
+ alternative_price : typing.Optional[float]
+ Alternative price of the product
+
sku : typing.Optional[str]
Product identifier from the shop
@@ -1261,7 +1328,7 @@ def create_update_product(
Current stock value of the product from the shop's database
update_enabled : typing.Optional[bool]
- Facilitate to update the existing category in the same request (updateEnabled = true)
+ Facilitate to update the existing product in the same request (updateEnabled = true)
url : typing.Optional[str]
URL to the product
@@ -1293,6 +1360,7 @@ def create_update_product(
"name": name,
"parentId": parent_id,
"price": price,
+ "alternativePrice": alternative_price,
"sku": sku,
"stock": stock,
"updateEnabled": update_enabled,
@@ -1344,13 +1412,15 @@ def create_update_batch_products(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[CreateUpdateBatchProductsResponse]:
"""
+ 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.
+
Parameters
----------
products : typing.Sequence[CreateUpdateBatchProductsRequestProductsItem]
array of products objects
update_enabled : typing.Optional[bool]
- Facilitate to update the existing categories in the same request (updateEnabled = true)
+ Facilitate to update the existing products in the same request (updateEnabled = true)
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1411,6 +1481,8 @@ def get_product_info(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[GetProductDetails]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1422,7 +1494,7 @@ def get_product_info(
Returns
-------
HttpResponse[GetProductDetails]
- Product informations
+ Product details
"""
_response = self._client_wrapper.httpx_client.request(
f"products/{jsonable_encoder(id)}",
@@ -1478,6 +1550,8 @@ def create_product_alert(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1583,6 +1657,8 @@ async def get_categories(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetCategoriesResponse]:
"""
+ 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).
+
Parameters
----------
limit : typing.Optional[int]
@@ -1674,6 +1750,8 @@ async def create_update_category(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[typing.Optional[CreateUpdateCategoryResponse]]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1759,6 +1837,8 @@ async def create_update_batch_category(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[CreateUpdateBatchCategoryResponse]:
"""
+ 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.
+
Parameters
----------
categories : typing.Sequence[CreateUpdateBatchCategoryRequestCategoriesItem]
@@ -1826,6 +1906,8 @@ async def get_category_info(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[GetCategoryDetails]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -1837,7 +1919,7 @@ async def get_category_info(
Returns
-------
AsyncHttpResponse[GetCategoryDetails]
- Category informations
+ Category details
"""
_response = await self._client_wrapper.httpx_client.request(
f"categories/{jsonable_encoder(id)}",
@@ -1951,6 +2033,8 @@ async def get_attribution_metrics_for_one_or_more_brevo_campaigns_or_workflows(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetEcommerceAttributionMetricsResponse]:
"""
+ 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.
+
Parameters
----------
period_from : typing.Optional[dt.datetime]
@@ -2030,6 +2114,8 @@ async def get_detailed_attribution_metrics_for_a_single_brevo_campaign_or_workfl
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetEcommerceAttributionMetricsConversionSourceConversionSourceIdResponse]:
"""
+ 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.
+
Parameters
----------
conversion_source : GetEcommerceAttributionMetricsConversionSourceConversionSourceIdRequestConversionSource
@@ -2089,6 +2175,8 @@ async def get_attributed_product_sales_for_a_single_brevo_campaign_or_workflow(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetEcommerceAttributionProductsConversionSourceConversionSourceIdResponse]:
"""
+ 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`.
+
Parameters
----------
conversion_source : GetEcommerceAttributionProductsConversionSourceConversionSourceIdRequestConversionSource
@@ -2144,6 +2232,8 @@ async def get_the_iso4217compliant_display_currency_code_for_your_brevo_account(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[GetEcommerceConfigDisplayCurrencyResponse]:
"""
+ 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.
+
Parameters
----------
request_options : typing.Optional[RequestOptions]
@@ -2215,6 +2305,8 @@ async def set_config_display_currency(
self, *, code: str, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[SetConfigDisplayCurrencyResponse]:
"""
+ 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.
+
Parameters
----------
code : str
@@ -2433,7 +2525,7 @@ async def create_order(
Identifies the contact associated with the order.
meta_info : typing.Optional[typing.Dict[str, OrderMetaInfoValue]]
- Meta data of order to store additional detal such as custom message, customer type, source.
+ Meta data of order to store additional detail such as custom message, customer type, source.
store_id : typing.Optional[str]
ID of store where the order is placed
@@ -2515,10 +2607,10 @@ async def create_batch_order(
array of order objects
historical : typing.Optional[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.
+ 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.
notify_url : typing.Optional[str]
- Notify Url provided by client_dev to get the status of batch request
+ Webhook URL to receive the status of the batch request
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2581,6 +2673,7 @@ async def get_products(
offset: typing.Optional[int] = None,
sort: typing.Optional[GetProductsRequestSort] = None,
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
+ search: typing.Optional[str] = None,
name: typing.Optional[str] = None,
price_lte: typing.Optional[float] = None,
price_gte: typing.Optional[float] = None,
@@ -2588,13 +2681,22 @@ async def get_products(
price_gt: typing.Optional[float] = None,
price_eq: typing.Optional[float] = None,
price_ne: typing.Optional[float] = None,
+ alternative_price_lte: typing.Optional[float] = None,
+ alternative_price_gte: typing.Optional[float] = None,
+ alternative_price_lt: typing.Optional[float] = None,
+ alternative_price_gt: typing.Optional[float] = None,
+ alternative_price_eq: typing.Optional[float] = None,
+ alternative_price_ne: typing.Optional[float] = None,
categories: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
modified_since: typing.Optional[str] = None,
created_since: typing.Optional[str] = None,
+ sort_by_field: typing.Optional[GetProductsRequestSortByField] = None,
is_deleted: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetProductsResponse]:
"""
+ 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.
+
Parameters
----------
limit : typing.Optional[int]
@@ -2609,6 +2711,9 @@ async def get_products(
ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Filter by product ids
+ search : typing.Optional[str]
+ 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 : typing.Optional[str]
Filter by product name, minimum 3 characters should be present for search.
@@ -2630,14 +2735,35 @@ async def get_products(
price_ne : typing.Optional[float]
Price filter for products not equals to particular amount
+ alternative_price_lte : typing.Optional[float]
+ Alternative price filter for products less than and equals to particular amount
+
+ alternative_price_gte : typing.Optional[float]
+ Alternative price filter for products greater than and equals to particular amount
+
+ alternative_price_lt : typing.Optional[float]
+ Alternative price filter for products less than particular amount
+
+ alternative_price_gt : typing.Optional[float]
+ Alternative price filter for products greater than particular amount
+
+ alternative_price_eq : typing.Optional[float]
+ Alternative price filter for products equals to particular amount
+
+ alternative_price_ne : typing.Optional[float]
+ Alternative price filter for products not equals to particular amount
+
categories : typing.Optional[typing.Union[str, typing.Sequence[str]]]
Filter by categories ids
modified_since : typing.Optional[str]
- 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.**
+ 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.**
created_since : typing.Optional[str]
- 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.**
+ 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.**
+
+ sort_by_field : typing.Optional[GetProductsRequestSortByField]
+ Sort the results by a specific field. Default sort field is `created_at` when not passed.
is_deleted : typing.Optional[str]
Filter products by their deletion status. If `false` is passed, only products that are not deleted will be returned.
@@ -2658,6 +2784,7 @@ async def get_products(
"offset": offset,
"sort": sort,
"ids": ids,
+ "search": search,
"name": name,
"price[lte]": price_lte,
"price[gte]": price_gte,
@@ -2665,9 +2792,16 @@ async def get_products(
"price[gt]": price_gt,
"price[eq]": price_eq,
"price[ne]": price_ne,
+ "alternativePrice[lte]": alternative_price_lte,
+ "alternativePrice[gte]": alternative_price_gte,
+ "alternativePrice[lt]": alternative_price_lt,
+ "alternativePrice[gt]": alternative_price_gt,
+ "alternativePrice[eq]": alternative_price_eq,
+ "alternativePrice[ne]": alternative_price_ne,
"categories": categories,
"modifiedSince": modified_since,
"createdSince": created_since,
+ "sortByField": sort_by_field,
"isDeleted": is_deleted,
},
request_options=request_options,
@@ -2716,6 +2850,7 @@ async def create_update_product(
meta_info: typing.Optional[typing.Dict[str, CreateUpdateProductRequestMetaInfoValue]] = OMIT,
parent_id: typing.Optional[str] = OMIT,
price: typing.Optional[float] = OMIT,
+ alternative_price: typing.Optional[float] = OMIT,
sku: typing.Optional[str] = OMIT,
stock: typing.Optional[float] = OMIT,
update_enabled: typing.Optional[bool] = OMIT,
@@ -2723,13 +2858,15 @@ async def create_update_product(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[typing.Optional[CreateUpdateProductResponse]]:
"""
+ 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.
+
Parameters
----------
id : str
Product ID for which you requested the details
name : str
- Mandatory in case of creation**. Name of the product for which you requested the details
+ **Mandatory in case of creation**. Name of the product, as displayed in the shop
brand : typing.Optional[str]
Brand of the product
@@ -2758,6 +2895,9 @@ async def create_update_product(
price : typing.Optional[float]
Price of the product
+ alternative_price : typing.Optional[float]
+ Alternative price of the product
+
sku : typing.Optional[str]
Product identifier from the shop
@@ -2765,7 +2905,7 @@ async def create_update_product(
Current stock value of the product from the shop's database
update_enabled : typing.Optional[bool]
- Facilitate to update the existing category in the same request (updateEnabled = true)
+ Facilitate to update the existing product in the same request (updateEnabled = true)
url : typing.Optional[str]
URL to the product
@@ -2797,6 +2937,7 @@ async def create_update_product(
"name": name,
"parentId": parent_id,
"price": price,
+ "alternativePrice": alternative_price,
"sku": sku,
"stock": stock,
"updateEnabled": update_enabled,
@@ -2848,13 +2989,15 @@ async def create_update_batch_products(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[CreateUpdateBatchProductsResponse]:
"""
+ 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.
+
Parameters
----------
products : typing.Sequence[CreateUpdateBatchProductsRequestProductsItem]
array of products objects
update_enabled : typing.Optional[bool]
- Facilitate to update the existing categories in the same request (updateEnabled = true)
+ Facilitate to update the existing products in the same request (updateEnabled = true)
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2915,6 +3058,8 @@ async def get_product_info(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[GetProductDetails]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -2926,7 +3071,7 @@ async def get_product_info(
Returns
-------
AsyncHttpResponse[GetProductDetails]
- Product informations
+ Product details
"""
_response = await self._client_wrapper.httpx_client.request(
f"products/{jsonable_encoder(id)}",
@@ -2982,6 +3127,8 @@ async def create_product_alert(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
diff --git a/src/brevo/ecommerce/types/__init__.py b/src/brevo/ecommerce/types/__init__.py
index c3bb06b..08fdcb0 100644
--- a/src/brevo/ecommerce/types/__init__.py
+++ b/src/brevo/ecommerce/types/__init__.py
@@ -43,6 +43,7 @@
from .get_ecommerce_config_display_currency_response import GetEcommerceConfigDisplayCurrencyResponse
from .get_orders_request_sort import GetOrdersRequestSort
from .get_products_request_sort import GetProductsRequestSort
+ from .get_products_request_sort_by_field import GetProductsRequestSortByField
from .get_products_response import GetProductsResponse
from .set_config_display_currency_response import SetConfigDisplayCurrencyResponse
_dynamic_imports: typing.Dict[str, str] = {
@@ -69,6 +70,7 @@
"GetEcommerceConfigDisplayCurrencyResponse": ".get_ecommerce_config_display_currency_response",
"GetOrdersRequestSort": ".get_orders_request_sort",
"GetProductsRequestSort": ".get_products_request_sort",
+ "GetProductsRequestSortByField": ".get_products_request_sort_by_field",
"GetProductsResponse": ".get_products_response",
"SetConfigDisplayCurrencyResponse": ".set_config_display_currency_response",
}
@@ -119,6 +121,7 @@ def __dir__():
"GetEcommerceConfigDisplayCurrencyResponse",
"GetOrdersRequestSort",
"GetProductsRequestSort",
+ "GetProductsRequestSortByField",
"GetProductsResponse",
"SetConfigDisplayCurrencyResponse",
]
diff --git a/src/brevo/ecommerce/types/create_update_batch_products_request_products_item.py b/src/brevo/ecommerce/types/create_update_batch_products_request_products_item.py
index fc87083..8affa3c 100644
--- a/src/brevo/ecommerce/types/create_update_batch_products_request_products_item.py
+++ b/src/brevo/ecommerce/types/create_update_batch_products_request_products_item.py
@@ -61,7 +61,7 @@ class CreateUpdateBatchProductsRequestProductsItem(UncheckedBaseModel):
] = None
name: str = pydantic.Field()
"""
- Mandatory in case of creation**. Name of the product for which you requested the details
+ **Mandatory in case of creation**. Name of the product, as displayed in the shop
"""
parent_id: typing_extensions.Annotated[
@@ -74,6 +74,11 @@ class CreateUpdateBatchProductsRequestProductsItem(UncheckedBaseModel):
Price of the product
"""
+ alternative_price: typing_extensions.Annotated[
+ typing.Optional[float],
+ FieldMetadata(alias="alternativePrice"),
+ pydantic.Field(alias="alternativePrice", description="Alternative price of the product"),
+ ] = None
sku: typing.Optional[str] = pydantic.Field(default=None)
"""
Product identifier from the shop
diff --git a/src/brevo/ecommerce/types/create_update_category_response.py b/src/brevo/ecommerce/types/create_update_category_response.py
index c5aecf7..b3b0944 100644
--- a/src/brevo/ecommerce/types/create_update_category_response.py
+++ b/src/brevo/ecommerce/types/create_update_category_response.py
@@ -8,7 +8,7 @@
class CreateUpdateCategoryResponse(UncheckedBaseModel):
- id: typing.Optional[int] = pydantic.Field(default=None)
+ id: typing.Optional[str] = pydantic.Field(default=None)
"""
ID of the category when a new category is created
"""
diff --git a/src/brevo/ecommerce/types/create_update_product_response.py b/src/brevo/ecommerce/types/create_update_product_response.py
index 40b944b..64b9179 100644
--- a/src/brevo/ecommerce/types/create_update_product_response.py
+++ b/src/brevo/ecommerce/types/create_update_product_response.py
@@ -8,9 +8,9 @@
class CreateUpdateProductResponse(UncheckedBaseModel):
- id: typing.Optional[int] = pydantic.Field(default=None)
+ id: typing.Optional[str] = pydantic.Field(default=None)
"""
- ID of the Product when a new product is created
+ ID of the product when a new product is created
"""
if IS_PYDANTIC_V2:
diff --git a/src/brevo/ecommerce/types/get_products_request_sort_by_field.py b/src/brevo/ecommerce/types/get_products_request_sort_by_field.py
new file mode 100644
index 0000000..b4336bb
--- /dev/null
+++ b/src/brevo/ecommerce/types/get_products_request_sort_by_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetProductsRequestSortByField = typing.Union[typing.Literal["created_at", "name", "price", "id"], typing.Any]
diff --git a/src/brevo/email_campaigns/__init__.py b/src/brevo/email_campaigns/__init__.py
index ba1c7cc..f698560 100644
--- a/src/brevo/email_campaigns/__init__.py
+++ b/src/brevo/email_campaigns/__init__.py
@@ -22,6 +22,8 @@
GetAbTestCampaignResultResponseWinningVersion,
GetEmailCampaignRequestStatistics,
GetEmailCampaignResponse,
+ GetEmailCampaignResponseEmailExpirationDate,
+ GetEmailCampaignResponseEmailExpirationDateUnit,
GetEmailCampaignResponseSender,
GetEmailCampaignResponseStatus,
GetEmailCampaignResponseType,
@@ -31,6 +33,8 @@
GetEmailCampaignsRequestType,
GetEmailCampaignsResponse,
GetEmailCampaignsResponseCampaignsItem,
+ GetEmailCampaignsResponseCampaignsItemEmailExpirationDate,
+ GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit,
GetEmailCampaignsResponseCampaignsItemSender,
GetEmailCampaignsResponseCampaignsItemStatus,
GetEmailCampaignsResponseCampaignsItemType,
@@ -58,6 +62,8 @@
"GetAbTestCampaignResultResponseWinningVersion": ".types",
"GetEmailCampaignRequestStatistics": ".types",
"GetEmailCampaignResponse": ".types",
+ "GetEmailCampaignResponseEmailExpirationDate": ".types",
+ "GetEmailCampaignResponseEmailExpirationDateUnit": ".types",
"GetEmailCampaignResponseSender": ".types",
"GetEmailCampaignResponseStatus": ".types",
"GetEmailCampaignResponseType": ".types",
@@ -67,6 +73,8 @@
"GetEmailCampaignsRequestType": ".types",
"GetEmailCampaignsResponse": ".types",
"GetEmailCampaignsResponseCampaignsItem": ".types",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDate": ".types",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit": ".types",
"GetEmailCampaignsResponseCampaignsItemSender": ".types",
"GetEmailCampaignsResponseCampaignsItemStatus": ".types",
"GetEmailCampaignsResponseCampaignsItemType": ".types",
@@ -117,6 +125,8 @@ def __dir__():
"GetAbTestCampaignResultResponseWinningVersion",
"GetEmailCampaignRequestStatistics",
"GetEmailCampaignResponse",
+ "GetEmailCampaignResponseEmailExpirationDate",
+ "GetEmailCampaignResponseEmailExpirationDateUnit",
"GetEmailCampaignResponseSender",
"GetEmailCampaignResponseStatus",
"GetEmailCampaignResponseType",
@@ -126,6 +136,8 @@ def __dir__():
"GetEmailCampaignsRequestType",
"GetEmailCampaignsResponse",
"GetEmailCampaignsResponseCampaignsItem",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDate",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit",
"GetEmailCampaignsResponseCampaignsItemSender",
"GetEmailCampaignsResponseCampaignsItemStatus",
"GetEmailCampaignsResponseCampaignsItemType",
diff --git a/src/brevo/email_campaigns/client.py b/src/brevo/email_campaigns/client.py
index cdd70a4..961c092 100644
--- a/src/brevo/email_campaigns/client.py
+++ b/src/brevo/email_campaigns/client.py
@@ -61,11 +61,12 @@ def get_email_campaigns(
offset: typing.Optional[int] = None,
sort: typing.Optional[GetEmailCampaignsRequestSort] = None,
exclude_html_content: typing.Optional[bool] = None,
+ exclude_pdf_attachment: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetEmailCampaignsResponse:
"""
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).
Parameters
----------
@@ -76,13 +77,13 @@ def get_email_campaigns(
Filter on the status of the campaign
statistics : typing.Optional[GetEmailCampaignsRequestStatistics]
- 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.
+ 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.
start_date : typing.Optional[str]
- **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' )
+ **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.
end_date : typing.Optional[str]
- **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' )
+ **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.
limit : typing.Optional[int]
Number of documents per page
@@ -94,7 +95,10 @@ def get_email_campaigns(
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
exclude_html_content : typing.Optional[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
+ 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.
+
+ exclude_pdf_attachment : typing.Optional[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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -102,7 +106,7 @@ def get_email_campaigns(
Returns
-------
GetEmailCampaignsResponse
- Email campaigns informations
+ Email campaigns information
Examples
--------
@@ -123,6 +127,7 @@ def get_email_campaigns(
offset=offset,
sort=sort,
exclude_html_content=exclude_html_content,
+ exclude_pdf_attachment=exclude_pdf_attachment,
request_options=request_options,
)
return _response.data
@@ -165,13 +170,15 @@ def create_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> CreateEmailCampaignResponse:
"""
+ 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.
+
Parameters
----------
name : str
Name of the campaign
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 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}**
ab_testing : typing.Optional[bool]
Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B
@@ -189,10 +196,10 @@ def create_email_campaign(
Header of the email campaign
html_content : typing.Optional[str]
- Mandatory if htmlUrl and templateId are empty. Body of the message (HTML).
+ **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`.
html_url : typing.Optional[str]
- **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: **https://html.domain.com**
+ **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**
increase_rate : typing.Optional[int]
**Mandatory if ipWarmupEnable is set to true**. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%.
@@ -243,7 +250,7 @@ def create_email_campaign(
Tag of the campaign
template_id : typing.Optional[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.
+ **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`.
to_field : typing.Optional[str]
To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization
@@ -329,6 +336,8 @@ def upload_image_to_gallery(
request_options: typing.Optional[RequestOptions] = None,
) -> UploadImageToGalleryResponse:
"""
+ 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.
+
Parameters
----------
image_url : str
@@ -370,13 +379,15 @@ def get_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> GetEmailCampaignResponse:
"""
+ 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.
+
Parameters
----------
campaign_id : int
Id of the campaign
statistics : typing.Optional[GetEmailCampaignRequestStatistics]
- Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.
+ 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).
exclude_html_content : typing.Optional[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
@@ -387,7 +398,7 @@ def get_email_campaign(
Returns
-------
GetEmailCampaignResponse
- Email campaign informations
+ Email campaign information
Examples
--------
@@ -447,6 +458,8 @@ def update_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -608,6 +621,8 @@ def delete_email_campaign(
self, campaign_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -676,6 +691,8 @@ def email_export_recipients(
request_options: typing.Optional[RequestOptions] = None,
) -> EmailExportRecipientsResponse:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -716,6 +733,8 @@ def send_email_campaign_now(
self, campaign_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -799,6 +818,8 @@ def send_test_email(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -869,6 +890,8 @@ def update_campaign_status(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -926,11 +949,12 @@ async def get_email_campaigns(
offset: typing.Optional[int] = None,
sort: typing.Optional[GetEmailCampaignsRequestSort] = None,
exclude_html_content: typing.Optional[bool] = None,
+ exclude_pdf_attachment: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> GetEmailCampaignsResponse:
"""
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).
Parameters
----------
@@ -941,13 +965,13 @@ async def get_email_campaigns(
Filter on the status of the campaign
statistics : typing.Optional[GetEmailCampaignsRequestStatistics]
- 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.
+ 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.
start_date : typing.Optional[str]
- **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' )
+ **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.
end_date : typing.Optional[str]
- **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' )
+ **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.
limit : typing.Optional[int]
Number of documents per page
@@ -959,7 +983,10 @@ async def get_email_campaigns(
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
exclude_html_content : typing.Optional[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
+ 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.
+
+ exclude_pdf_attachment : typing.Optional[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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -967,7 +994,7 @@ async def get_email_campaigns(
Returns
-------
GetEmailCampaignsResponse
- Email campaigns informations
+ Email campaigns information
Examples
--------
@@ -996,6 +1023,7 @@ async def main() -> None:
offset=offset,
sort=sort,
exclude_html_content=exclude_html_content,
+ exclude_pdf_attachment=exclude_pdf_attachment,
request_options=request_options,
)
return _response.data
@@ -1038,13 +1066,15 @@ async def create_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> CreateEmailCampaignResponse:
"""
+ 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.
+
Parameters
----------
name : str
Name of the campaign
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 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}**
ab_testing : typing.Optional[bool]
Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B
@@ -1062,10 +1092,10 @@ async def create_email_campaign(
Header of the email campaign
html_content : typing.Optional[str]
- Mandatory if htmlUrl and templateId are empty. Body of the message (HTML).
+ **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`.
html_url : typing.Optional[str]
- **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: **https://html.domain.com**
+ **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**
increase_rate : typing.Optional[int]
**Mandatory if ipWarmupEnable is set to true**. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%.
@@ -1116,7 +1146,7 @@ async def create_email_campaign(
Tag of the campaign
template_id : typing.Optional[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.
+ **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`.
to_field : typing.Optional[str]
To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization
@@ -1210,6 +1240,8 @@ async def upload_image_to_gallery(
request_options: typing.Optional[RequestOptions] = None,
) -> UploadImageToGalleryResponse:
"""
+ 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.
+
Parameters
----------
image_url : str
@@ -1259,13 +1291,15 @@ async def get_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> GetEmailCampaignResponse:
"""
+ 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.
+
Parameters
----------
campaign_id : int
Id of the campaign
statistics : typing.Optional[GetEmailCampaignRequestStatistics]
- Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.
+ 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).
exclude_html_content : typing.Optional[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
@@ -1276,7 +1310,7 @@ async def get_email_campaign(
Returns
-------
GetEmailCampaignResponse
- Email campaign informations
+ Email campaign information
Examples
--------
@@ -1344,6 +1378,8 @@ async def update_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -1513,6 +1549,8 @@ async def delete_email_campaign(
self, campaign_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -1597,6 +1635,8 @@ async def email_export_recipients(
request_options: typing.Optional[RequestOptions] = None,
) -> EmailExportRecipientsResponse:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -1645,6 +1685,8 @@ async def send_email_campaign_now(
self, campaign_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -1744,6 +1786,8 @@ async def send_test_email(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -1832,6 +1876,8 @@ async def update_campaign_status(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
campaign_id : int
diff --git a/src/brevo/email_campaigns/raw_client.py b/src/brevo/email_campaigns/raw_client.py
index 406285a..59eb67f 100644
--- a/src/brevo/email_campaigns/raw_client.py
+++ b/src/brevo/email_campaigns/raw_client.py
@@ -12,6 +12,7 @@
from ..core.serialization import convert_and_respect_annotation_metadata
from ..core.unchecked_base_model import construct_type
from ..errors.bad_request_error import BadRequestError
+from ..errors.forbidden_error import ForbiddenError
from ..errors.method_not_allowed_error import MethodNotAllowedError
from ..errors.not_found_error import NotFoundError
from ..errors.payment_required_error import PaymentRequiredError
@@ -62,11 +63,12 @@ def get_email_campaigns(
offset: typing.Optional[int] = None,
sort: typing.Optional[GetEmailCampaignsRequestSort] = None,
exclude_html_content: typing.Optional[bool] = None,
+ exclude_pdf_attachment: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetEmailCampaignsResponse]:
"""
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).
Parameters
----------
@@ -77,13 +79,13 @@ def get_email_campaigns(
Filter on the status of the campaign
statistics : typing.Optional[GetEmailCampaignsRequestStatistics]
- 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.
+ 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.
start_date : typing.Optional[str]
- **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' )
+ **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.
end_date : typing.Optional[str]
- **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' )
+ **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.
limit : typing.Optional[int]
Number of documents per page
@@ -95,7 +97,10 @@ def get_email_campaigns(
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
exclude_html_content : typing.Optional[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
+ 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.
+
+ exclude_pdf_attachment : typing.Optional[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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -103,7 +108,7 @@ def get_email_campaigns(
Returns
-------
HttpResponse[GetEmailCampaignsResponse]
- Email campaigns informations
+ Email campaigns information
"""
_response = self._client_wrapper.httpx_client.request(
"emailCampaigns",
@@ -118,6 +123,7 @@ def get_email_campaigns(
"offset": offset,
"sort": sort,
"excludeHtmlContent": exclude_html_content,
+ "excludePdfAttachment": exclude_pdf_attachment,
},
request_options=request_options,
)
@@ -189,13 +195,15 @@ def create_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[CreateEmailCampaignResponse]:
"""
+ 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.
+
Parameters
----------
name : str
Name of the campaign
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 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}**
ab_testing : typing.Optional[bool]
Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B
@@ -213,10 +221,10 @@ def create_email_campaign(
Header of the email campaign
html_content : typing.Optional[str]
- Mandatory if htmlUrl and templateId are empty. Body of the message (HTML).
+ **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`.
html_url : typing.Optional[str]
- **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: **https://html.domain.com**
+ **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**
increase_rate : typing.Optional[int]
**Mandatory if ipWarmupEnable is set to true**. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%.
@@ -267,7 +275,7 @@ def create_email_campaign(
Tag of the campaign
template_id : typing.Optional[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.
+ **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`.
to_field : typing.Optional[str]
To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization
@@ -367,6 +375,17 @@ def create_email_campaign(
),
),
)
+ if _response.status_code == 405:
+ raise MethodNotAllowedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ ErrorModel,
+ construct_type(
+ type_=ErrorModel, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -384,6 +403,8 @@ def upload_image_to_gallery(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[UploadImageToGalleryResponse]:
"""
+ 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.
+
Parameters
----------
image_url : str
@@ -452,13 +473,15 @@ def get_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetEmailCampaignResponse]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
Id of the campaign
statistics : typing.Optional[GetEmailCampaignRequestStatistics]
- Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.
+ 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).
exclude_html_content : typing.Optional[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
@@ -469,7 +492,7 @@ def get_email_campaign(
Returns
-------
HttpResponse[GetEmailCampaignResponse]
- Email campaign informations
+ Email campaign information
"""
_response = self._client_wrapper.httpx_client.request(
f"emailCampaigns/{jsonable_encoder(campaign_id)}",
@@ -560,6 +583,8 @@ def update_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -744,6 +769,17 @@ def update_email_campaign(
),
),
)
+ if _response.status_code == 405:
+ raise MethodNotAllowedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ ErrorModel,
+ construct_type(
+ type_=ErrorModel, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -757,6 +793,8 @@ def delete_email_campaign(
self, campaign_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -788,6 +826,17 @@ def delete_email_campaign(
),
),
)
+ if _response.status_code == 403:
+ raise ForbiddenError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
@@ -882,6 +931,8 @@ def email_export_recipients(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[EmailExportRecipientsResponse]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -959,6 +1010,8 @@ def send_email_campaign_now(
self, campaign_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -1107,6 +1160,8 @@ def send_test_email(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -1252,6 +1307,8 @@ def update_campaign_status(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -1330,11 +1387,12 @@ async def get_email_campaigns(
offset: typing.Optional[int] = None,
sort: typing.Optional[GetEmailCampaignsRequestSort] = None,
exclude_html_content: typing.Optional[bool] = None,
+ exclude_pdf_attachment: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetEmailCampaignsResponse]:
"""
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).
Parameters
----------
@@ -1345,13 +1403,13 @@ async def get_email_campaigns(
Filter on the status of the campaign
statistics : typing.Optional[GetEmailCampaignsRequestStatistics]
- 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.
+ 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.
start_date : typing.Optional[str]
- **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' )
+ **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.
end_date : typing.Optional[str]
- **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' )
+ **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.
limit : typing.Optional[int]
Number of documents per page
@@ -1363,7 +1421,10 @@ async def get_email_campaigns(
Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed
exclude_html_content : typing.Optional[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
+ 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.
+
+ exclude_pdf_attachment : typing.Optional[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.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1371,7 +1432,7 @@ async def get_email_campaigns(
Returns
-------
AsyncHttpResponse[GetEmailCampaignsResponse]
- Email campaigns informations
+ Email campaigns information
"""
_response = await self._client_wrapper.httpx_client.request(
"emailCampaigns",
@@ -1386,6 +1447,7 @@ async def get_email_campaigns(
"offset": offset,
"sort": sort,
"excludeHtmlContent": exclude_html_content,
+ "excludePdfAttachment": exclude_pdf_attachment,
},
request_options=request_options,
)
@@ -1457,13 +1519,15 @@ async def create_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[CreateEmailCampaignResponse]:
"""
+ 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.
+
Parameters
----------
name : str
Name of the campaign
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 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}**
ab_testing : typing.Optional[bool]
Status of A/B Test. abTesting = false means it is disabled & abTesting = true means it is enabled. **subjectA, subjectB, splitRule, winnerCriteria & winnerDelay** will be considered when abTesting is set to true. subjectA & subjectB are mandatory together & subject if passed is ignored. **Can be set to true only if sendAtBestTime is false**. You will be able to set up two subject lines for your campaign and send them to a random sample of your total recipients. Half of the test group will receive version A, and the other half will receive version B
@@ -1481,10 +1545,10 @@ async def create_email_campaign(
Header of the email campaign
html_content : typing.Optional[str]
- Mandatory if htmlUrl and templateId are empty. Body of the message (HTML).
+ **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`.
html_url : typing.Optional[str]
- **Mandatory if htmlContent and templateId are empty**. Url to the message (HTML). For example: **https://html.domain.com**
+ **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**
increase_rate : typing.Optional[int]
**Mandatory if ipWarmupEnable is set to true**. Set a percentage increase rate for warming up your ip. We recommend you set the increase rate to 30% per day. If you want to send the same number of emails every day, set the daily increase value to 0%.
@@ -1535,7 +1599,7 @@ async def create_email_campaign(
Tag of the campaign
template_id : typing.Optional[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.
+ **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`.
to_field : typing.Optional[str]
To personalize the **To** Field. If you want to include the first name and last name of your recipient, add **{FNAME} {LNAME}**. These contact attributes must already exist in your Brevo account. If input parameter **params** used please use **{{contact.FNAME}} {{contact.LNAME}}** for personalization
@@ -1635,6 +1699,17 @@ async def create_email_campaign(
),
),
)
+ if _response.status_code == 405:
+ raise MethodNotAllowedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ ErrorModel,
+ construct_type(
+ type_=ErrorModel, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -1652,6 +1727,8 @@ async def upload_image_to_gallery(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[UploadImageToGalleryResponse]:
"""
+ 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.
+
Parameters
----------
image_url : str
@@ -1720,13 +1797,15 @@ async def get_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetEmailCampaignResponse]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
Id of the campaign
statistics : typing.Optional[GetEmailCampaignRequestStatistics]
- Filter on type of the statistics required. Example **globalStats** value will only fetch globalStats info of the campaign in returned response.
+ 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).
exclude_html_content : typing.Optional[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
@@ -1737,7 +1816,7 @@ async def get_email_campaign(
Returns
-------
AsyncHttpResponse[GetEmailCampaignResponse]
- Email campaign informations
+ Email campaign information
"""
_response = await self._client_wrapper.httpx_client.request(
f"emailCampaigns/{jsonable_encoder(campaign_id)}",
@@ -1828,6 +1907,8 @@ async def update_email_campaign(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -2012,6 +2093,17 @@ async def update_email_campaign(
),
),
)
+ if _response.status_code == 405:
+ raise MethodNotAllowedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ ErrorModel,
+ construct_type(
+ type_=ErrorModel, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -2025,6 +2117,8 @@ async def delete_email_campaign(
self, campaign_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -2056,6 +2150,17 @@ async def delete_email_campaign(
),
),
)
+ if _response.status_code == 403:
+ raise ForbiddenError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
if _response.status_code == 404:
raise NotFoundError(
headers=dict(_response.headers),
@@ -2150,6 +2255,8 @@ async def email_export_recipients(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[EmailExportRecipientsResponse]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -2227,6 +2334,8 @@ async def send_email_campaign_now(
self, campaign_id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -2375,6 +2484,8 @@ async def send_test_email(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
@@ -2520,6 +2631,8 @@ async def update_campaign_status(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
campaign_id : int
diff --git a/src/brevo/email_campaigns/types/__init__.py b/src/brevo/email_campaigns/types/__init__.py
index a784d57..b6c641e 100644
--- a/src/brevo/email_campaigns/types/__init__.py
+++ b/src/brevo/email_campaigns/types/__init__.py
@@ -23,6 +23,8 @@
from .get_ab_test_campaign_result_response_winning_version import GetAbTestCampaignResultResponseWinningVersion
from .get_email_campaign_request_statistics import GetEmailCampaignRequestStatistics
from .get_email_campaign_response import GetEmailCampaignResponse
+ from .get_email_campaign_response_email_expiration_date import GetEmailCampaignResponseEmailExpirationDate
+ from .get_email_campaign_response_email_expiration_date_unit import GetEmailCampaignResponseEmailExpirationDateUnit
from .get_email_campaign_response_sender import GetEmailCampaignResponseSender
from .get_email_campaign_response_status import GetEmailCampaignResponseStatus
from .get_email_campaign_response_type import GetEmailCampaignResponseType
@@ -32,6 +34,12 @@
from .get_email_campaigns_request_type import GetEmailCampaignsRequestType
from .get_email_campaigns_response import GetEmailCampaignsResponse
from .get_email_campaigns_response_campaigns_item import GetEmailCampaignsResponseCampaignsItem
+ from .get_email_campaigns_response_campaigns_item_email_expiration_date import (
+ GetEmailCampaignsResponseCampaignsItemEmailExpirationDate,
+ )
+ from .get_email_campaigns_response_campaigns_item_email_expiration_date_unit import (
+ GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit,
+ )
from .get_email_campaigns_response_campaigns_item_sender import GetEmailCampaignsResponseCampaignsItemSender
from .get_email_campaigns_response_campaigns_item_status import GetEmailCampaignsResponseCampaignsItemStatus
from .get_email_campaigns_response_campaigns_item_type import GetEmailCampaignsResponseCampaignsItemType
@@ -60,6 +68,8 @@
"GetAbTestCampaignResultResponseWinningVersion": ".get_ab_test_campaign_result_response_winning_version",
"GetEmailCampaignRequestStatistics": ".get_email_campaign_request_statistics",
"GetEmailCampaignResponse": ".get_email_campaign_response",
+ "GetEmailCampaignResponseEmailExpirationDate": ".get_email_campaign_response_email_expiration_date",
+ "GetEmailCampaignResponseEmailExpirationDateUnit": ".get_email_campaign_response_email_expiration_date_unit",
"GetEmailCampaignResponseSender": ".get_email_campaign_response_sender",
"GetEmailCampaignResponseStatus": ".get_email_campaign_response_status",
"GetEmailCampaignResponseType": ".get_email_campaign_response_type",
@@ -69,6 +79,8 @@
"GetEmailCampaignsRequestType": ".get_email_campaigns_request_type",
"GetEmailCampaignsResponse": ".get_email_campaigns_response",
"GetEmailCampaignsResponseCampaignsItem": ".get_email_campaigns_response_campaigns_item",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDate": ".get_email_campaigns_response_campaigns_item_email_expiration_date",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit": ".get_email_campaigns_response_campaigns_item_email_expiration_date_unit",
"GetEmailCampaignsResponseCampaignsItemSender": ".get_email_campaigns_response_campaigns_item_sender",
"GetEmailCampaignsResponseCampaignsItemStatus": ".get_email_campaigns_response_campaigns_item_status",
"GetEmailCampaignsResponseCampaignsItemType": ".get_email_campaigns_response_campaigns_item_type",
@@ -119,6 +131,8 @@ def __dir__():
"GetAbTestCampaignResultResponseWinningVersion",
"GetEmailCampaignRequestStatistics",
"GetEmailCampaignResponse",
+ "GetEmailCampaignResponseEmailExpirationDate",
+ "GetEmailCampaignResponseEmailExpirationDateUnit",
"GetEmailCampaignResponseSender",
"GetEmailCampaignResponseStatus",
"GetEmailCampaignResponseType",
@@ -128,6 +142,8 @@ def __dir__():
"GetEmailCampaignsRequestType",
"GetEmailCampaignsResponse",
"GetEmailCampaignsResponseCampaignsItem",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDate",
+ "GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit",
"GetEmailCampaignsResponseCampaignsItemSender",
"GetEmailCampaignsResponseCampaignsItemStatus",
"GetEmailCampaignsResponseCampaignsItemType",
diff --git a/src/brevo/email_campaigns/types/create_email_campaign_request_sender.py b/src/brevo/email_campaigns/types/create_email_campaign_request_sender.py
index e22b535..5855c4f 100644
--- a/src/brevo/email_campaigns/types/create_email_campaign_request_sender.py
+++ b/src/brevo/email_campaigns/types/create_email_campaign_request_sender.py
@@ -9,17 +9,17 @@
class CreateEmailCampaignRequestSender(UncheckedBaseModel):
"""
- 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}**
"""
email: typing.Optional[str] = pydantic.Field(default=None)
"""
- Sender email
+ Sender email. Must be a valid email address. Cannot be used together with `id` in the same request.
"""
id: typing.Optional[int] = pydantic.Field(default=None)
"""
- 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)_.
+ 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)._
"""
name: typing.Optional[str] = pydantic.Field(default=None)
diff --git a/src/brevo/email_campaigns/types/get_email_campaign_response.py b/src/brevo/email_campaigns/types/get_email_campaign_response.py
index a8e3b1b..0a89419 100644
--- a/src/brevo/email_campaigns/types/get_email_campaign_response.py
+++ b/src/brevo/email_campaigns/types/get_email_campaign_response.py
@@ -9,6 +9,7 @@
from ...core.unchecked_base_model import UncheckedBaseModel
from ...types.get_campaign_recipients import GetCampaignRecipients
from ...types.get_extended_campaign_stats import GetExtendedCampaignStats
+from .get_email_campaign_response_email_expiration_date import GetEmailCampaignResponseEmailExpirationDate
from .get_email_campaign_response_sender import GetEmailCampaignResponseSender
from .get_email_campaign_response_status import GetEmailCampaignResponseStatus
from .get_email_campaign_response_type import GetEmailCampaignResponseType
@@ -116,6 +117,14 @@ class GetEmailCampaignResponse(UncheckedBaseModel):
description="The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true`",
),
] = None
+ attachment_url: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="attachmentUrl"),
+ pydantic.Field(
+ alias="attachmentUrl",
+ description="URL of the attachment file associated with the campaign. Empty string if no attachment is present.",
+ ),
+ ] = None
created_at: typing_extensions.Annotated[
str,
FieldMetadata(alias="createdAt"),
@@ -123,6 +132,14 @@ class GetEmailCampaignResponse(UncheckedBaseModel):
alias="createdAt", description="Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ)"
),
]
+ email_expiration_date: typing_extensions.Annotated[
+ typing.Optional[GetEmailCampaignResponseEmailExpirationDate],
+ FieldMetadata(alias="emailExpirationDate"),
+ pydantic.Field(
+ alias="emailExpirationDate",
+ description="Expiration date configuration for the email campaign, if set. Contains the duration and unit of the email expiry.",
+ ),
+ ] = None
footer: str = pydantic.Field()
"""
Footer of the campaign
@@ -191,7 +208,10 @@ class GetEmailCampaignResponse(UncheckedBaseModel):
share_link: typing_extensions.Annotated[
typing.Optional[str],
FieldMetadata(alias="shareLink"),
- pydantic.Field(alias="shareLink", description="Link to share the campaign on social medias"),
+ pydantic.Field(
+ alias="shareLink",
+ description="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.",
+ ),
] = None
tag: typing.Optional[str] = pydantic.Field(default=None)
"""
@@ -219,20 +239,32 @@ class GetEmailCampaignResponse(UncheckedBaseModel):
utm_campaign_value: typing_extensions.Annotated[
typing.Optional[str],
FieldMetadata(alias="utmCampaignValue"),
- pydantic.Field(alias="utmCampaignValue", description="utm parameter associated with campaign"),
+ pydantic.Field(
+ alias="utmCampaignValue",
+ description="The utm_campaign value associated with the campaign. Only present if a UTM campaign value was set.",
+ ),
] = None
- utm_id_active: typing_extensions.Annotated[
- typing.Optional[bool],
- FieldMetadata(alias="utmIDActive"),
- pydantic.Field(alias="utmIDActive", description="utm id active"),
+ utm_id: typing_extensions.Annotated[
+ typing.Optional[int],
+ FieldMetadata(alias="utmID"),
+ pydantic.Field(
+ alias="utmID",
+ description="The campaign ID used as utm_id parameter. Only present if UTM campaign tracking with ID is enabled.",
+ ),
] = None
utm_medium: typing_extensions.Annotated[
- typing.Optional[str], FieldMetadata(alias="utmMedium"), pydantic.Field(alias="utmMedium")
+ typing.Optional[str],
+ FieldMetadata(alias="utmMedium"),
+ pydantic.Field(
+ alias="utmMedium", description='The utm_medium value. Set to "EMAIL" when UTM campaign tracking is enabled.'
+ ),
] = None
utm_source: typing_extensions.Annotated[
typing.Optional[str],
FieldMetadata(alias="utmSource"),
- pydantic.Field(alias="utmSource", description="source of utm"),
+ pydantic.Field(
+ alias="utmSource", description='The utm_source value. Set to "Brevo" when UTM campaign tracking is enabled.'
+ ),
] = None
recipients: GetCampaignRecipients
statistics: GetExtendedCampaignStats
diff --git a/src/brevo/process/types/get_processes_response_processes_item_info_export.py b/src/brevo/email_campaigns/types/get_email_campaign_response_email_expiration_date.py
similarity index 51%
rename from src/brevo/process/types/get_processes_response_processes_item_info_export.py
rename to src/brevo/email_campaigns/types/get_email_campaign_response_email_expiration_date.py
index e1ac468..8581267 100644
--- a/src/brevo/process/types/get_processes_response_processes_item_info_export.py
+++ b/src/brevo/email_campaigns/types/get_email_campaign_response_email_expiration_date.py
@@ -5,21 +5,22 @@
import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.unchecked_base_model import UncheckedBaseModel
+from .get_email_campaign_response_email_expiration_date_unit import GetEmailCampaignResponseEmailExpirationDateUnit
-class GetProcessesResponseProcessesItemInfoExport(UncheckedBaseModel):
+class GetEmailCampaignResponseEmailExpirationDate(UncheckedBaseModel):
"""
- Export process details
+ Expiration date configuration for the email campaign, if set. Contains the duration and unit of the email expiry.
"""
- total_records: typing.Optional[int] = pydantic.Field(default=None)
+ duration: typing.Optional[int] = pydantic.Field(default=None)
"""
- Total number of exported records
+ Duration of the email expiry
"""
- file_size: typing.Optional[int] = pydantic.Field(default=None)
+ unit: typing.Optional[GetEmailCampaignResponseEmailExpirationDateUnit] = pydantic.Field(default=None)
"""
- Size of exported file in bytes
+ Unit of the duration
"""
if IS_PYDANTIC_V2:
diff --git a/src/brevo/email_campaigns/types/get_email_campaign_response_email_expiration_date_unit.py b/src/brevo/email_campaigns/types/get_email_campaign_response_email_expiration_date_unit.py
new file mode 100644
index 0000000..e96403d
--- /dev/null
+++ b/src/brevo/email_campaigns/types/get_email_campaign_response_email_expiration_date_unit.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetEmailCampaignResponseEmailExpirationDateUnit = typing.Union[typing.Literal["days", "weeks", "months"], typing.Any]
diff --git a/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item.py b/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item.py
index c20b183..899d900 100644
--- a/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item.py
+++ b/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item.py
@@ -9,6 +9,9 @@
from ...core.unchecked_base_model import UncheckedBaseModel
from ...types.get_campaign_recipients import GetCampaignRecipients
from ...types.get_extended_campaign_stats import GetExtendedCampaignStats
+from .get_email_campaigns_response_campaigns_item_email_expiration_date import (
+ GetEmailCampaignsResponseCampaignsItemEmailExpirationDate,
+)
from .get_email_campaigns_response_campaigns_item_sender import GetEmailCampaignsResponseCampaignsItemSender
from .get_email_campaigns_response_campaigns_item_status import GetEmailCampaignsResponseCampaignsItemStatus
from .get_email_campaigns_response_campaigns_item_type import GetEmailCampaignsResponseCampaignsItemType
@@ -116,6 +119,14 @@ class GetEmailCampaignsResponseCampaignsItem(UncheckedBaseModel):
description="The duration of the test in hours at the end of which the winning version will be sent. Only available if `abTesting` flag of the campaign is `true`",
),
] = None
+ attachment_url: typing_extensions.Annotated[
+ typing.Optional[str],
+ FieldMetadata(alias="attachmentUrl"),
+ pydantic.Field(
+ alias="attachmentUrl",
+ description="URL of the attachment file associated with the campaign. Empty string if no attachment is present.",
+ ),
+ ] = None
created_at: typing_extensions.Annotated[
str,
FieldMetadata(alias="createdAt"),
@@ -123,6 +134,14 @@ class GetEmailCampaignsResponseCampaignsItem(UncheckedBaseModel):
alias="createdAt", description="Creation UTC date-time of the campaign (YYYY-MM-DDTHH:mm:ss.SSSZ)"
),
]
+ email_expiration_date: typing_extensions.Annotated[
+ typing.Optional[GetEmailCampaignsResponseCampaignsItemEmailExpirationDate],
+ FieldMetadata(alias="emailExpirationDate"),
+ pydantic.Field(
+ alias="emailExpirationDate",
+ description="Expiration date configuration for the email campaign, if set. Contains the duration and unit of the email expiry.",
+ ),
+ ] = None
footer: str = pydantic.Field()
"""
Footer of the campaign
@@ -219,20 +238,32 @@ class GetEmailCampaignsResponseCampaignsItem(UncheckedBaseModel):
utm_campaign_value: typing_extensions.Annotated[
typing.Optional[str],
FieldMetadata(alias="utmCampaignValue"),
- pydantic.Field(alias="utmCampaignValue", description="utm parameter associated with campaign"),
+ pydantic.Field(
+ alias="utmCampaignValue",
+ description="The utm_campaign value associated with the campaign. Only present if a UTM campaign value was set.",
+ ),
] = None
- utm_id_active: typing_extensions.Annotated[
- typing.Optional[bool],
- FieldMetadata(alias="utmIDActive"),
- pydantic.Field(alias="utmIDActive", description="utm id active"),
+ utm_id: typing_extensions.Annotated[
+ typing.Optional[int],
+ FieldMetadata(alias="utmID"),
+ pydantic.Field(
+ alias="utmID",
+ description="The campaign ID used as utm_id parameter. Only present if UTM campaign tracking with ID is enabled.",
+ ),
] = None
utm_medium: typing_extensions.Annotated[
- typing.Optional[str], FieldMetadata(alias="utmMedium"), pydantic.Field(alias="utmMedium")
+ typing.Optional[str],
+ FieldMetadata(alias="utmMedium"),
+ pydantic.Field(
+ alias="utmMedium", description='The utm_medium value. Set to "EMAIL" when UTM campaign tracking is enabled.'
+ ),
] = None
utm_source: typing_extensions.Annotated[
typing.Optional[str],
FieldMetadata(alias="utmSource"),
- pydantic.Field(alias="utmSource", description="source of utm"),
+ pydantic.Field(
+ alias="utmSource", description='The utm_source value. Set to "Brevo" when UTM campaign tracking is enabled.'
+ ),
] = None
recipients: GetCampaignRecipients
statistics: GetExtendedCampaignStats
diff --git a/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_email_expiration_date.py b/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_email_expiration_date.py
new file mode 100644
index 0000000..3b03b1d
--- /dev/null
+++ b/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_email_expiration_date.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .get_email_campaigns_response_campaigns_item_email_expiration_date_unit import (
+ GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit,
+)
+
+
+class GetEmailCampaignsResponseCampaignsItemEmailExpirationDate(UncheckedBaseModel):
+ """
+ Expiration date configuration for the email campaign, if set. Contains the duration and unit of the email expiry.
+ """
+
+ duration: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Duration of the email expiry
+ """
+
+ unit: typing.Optional[GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit] = pydantic.Field(default=None)
+ """
+ Unit of the duration
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_email_expiration_date_unit.py b/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_email_expiration_date_unit.py
new file mode 100644
index 0000000..7794466
--- /dev/null
+++ b/src/brevo/email_campaigns/types/get_email_campaigns_response_campaigns_item_email_expiration_date_unit.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+GetEmailCampaignsResponseCampaignsItemEmailExpirationDateUnit = typing.Union[
+ typing.Literal["days", "weeks", "months"], typing.Any
+]
diff --git a/src/brevo/event/__init__.py b/src/brevo/event/__init__.py
index d34bb1a..f965400 100644
--- a/src/brevo/event/__init__.py
+++ b/src/brevo/event/__init__.py
@@ -7,12 +7,12 @@
if typing.TYPE_CHECKING:
from .types import (
- CreateBatchEventsRequestItem,
- CreateBatchEventsRequestItemContactPropertiesValue,
- CreateBatchEventsRequestItemEventPropertiesValue,
- CreateBatchEventsRequestItemIdentifiers,
- CreateBatchEventsRequestItemObject,
- CreateBatchEventsRequestItemObjectIdentifiers,
+ CreateBatchEventsRequestEventsItem,
+ CreateBatchEventsRequestEventsItemContactPropertiesValue,
+ CreateBatchEventsRequestEventsItemEventPropertiesValue,
+ CreateBatchEventsRequestEventsItemIdentifiers,
+ CreateBatchEventsRequestEventsItemObject,
+ CreateBatchEventsRequestEventsItemObjectIdentifiers,
CreateEventRequestContactPropertiesValue,
CreateEventRequestEventPropertiesValue,
CreateEventRequestIdentifiers,
@@ -20,12 +20,12 @@
CreateEventRequestObjectIdentifiers,
)
_dynamic_imports: typing.Dict[str, str] = {
- "CreateBatchEventsRequestItem": ".types",
- "CreateBatchEventsRequestItemContactPropertiesValue": ".types",
- "CreateBatchEventsRequestItemEventPropertiesValue": ".types",
- "CreateBatchEventsRequestItemIdentifiers": ".types",
- "CreateBatchEventsRequestItemObject": ".types",
- "CreateBatchEventsRequestItemObjectIdentifiers": ".types",
+ "CreateBatchEventsRequestEventsItem": ".types",
+ "CreateBatchEventsRequestEventsItemContactPropertiesValue": ".types",
+ "CreateBatchEventsRequestEventsItemEventPropertiesValue": ".types",
+ "CreateBatchEventsRequestEventsItemIdentifiers": ".types",
+ "CreateBatchEventsRequestEventsItemObject": ".types",
+ "CreateBatchEventsRequestEventsItemObjectIdentifiers": ".types",
"CreateEventRequestContactPropertiesValue": ".types",
"CreateEventRequestEventPropertiesValue": ".types",
"CreateEventRequestIdentifiers": ".types",
@@ -56,12 +56,12 @@ def __dir__():
__all__ = [
- "CreateBatchEventsRequestItem",
- "CreateBatchEventsRequestItemContactPropertiesValue",
- "CreateBatchEventsRequestItemEventPropertiesValue",
- "CreateBatchEventsRequestItemIdentifiers",
- "CreateBatchEventsRequestItemObject",
- "CreateBatchEventsRequestItemObjectIdentifiers",
+ "CreateBatchEventsRequestEventsItem",
+ "CreateBatchEventsRequestEventsItemContactPropertiesValue",
+ "CreateBatchEventsRequestEventsItemEventPropertiesValue",
+ "CreateBatchEventsRequestEventsItemIdentifiers",
+ "CreateBatchEventsRequestEventsItemObject",
+ "CreateBatchEventsRequestEventsItemObjectIdentifiers",
"CreateEventRequestContactPropertiesValue",
"CreateEventRequestEventPropertiesValue",
"CreateEventRequestIdentifiers",
diff --git a/src/brevo/event/client.py b/src/brevo/event/client.py
index e5554f1..ba401a8 100644
--- a/src/brevo/event/client.py
+++ b/src/brevo/event/client.py
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.
+import datetime as dt
import typing
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
@@ -7,7 +8,7 @@
from ..types.batch_accepted_response import BatchAcceptedResponse
from ..types.get_events_list import GetEventsList
from .raw_client import AsyncRawEventClient, RawEventClient
-from .types.create_batch_events_request_item import CreateBatchEventsRequestItem
+from .types.create_batch_events_request_events_item import CreateBatchEventsRequestEventsItem
from .types.create_event_request_contact_properties_value import CreateEventRequestContactPropertiesValue
from .types.create_event_request_event_properties_value import CreateEventRequestEventPropertiesValue
from .types.create_event_request_identifiers import CreateEventRequestIdentifiers
@@ -109,7 +110,7 @@ def create_event(
event_name: str,
identifiers: CreateEventRequestIdentifiers,
contact_properties: typing.Optional[typing.Dict[str, CreateEventRequestContactPropertiesValue]] = OMIT,
- event_date: typing.Optional[str] = OMIT,
+ event_date: typing.Optional[dt.datetime] = OMIT,
event_properties: typing.Optional[typing.Dict[str, CreateEventRequestEventPropertiesValue]] = OMIT,
object: typing.Optional[CreateEventRequestObject] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -120,7 +121,7 @@ def create_event(
Parameters
----------
event_name : str
- 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.
+ 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.
identifiers : CreateEventRequestIdentifiers
Identifies the contact associated with the event. At least one identifier is required.
@@ -128,11 +129,11 @@ def create_event(
contact_properties : typing.Optional[typing.Dict[str, CreateEventRequestContactPropertiesValue]]
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**
- event_date : typing.Optional[str]
- 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.
+ event_date : typing.Optional[dt.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.
event_properties : typing.Optional[typing.Dict[str, CreateEventRequestEventPropertiesValue]]
- 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.
+ 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.
object : typing.Optional[CreateEventRequestObject]
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.
@@ -171,7 +172,7 @@ def create_event(
def create_batch_events(
self,
*,
- request: typing.Sequence[CreateBatchEventsRequestItem],
+ events: typing.Sequence[CreateBatchEventsRequestEventsItem],
request_options: typing.Optional[RequestOptions] = None,
) -> BatchAcceptedResponse:
"""
@@ -179,7 +180,7 @@ def create_batch_events(
Parameters
----------
- request : typing.Sequence[CreateBatchEventsRequestItem]
+ events : typing.Sequence[CreateBatchEventsRequestEventsItem]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -193,23 +194,23 @@ def create_batch_events(
--------
from brevo import Brevo
from brevo.event import (
- CreateBatchEventsRequestItem,
- CreateBatchEventsRequestItemIdentifiers,
+ CreateBatchEventsRequestEventsItem,
+ CreateBatchEventsRequestEventsItemIdentifiers,
)
client = Brevo(
api_key="YOUR_API_KEY",
)
client.event.create_batch_events(
- request=[
- CreateBatchEventsRequestItem(
+ events=[
+ CreateBatchEventsRequestEventsItem(
event_name="order_created",
- identifiers=CreateBatchEventsRequestItemIdentifiers(),
+ identifiers=CreateBatchEventsRequestEventsItemIdentifiers(),
)
],
)
"""
- _response = self._raw_client.create_batch_events(request=request, request_options=request_options)
+ _response = self._raw_client.create_batch_events(events=events, request_options=request_options)
return _response.data
@@ -313,7 +314,7 @@ async def create_event(
event_name: str,
identifiers: CreateEventRequestIdentifiers,
contact_properties: typing.Optional[typing.Dict[str, CreateEventRequestContactPropertiesValue]] = OMIT,
- event_date: typing.Optional[str] = OMIT,
+ event_date: typing.Optional[dt.datetime] = OMIT,
event_properties: typing.Optional[typing.Dict[str, CreateEventRequestEventPropertiesValue]] = OMIT,
object: typing.Optional[CreateEventRequestObject] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -324,7 +325,7 @@ async def create_event(
Parameters
----------
event_name : str
- 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.
+ 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.
identifiers : CreateEventRequestIdentifiers
Identifies the contact associated with the event. At least one identifier is required.
@@ -332,11 +333,11 @@ async def create_event(
contact_properties : typing.Optional[typing.Dict[str, CreateEventRequestContactPropertiesValue]]
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**
- event_date : typing.Optional[str]
- 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.
+ event_date : typing.Optional[dt.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.
event_properties : typing.Optional[typing.Dict[str, CreateEventRequestEventPropertiesValue]]
- 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.
+ 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.
object : typing.Optional[CreateEventRequestObject]
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.
@@ -383,7 +384,7 @@ async def main() -> None:
async def create_batch_events(
self,
*,
- request: typing.Sequence[CreateBatchEventsRequestItem],
+ events: typing.Sequence[CreateBatchEventsRequestEventsItem],
request_options: typing.Optional[RequestOptions] = None,
) -> BatchAcceptedResponse:
"""
@@ -391,7 +392,7 @@ async def create_batch_events(
Parameters
----------
- request : typing.Sequence[CreateBatchEventsRequestItem]
+ events : typing.Sequence[CreateBatchEventsRequestEventsItem]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -407,8 +408,8 @@ async def create_batch_events(
from brevo import AsyncBrevo
from brevo.event import (
- CreateBatchEventsRequestItem,
- CreateBatchEventsRequestItemIdentifiers,
+ CreateBatchEventsRequestEventsItem,
+ CreateBatchEventsRequestEventsItemIdentifiers,
)
client = AsyncBrevo(
@@ -418,10 +419,10 @@ async def create_batch_events(
async def main() -> None:
await client.event.create_batch_events(
- request=[
- CreateBatchEventsRequestItem(
+ events=[
+ CreateBatchEventsRequestEventsItem(
event_name="order_created",
- identifiers=CreateBatchEventsRequestItemIdentifiers(),
+ identifiers=CreateBatchEventsRequestEventsItemIdentifiers(),
)
],
)
@@ -429,5 +430,5 @@ async def main() -> None:
asyncio.run(main())
"""
- _response = await self._raw_client.create_batch_events(request=request, request_options=request_options)
+ _response = await self._raw_client.create_batch_events(events=events, request_options=request_options)
return _response.data
diff --git a/src/brevo/event/raw_client.py b/src/brevo/event/raw_client.py
index 7c1153c..38dedff 100644
--- a/src/brevo/event/raw_client.py
+++ b/src/brevo/event/raw_client.py
@@ -1,5 +1,6 @@
# This file was auto-generated by Fern from our API Definition.
+import datetime as dt
import typing
from json.decoder import JSONDecodeError
@@ -15,7 +16,7 @@
from ..errors.unauthorized_error import UnauthorizedError
from ..types.batch_accepted_response import BatchAcceptedResponse
from ..types.get_events_list import GetEventsList
-from .types.create_batch_events_request_item import CreateBatchEventsRequestItem
+from .types.create_batch_events_request_events_item import CreateBatchEventsRequestEventsItem
from .types.create_event_request_contact_properties_value import CreateEventRequestContactPropertiesValue
from .types.create_event_request_event_properties_value import CreateEventRequestEventPropertiesValue
from .types.create_event_request_identifiers import CreateEventRequestIdentifiers
@@ -152,7 +153,7 @@ def create_event(
event_name: str,
identifiers: CreateEventRequestIdentifiers,
contact_properties: typing.Optional[typing.Dict[str, CreateEventRequestContactPropertiesValue]] = OMIT,
- event_date: typing.Optional[str] = OMIT,
+ event_date: typing.Optional[dt.datetime] = OMIT,
event_properties: typing.Optional[typing.Dict[str, CreateEventRequestEventPropertiesValue]] = OMIT,
object: typing.Optional[CreateEventRequestObject] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -163,7 +164,7 @@ def create_event(
Parameters
----------
event_name : str
- 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.
+ 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.
identifiers : CreateEventRequestIdentifiers
Identifies the contact associated with the event. At least one identifier is required.
@@ -171,11 +172,11 @@ def create_event(
contact_properties : typing.Optional[typing.Dict[str, CreateEventRequestContactPropertiesValue]]
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**
- event_date : typing.Optional[str]
- 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.
+ event_date : typing.Optional[dt.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.
event_properties : typing.Optional[typing.Dict[str, CreateEventRequestEventPropertiesValue]]
- 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.
+ 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.
object : typing.Optional[CreateEventRequestObject]
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.
@@ -253,7 +254,7 @@ def create_event(
def create_batch_events(
self,
*,
- request: typing.Sequence[CreateBatchEventsRequestItem],
+ events: typing.Sequence[CreateBatchEventsRequestEventsItem],
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[BatchAcceptedResponse]:
"""
@@ -261,7 +262,7 @@ def create_batch_events(
Parameters
----------
- request : typing.Sequence[CreateBatchEventsRequestItem]
+ events : typing.Sequence[CreateBatchEventsRequestEventsItem]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -274,9 +275,11 @@ def create_batch_events(
_response = self._client_wrapper.httpx_client.request(
"events/batch",
method="POST",
- json=convert_and_respect_annotation_metadata(
- object_=request, annotation=typing.Sequence[CreateBatchEventsRequestItem], direction="write"
- ),
+ json={
+ "events": convert_and_respect_annotation_metadata(
+ object_=events, annotation=typing.Sequence[CreateBatchEventsRequestEventsItem], direction="write"
+ ),
+ },
headers={
"content-type": "application/json",
},
@@ -451,7 +454,7 @@ async def create_event(
event_name: str,
identifiers: CreateEventRequestIdentifiers,
contact_properties: typing.Optional[typing.Dict[str, CreateEventRequestContactPropertiesValue]] = OMIT,
- event_date: typing.Optional[str] = OMIT,
+ event_date: typing.Optional[dt.datetime] = OMIT,
event_properties: typing.Optional[typing.Dict[str, CreateEventRequestEventPropertiesValue]] = OMIT,
object: typing.Optional[CreateEventRequestObject] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
@@ -462,7 +465,7 @@ async def create_event(
Parameters
----------
event_name : str
- 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.
+ 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.
identifiers : CreateEventRequestIdentifiers
Identifies the contact associated with the event. At least one identifier is required.
@@ -470,11 +473,11 @@ async def create_event(
contact_properties : typing.Optional[typing.Dict[str, CreateEventRequestContactPropertiesValue]]
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**
- event_date : typing.Optional[str]
- 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.
+ event_date : typing.Optional[dt.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.
event_properties : typing.Optional[typing.Dict[str, CreateEventRequestEventPropertiesValue]]
- 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.
+ 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.
object : typing.Optional[CreateEventRequestObject]
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.
@@ -552,7 +555,7 @@ async def create_event(
async def create_batch_events(
self,
*,
- request: typing.Sequence[CreateBatchEventsRequestItem],
+ events: typing.Sequence[CreateBatchEventsRequestEventsItem],
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[BatchAcceptedResponse]:
"""
@@ -560,7 +563,7 @@ async def create_batch_events(
Parameters
----------
- request : typing.Sequence[CreateBatchEventsRequestItem]
+ events : typing.Sequence[CreateBatchEventsRequestEventsItem]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -573,9 +576,11 @@ async def create_batch_events(
_response = await self._client_wrapper.httpx_client.request(
"events/batch",
method="POST",
- json=convert_and_respect_annotation_metadata(
- object_=request, annotation=typing.Sequence[CreateBatchEventsRequestItem], direction="write"
- ),
+ json={
+ "events": convert_and_respect_annotation_metadata(
+ object_=events, annotation=typing.Sequence[CreateBatchEventsRequestEventsItem], direction="write"
+ ),
+ },
headers={
"content-type": "application/json",
},
diff --git a/src/brevo/event/types/__init__.py b/src/brevo/event/types/__init__.py
index 4756a15..507e07c 100644
--- a/src/brevo/event/types/__init__.py
+++ b/src/brevo/event/types/__init__.py
@@ -6,28 +6,30 @@
from importlib import import_module
if typing.TYPE_CHECKING:
- from .create_batch_events_request_item import CreateBatchEventsRequestItem
- from .create_batch_events_request_item_contact_properties_value import (
- CreateBatchEventsRequestItemContactPropertiesValue,
+ from .create_batch_events_request_events_item import CreateBatchEventsRequestEventsItem
+ from .create_batch_events_request_events_item_contact_properties_value import (
+ CreateBatchEventsRequestEventsItemContactPropertiesValue,
)
- from .create_batch_events_request_item_event_properties_value import (
- CreateBatchEventsRequestItemEventPropertiesValue,
+ from .create_batch_events_request_events_item_event_properties_value import (
+ CreateBatchEventsRequestEventsItemEventPropertiesValue,
+ )
+ from .create_batch_events_request_events_item_identifiers import CreateBatchEventsRequestEventsItemIdentifiers
+ from .create_batch_events_request_events_item_object import CreateBatchEventsRequestEventsItemObject
+ from .create_batch_events_request_events_item_object_identifiers import (
+ CreateBatchEventsRequestEventsItemObjectIdentifiers,
)
- from .create_batch_events_request_item_identifiers import CreateBatchEventsRequestItemIdentifiers
- from .create_batch_events_request_item_object import CreateBatchEventsRequestItemObject
- from .create_batch_events_request_item_object_identifiers import CreateBatchEventsRequestItemObjectIdentifiers
from .create_event_request_contact_properties_value import CreateEventRequestContactPropertiesValue
from .create_event_request_event_properties_value import CreateEventRequestEventPropertiesValue
from .create_event_request_identifiers import CreateEventRequestIdentifiers
from .create_event_request_object import CreateEventRequestObject
from .create_event_request_object_identifiers import CreateEventRequestObjectIdentifiers
_dynamic_imports: typing.Dict[str, str] = {
- "CreateBatchEventsRequestItem": ".create_batch_events_request_item",
- "CreateBatchEventsRequestItemContactPropertiesValue": ".create_batch_events_request_item_contact_properties_value",
- "CreateBatchEventsRequestItemEventPropertiesValue": ".create_batch_events_request_item_event_properties_value",
- "CreateBatchEventsRequestItemIdentifiers": ".create_batch_events_request_item_identifiers",
- "CreateBatchEventsRequestItemObject": ".create_batch_events_request_item_object",
- "CreateBatchEventsRequestItemObjectIdentifiers": ".create_batch_events_request_item_object_identifiers",
+ "CreateBatchEventsRequestEventsItem": ".create_batch_events_request_events_item",
+ "CreateBatchEventsRequestEventsItemContactPropertiesValue": ".create_batch_events_request_events_item_contact_properties_value",
+ "CreateBatchEventsRequestEventsItemEventPropertiesValue": ".create_batch_events_request_events_item_event_properties_value",
+ "CreateBatchEventsRequestEventsItemIdentifiers": ".create_batch_events_request_events_item_identifiers",
+ "CreateBatchEventsRequestEventsItemObject": ".create_batch_events_request_events_item_object",
+ "CreateBatchEventsRequestEventsItemObjectIdentifiers": ".create_batch_events_request_events_item_object_identifiers",
"CreateEventRequestContactPropertiesValue": ".create_event_request_contact_properties_value",
"CreateEventRequestEventPropertiesValue": ".create_event_request_event_properties_value",
"CreateEventRequestIdentifiers": ".create_event_request_identifiers",
@@ -58,12 +60,12 @@ def __dir__():
__all__ = [
- "CreateBatchEventsRequestItem",
- "CreateBatchEventsRequestItemContactPropertiesValue",
- "CreateBatchEventsRequestItemEventPropertiesValue",
- "CreateBatchEventsRequestItemIdentifiers",
- "CreateBatchEventsRequestItemObject",
- "CreateBatchEventsRequestItemObjectIdentifiers",
+ "CreateBatchEventsRequestEventsItem",
+ "CreateBatchEventsRequestEventsItemContactPropertiesValue",
+ "CreateBatchEventsRequestEventsItemEventPropertiesValue",
+ "CreateBatchEventsRequestEventsItemIdentifiers",
+ "CreateBatchEventsRequestEventsItemObject",
+ "CreateBatchEventsRequestEventsItemObjectIdentifiers",
"CreateEventRequestContactPropertiesValue",
"CreateEventRequestEventPropertiesValue",
"CreateEventRequestIdentifiers",
diff --git a/src/brevo/event/types/create_batch_events_request_item.py b/src/brevo/event/types/create_batch_events_request_events_item.py
similarity index 70%
rename from src/brevo/event/types/create_batch_events_request_item.py
rename to src/brevo/event/types/create_batch_events_request_events_item.py
index c4f0679..5d35b2d 100644
--- a/src/brevo/event/types/create_batch_events_request_item.py
+++ b/src/brevo/event/types/create_batch_events_request_events_item.py
@@ -5,16 +5,18 @@
import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.unchecked_base_model import UncheckedBaseModel
-from .create_batch_events_request_item_contact_properties_value import (
- CreateBatchEventsRequestItemContactPropertiesValue,
+from .create_batch_events_request_events_item_contact_properties_value import (
+ CreateBatchEventsRequestEventsItemContactPropertiesValue,
)
-from .create_batch_events_request_item_event_properties_value import CreateBatchEventsRequestItemEventPropertiesValue
-from .create_batch_events_request_item_identifiers import CreateBatchEventsRequestItemIdentifiers
-from .create_batch_events_request_item_object import CreateBatchEventsRequestItemObject
+from .create_batch_events_request_events_item_event_properties_value import (
+ CreateBatchEventsRequestEventsItemEventPropertiesValue,
+)
+from .create_batch_events_request_events_item_identifiers import CreateBatchEventsRequestEventsItemIdentifiers
+from .create_batch_events_request_events_item_object import CreateBatchEventsRequestEventsItemObject
-class CreateBatchEventsRequestItem(UncheckedBaseModel):
- contact_properties: typing.Optional[typing.Dict[str, CreateBatchEventsRequestItemContactPropertiesValue]] = (
+class CreateBatchEventsRequestEventsItem(UncheckedBaseModel):
+ contact_properties: typing.Optional[typing.Dict[str, CreateBatchEventsRequestEventsItemContactPropertiesValue]] = (
pydantic.Field(default=None)
)
"""
@@ -31,19 +33,19 @@ class CreateBatchEventsRequestItem(UncheckedBaseModel):
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.
"""
- event_properties: typing.Optional[typing.Dict[str, CreateBatchEventsRequestItemEventPropertiesValue]] = (
+ event_properties: typing.Optional[typing.Dict[str, CreateBatchEventsRequestEventsItemEventPropertiesValue]] = (
pydantic.Field(default=None)
)
"""
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.
"""
- identifiers: CreateBatchEventsRequestItemIdentifiers = pydantic.Field()
+ identifiers: CreateBatchEventsRequestEventsItemIdentifiers = pydantic.Field()
"""
Identifies the contact associated with the event. At least one identifier is required.
"""
- object: typing.Optional[CreateBatchEventsRequestItemObject] = pydantic.Field(default=None)
+ object: typing.Optional[CreateBatchEventsRequestEventsItemObject] = pydantic.Field(default=None)
"""
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.
"""
diff --git a/src/brevo/event/types/create_batch_events_request_events_item_contact_properties_value.py b/src/brevo/event/types/create_batch_events_request_events_item_contact_properties_value.py
new file mode 100644
index 0000000..a3b5016
--- /dev/null
+++ b/src/brevo/event/types/create_batch_events_request_events_item_contact_properties_value.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CreateBatchEventsRequestEventsItemContactPropertiesValue = typing.Union[str, int]
diff --git a/src/brevo/event/types/create_batch_events_request_events_item_event_properties_value.py b/src/brevo/event/types/create_batch_events_request_events_item_event_properties_value.py
new file mode 100644
index 0000000..bd4a99c
--- /dev/null
+++ b/src/brevo/event/types/create_batch_events_request_events_item_event_properties_value.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CreateBatchEventsRequestEventsItemEventPropertiesValue = typing.Union[
+ str, int, typing.Dict[str, typing.Any], typing.List[typing.Any]
+]
diff --git a/src/brevo/event/types/create_batch_events_request_item_identifiers.py b/src/brevo/event/types/create_batch_events_request_events_item_identifiers.py
similarity index 95%
rename from src/brevo/event/types/create_batch_events_request_item_identifiers.py
rename to src/brevo/event/types/create_batch_events_request_events_item_identifiers.py
index 10b9844..e392ea2 100644
--- a/src/brevo/event/types/create_batch_events_request_item_identifiers.py
+++ b/src/brevo/event/types/create_batch_events_request_events_item_identifiers.py
@@ -7,7 +7,7 @@
from ...core.unchecked_base_model import UncheckedBaseModel
-class CreateBatchEventsRequestItemIdentifiers(UncheckedBaseModel):
+class CreateBatchEventsRequestEventsItemIdentifiers(UncheckedBaseModel):
"""
Identifies the contact associated with the event. At least one identifier is required.
"""
diff --git a/src/brevo/event/types/create_batch_events_request_item_object.py b/src/brevo/event/types/create_batch_events_request_events_item_object.py
similarity index 72%
rename from src/brevo/event/types/create_batch_events_request_item_object.py
rename to src/brevo/event/types/create_batch_events_request_events_item_object.py
index 82f513b..e54d32e 100644
--- a/src/brevo/event/types/create_batch_events_request_item_object.py
+++ b/src/brevo/event/types/create_batch_events_request_events_item_object.py
@@ -5,15 +5,17 @@
import pydantic
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from ...core.unchecked_base_model import UncheckedBaseModel
-from .create_batch_events_request_item_object_identifiers import CreateBatchEventsRequestItemObjectIdentifiers
+from .create_batch_events_request_events_item_object_identifiers import (
+ CreateBatchEventsRequestEventsItemObjectIdentifiers,
+)
-class CreateBatchEventsRequestItemObject(UncheckedBaseModel):
+class CreateBatchEventsRequestEventsItemObject(UncheckedBaseModel):
"""
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.
"""
- identifiers: typing.Optional[CreateBatchEventsRequestItemObjectIdentifiers] = pydantic.Field(default=None)
+ identifiers: typing.Optional[CreateBatchEventsRequestEventsItemObjectIdentifiers] = pydantic.Field(default=None)
"""
Identifiers for the object.
"""
diff --git a/src/brevo/event/types/create_batch_events_request_item_object_identifiers.py b/src/brevo/event/types/create_batch_events_request_events_item_object_identifiers.py
similarity index 90%
rename from src/brevo/event/types/create_batch_events_request_item_object_identifiers.py
rename to src/brevo/event/types/create_batch_events_request_events_item_object_identifiers.py
index 7e3278d..7daf800 100644
--- a/src/brevo/event/types/create_batch_events_request_item_object_identifiers.py
+++ b/src/brevo/event/types/create_batch_events_request_events_item_object_identifiers.py
@@ -7,7 +7,7 @@
from ...core.unchecked_base_model import UncheckedBaseModel
-class CreateBatchEventsRequestItemObjectIdentifiers(UncheckedBaseModel):
+class CreateBatchEventsRequestEventsItemObjectIdentifiers(UncheckedBaseModel):
"""
Identifiers for the object.
"""
diff --git a/src/brevo/event/types/create_batch_events_request_item_contact_properties_value.py b/src/brevo/event/types/create_batch_events_request_item_contact_properties_value.py
deleted file mode 100644
index cbff3ef..0000000
--- a/src/brevo/event/types/create_batch_events_request_item_contact_properties_value.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-CreateBatchEventsRequestItemContactPropertiesValue = typing.Union[str, int, bool]
diff --git a/src/brevo/event/types/create_batch_events_request_item_event_properties_value.py b/src/brevo/event/types/create_batch_events_request_item_event_properties_value.py
deleted file mode 100644
index 20b1f6a..0000000
--- a/src/brevo/event/types/create_batch_events_request_item_event_properties_value.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-CreateBatchEventsRequestItemEventPropertiesValue = typing.Union[
- str, int, bool, typing.Dict[str, typing.Any], typing.List[typing.Any]
-]
diff --git a/src/brevo/external_feeds/types/get_all_external_feeds_response_feeds_item.py b/src/brevo/external_feeds/types/get_all_external_feeds_response_feeds_item.py
index 776efe8..fbcee7c 100644
--- a/src/brevo/external_feeds/types/get_all_external_feeds_response_feeds_item.py
+++ b/src/brevo/external_feeds/types/get_all_external_feeds_response_feeds_item.py
@@ -23,11 +23,6 @@ class GetAllExternalFeedsResponseFeedsItem(UncheckedBaseModel):
Name of the feed
"""
- alias: str = pydantic.Field()
- """
- URL-friendly alias for the feed
- """
-
url: str = pydantic.Field()
"""
URL of the external data source
@@ -40,17 +35,17 @@ class GetAllExternalFeedsResponseFeedsItem(UncheckedBaseModel):
]
username: typing.Optional[str] = pydantic.Field(default=None)
"""
- Username for basic authentication
+ Username for basic authentication. Only returned when authType is 'basic'. Excluded when authType is 'token'.
"""
password: typing.Optional[str] = pydantic.Field(default=None)
"""
- Password for basic authentication
+ Password for basic authentication. Only returned when authType is 'basic'. Excluded when authType is 'token'.
"""
token: typing.Optional[str] = pydantic.Field(default=None)
"""
- Token for token-based authentication
+ Token for token-based authentication. Only returned when authType is 'token'. Excluded when authType is 'basic' or 'noAuth'.
"""
max_retries: typing_extensions.Annotated[
@@ -63,11 +58,6 @@ class GetAllExternalFeedsResponseFeedsItem(UncheckedBaseModel):
Whether to cache the feed response
"""
- is_internal: typing_extensions.Annotated[
- bool,
- FieldMetadata(alias="isInternal"),
- pydantic.Field(alias="isInternal", description="Whether this is an internal Brevo system feed"),
- ]
headers: typing.Optional[typing.List[GetAllExternalFeedsResponseFeedsItemHeadersItem]] = pydantic.Field(
default=None
)
diff --git a/src/brevo/external_feeds/types/get_external_feed_by_uuid_response.py b/src/brevo/external_feeds/types/get_external_feed_by_uuid_response.py
index 0dfa77c..62ce69b 100644
--- a/src/brevo/external_feeds/types/get_external_feed_by_uuid_response.py
+++ b/src/brevo/external_feeds/types/get_external_feed_by_uuid_response.py
@@ -35,40 +35,19 @@ class GetExternalFeedByUuidResponse(UncheckedBaseModel):
]
username: typing.Optional[str] = pydantic.Field(default=None)
"""
- Username for basic authentication (null if not using basic auth)
+ Username for basic authentication. Only returned when authType is 'basic'. Excluded from response when authType is 'token'.
"""
password: typing.Optional[str] = pydantic.Field(default=None)
"""
- Password for basic authentication (null if not using basic auth)
+ Password for basic authentication. Only returned when authType is 'basic'. Excluded from response when authType is 'token'.
"""
token: typing.Optional[str] = pydantic.Field(default=None)
"""
- Token for token-based authentication (null if not using token auth)
+ Token for token-based authentication. Only returned when authType is 'token'. Excluded from response when authType is 'basic' or 'noAuth'.
"""
- personalization: bool = pydantic.Field()
- """
- Whether personalization is enabled for this feed
- """
-
- default_attr: typing_extensions.Annotated[
- str,
- FieldMetadata(alias="defaultAttr"),
- pydantic.Field(
- alias="defaultAttr",
- description="Default attribute name for personalization fallback (empty string if not set)",
- ),
- ]
- default_contact: typing_extensions.Annotated[
- str,
- FieldMetadata(alias="defaultContact"),
- pydantic.Field(
- alias="defaultContact",
- description="Default contact email for personalization fallback (empty string if not set)",
- ),
- ]
headers: typing.Optional[typing.List[GetExternalFeedByUuidResponseHeadersItem]] = pydantic.Field(default=None)
"""
Custom HTTP headers for the feed request
diff --git a/src/brevo/files/client.py b/src/brevo/files/client.py
index 7009caf..4dc9494 100644
--- a/src/brevo/files/client.py
+++ b/src/brevo/files/client.py
@@ -43,6 +43,8 @@ def get_all_files(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[FileData]:
"""
+ 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.
+
Parameters
----------
entity : typing.Optional[GetCrmFilesRequestEntity]
@@ -105,6 +107,8 @@ def upload_a_file(
request_options: typing.Optional[RequestOptions] = None,
) -> FileData:
"""
+ 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.
+
Parameters
----------
file : core.File
@@ -142,6 +146,8 @@ def download_a_file(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetCrmFilesIdResponse:
"""
+ 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.
+
Parameters
----------
id : str
@@ -171,6 +177,8 @@ def download_a_file(
def delete_a_file(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ Permanently delete a CRM file by its identifier. This removes the file from storage and unlinks it from any associated contacts, companies, or deals.
+
Parameters
----------
id : str
@@ -199,6 +207,8 @@ def delete_a_file(self, id: str, *, request_options: typing.Optional[RequestOpti
def get_file_details(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> FileData:
"""
+ 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.
+
Parameters
----------
id : str
@@ -255,6 +265,8 @@ async def get_all_files(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[FileData]:
"""
+ 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.
+
Parameters
----------
entity : typing.Optional[GetCrmFilesRequestEntity]
@@ -325,6 +337,8 @@ async def upload_a_file(
request_options: typing.Optional[RequestOptions] = None,
) -> FileData:
"""
+ 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.
+
Parameters
----------
file : core.File
@@ -370,6 +384,8 @@ async def download_a_file(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetCrmFilesIdResponse:
"""
+ 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.
+
Parameters
----------
id : str
@@ -407,6 +423,8 @@ async def main() -> None:
async def delete_a_file(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ Permanently delete a CRM file by its identifier. This removes the file from storage and unlinks it from any associated contacts, companies, or deals.
+
Parameters
----------
id : str
@@ -443,6 +461,8 @@ async def main() -> None:
async def get_file_details(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> FileData:
"""
+ 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.
+
Parameters
----------
id : str
diff --git a/src/brevo/files/raw_client.py b/src/brevo/files/raw_client.py
index 1f292fa..b4522f7 100644
--- a/src/brevo/files/raw_client.py
+++ b/src/brevo/files/raw_client.py
@@ -40,6 +40,8 @@ def get_all_files(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[typing.List[FileData]]:
"""
+ 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.
+
Parameters
----------
entity : typing.Optional[GetCrmFilesRequestEntity]
@@ -125,6 +127,8 @@ def upload_a_file(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[FileData]:
"""
+ 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.
+
Parameters
----------
file : core.File
@@ -193,6 +197,8 @@ def download_a_file(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[GetCrmFilesIdResponse]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -254,6 +260,8 @@ def download_a_file(
def delete_a_file(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
"""
+ Permanently delete a CRM file by its identifier. This removes the file from storage and unlinks it from any associated contacts, companies, or deals.
+
Parameters
----------
id : str
@@ -309,6 +317,8 @@ def get_file_details(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[FileData]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -386,6 +396,8 @@ async def get_all_files(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[typing.List[FileData]]:
"""
+ 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.
+
Parameters
----------
entity : typing.Optional[GetCrmFilesRequestEntity]
@@ -471,6 +483,8 @@ async def upload_a_file(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[FileData]:
"""
+ 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.
+
Parameters
----------
file : core.File
@@ -539,6 +553,8 @@ async def download_a_file(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[GetCrmFilesIdResponse]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -602,6 +618,8 @@ async def delete_a_file(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ Permanently delete a CRM file by its identifier. This removes the file from storage and unlinks it from any associated contacts, companies, or deals.
+
Parameters
----------
id : str
@@ -657,6 +675,8 @@ async def get_file_details(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[FileData]:
"""
+ 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.
+
Parameters
----------
id : str
diff --git a/src/brevo/inbound_parsing/client.py b/src/brevo/inbound_parsing/client.py
index 3bff546..922a978 100644
--- a/src/brevo/inbound_parsing/client.py
+++ b/src/brevo/inbound_parsing/client.py
@@ -37,7 +37,7 @@ def get_inbound_email_events(
request_options: typing.Optional[RequestOptions] = None,
) -> GetInboundEmailEventsResponse:
"""
- 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.
Parameters
----------
@@ -45,10 +45,10 @@ def get_inbound_email_events(
Email address of the sender.
start_date : typing.Optional[str]
- 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.
+ 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.
end_date : typing.Optional[str]
- 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.
+ 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.
limit : typing.Optional[int]
Number of documents returned per page
@@ -104,7 +104,7 @@ def get_inbound_email_events_by_uuid(
Returns
-------
GetInboundEmailEventsByUuidResponse
- Email campaign informations
+ Detailed information and event history for the specified received email.
Examples
--------
@@ -181,7 +181,7 @@ async def get_inbound_email_events(
request_options: typing.Optional[RequestOptions] = None,
) -> GetInboundEmailEventsResponse:
"""
- 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.
Parameters
----------
@@ -189,10 +189,10 @@ async def get_inbound_email_events(
Email address of the sender.
start_date : typing.Optional[str]
- 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.
+ 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.
end_date : typing.Optional[str]
- 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.
+ 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.
limit : typing.Optional[int]
Number of documents returned per page
@@ -256,7 +256,7 @@ async def get_inbound_email_events_by_uuid(
Returns
-------
GetInboundEmailEventsByUuidResponse
- Email campaign informations
+ Detailed information and event history for the specified received email.
Examples
--------
diff --git a/src/brevo/inbound_parsing/raw_client.py b/src/brevo/inbound_parsing/raw_client.py
index 2781da0..01dc886 100644
--- a/src/brevo/inbound_parsing/raw_client.py
+++ b/src/brevo/inbound_parsing/raw_client.py
@@ -35,7 +35,7 @@ def get_inbound_email_events(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[GetInboundEmailEventsResponse]:
"""
- 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.
Parameters
----------
@@ -43,10 +43,10 @@ def get_inbound_email_events(
Email address of the sender.
start_date : typing.Optional[str]
- 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.
+ 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.
end_date : typing.Optional[str]
- 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.
+ 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.
limit : typing.Optional[int]
Number of documents returned per page
@@ -125,7 +125,7 @@ def get_inbound_email_events_by_uuid(
Returns
-------
HttpResponse[GetInboundEmailEventsByUuidResponse]
- Email campaign informations
+ Detailed information and event history for the specified received email.
"""
_response = self._client_wrapper.httpx_client.request(
f"inbound/events/{jsonable_encoder(uuid_)}",
@@ -153,6 +153,17 @@ def get_inbound_email_events_by_uuid(
),
),
)
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -251,7 +262,7 @@ async def get_inbound_email_events(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[GetInboundEmailEventsResponse]:
"""
- 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.
Parameters
----------
@@ -259,10 +270,10 @@ async def get_inbound_email_events(
Email address of the sender.
start_date : typing.Optional[str]
- 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.
+ 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.
end_date : typing.Optional[str]
- 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.
+ 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.
limit : typing.Optional[int]
Number of documents returned per page
@@ -341,7 +352,7 @@ async def get_inbound_email_events_by_uuid(
Returns
-------
AsyncHttpResponse[GetInboundEmailEventsByUuidResponse]
- Email campaign informations
+ Detailed information and event history for the specified received email.
"""
_response = await self._client_wrapper.httpx_client.request(
f"inbound/events/{jsonable_encoder(uuid_)}",
@@ -369,6 +380,17 @@ async def get_inbound_email_events_by_uuid(
),
),
)
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
diff --git a/src/brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response.py b/src/brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response.py
index f2e7c99..8a2e882 100644
--- a/src/brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response.py
+++ b/src/brevo/inbound_parsing/types/get_inbound_email_events_by_uuid_response.py
@@ -26,12 +26,12 @@ class GetInboundEmailEventsByUuidResponse(UncheckedBaseModel):
typing.Optional[dt.datetime],
FieldMetadata(alias="deliveredAt"),
pydantic.Field(
- alias="deliveredAt", description="Date when email was delivered successfully to client_devβs webhook"
+ alias="deliveredAt", description="Date when email was delivered successfully to the clientβs webhook"
),
] = None
logs: typing.Optional[typing.List[GetInboundEmailEventsByUuidResponseLogsItem]] = pydantic.Field(default=None)
"""
- List of events/logs that describe the lifecycle of the email on SIB platform
+ List of events/logs that describe the lifecycle of the email on the Brevo platform
"""
message_id: typing_extensions.Annotated[
diff --git a/src/brevo/master_account/client.py b/src/brevo/master_account/client.py
index 9a46ce3..845b8de 100644
--- a/src/brevo/master_account/client.py
+++ b/src/brevo/master_account/client.py
@@ -734,6 +734,8 @@ def get_sub_account_details(
def delete_a_sub_account(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
id : int
@@ -2126,6 +2128,8 @@ async def main() -> None:
async def delete_a_sub_account(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ 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.
+
Parameters
----------
id : int
diff --git a/src/brevo/master_account/raw_client.py b/src/brevo/master_account/raw_client.py
index 5d19024..1fd30f0 100644
--- a/src/brevo/master_account/raw_client.py
+++ b/src/brevo/master_account/raw_client.py
@@ -215,6 +215,17 @@ def get_a_group_details(
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -367,6 +378,17 @@ def get_sub_account_groups(
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -431,6 +453,17 @@ def get_corporate_invited_users_list(
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -472,6 +505,17 @@ def list_of_all_i_ps(
),
)
return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -1102,6 +1146,8 @@ def delete_a_sub_account(
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : int
@@ -1971,6 +2017,17 @@ async def get_a_group_details(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -2125,6 +2182,17 @@ async def get_sub_account_groups(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -2189,6 +2257,17 @@ async def get_corporate_invited_users_list(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -2230,6 +2309,17 @@ async def list_of_all_i_ps(
),
)
return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Any,
+ construct_type(
+ type_=typing.Any, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -2860,6 +2950,8 @@ async def delete_a_sub_account(
self, id: int, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : int
diff --git a/src/brevo/notes/client.py b/src/brevo/notes/client.py
index 244f40c..3ac3622 100644
--- a/src/brevo/notes/client.py
+++ b/src/brevo/notes/client.py
@@ -42,6 +42,8 @@ def get_all_notes(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[Note]:
"""
+ 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.
+
Parameters
----------
entity : typing.Optional[GetCrmNotesRequestEntity]
@@ -104,10 +106,12 @@ def create_a_note(
request_options: typing.Optional[RequestOptions] = None,
) -> PostCrmNotesResponse:
"""
+ 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.
+
Parameters
----------
text : str
- Text content of a note
+ 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`.
company_ids : typing.Optional[typing.Sequence[str]]
Company Ids linked to a note
@@ -134,7 +138,7 @@ def create_a_note(
api_key="YOUR_API_KEY",
)
client.notes.create_a_note(
- text="In communication with client_dev for resolution of queries.",
+ text='Meeting notes: Action item - visit Brevo for details.
',
)
"""
_response = self._raw_client.create_a_note(
@@ -148,6 +152,8 @@ def create_a_note(
def get_a_note(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Note:
"""
+ 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.
+
Parameters
----------
id : str
@@ -177,6 +183,8 @@ def get_a_note(self, id: str, *, request_options: typing.Optional[RequestOptions
def delete_a_note(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ Permanently delete a CRM note by its identifier. This removes the note and unlinks it from any associated contacts, companies, or deals.
+
Parameters
----------
id : str
@@ -214,13 +222,15 @@ def update_a_note(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
Note ID to update
text : str
- Text content of a note
+ 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`.
company_ids : typing.Optional[typing.Sequence[str]]
Company Ids linked to a note
@@ -247,7 +257,7 @@ def update_a_note(
)
client.notes.update_a_note(
id="id",
- text="In communication with client_dev for resolution of queries.",
+ text='Meeting notes: Action item - visit Brevo for details.
',
)
"""
_response = self._raw_client.update_a_note(
@@ -289,6 +299,8 @@ async def get_all_notes(
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[Note]:
"""
+ 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.
+
Parameters
----------
entity : typing.Optional[GetCrmNotesRequestEntity]
@@ -359,10 +371,12 @@ async def create_a_note(
request_options: typing.Optional[RequestOptions] = None,
) -> PostCrmNotesResponse:
"""
+ 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.
+
Parameters
----------
text : str
- Text content of a note
+ 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`.
company_ids : typing.Optional[typing.Sequence[str]]
Company Ids linked to a note
@@ -394,7 +408,7 @@ async def create_a_note(
async def main() -> None:
await client.notes.create_a_note(
- text="In communication with client_dev for resolution of queries.",
+ text='Meeting notes: Action item - visit Brevo for details.
',
)
@@ -411,6 +425,8 @@ async def main() -> None:
async def get_a_note(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Note:
"""
+ 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.
+
Parameters
----------
id : str
@@ -448,6 +464,8 @@ async def main() -> None:
async def delete_a_note(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
+ Permanently delete a CRM note by its identifier. This removes the note and unlinks it from any associated contacts, companies, or deals.
+
Parameters
----------
id : str
@@ -493,13 +511,15 @@ async def update_a_note(
request_options: typing.Optional[RequestOptions] = None,
) -> None:
"""
+ 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.
+
Parameters
----------
id : str
Note ID to update
text : str
- Text content of a note
+ 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`.
company_ids : typing.Optional[typing.Sequence[str]]
Company Ids linked to a note
@@ -531,7 +551,7 @@ async def update_a_note(
async def main() -> None:
await client.notes.update_a_note(
id="id",
- text="In communication with client_dev for resolution of queries.",
+ text='Meeting notes: Action item - visit Brevo for details.
',
)
diff --git a/src/brevo/notes/raw_client.py b/src/brevo/notes/raw_client.py
index 885b1b9..e9b4d29 100644
--- a/src/brevo/notes/raw_client.py
+++ b/src/brevo/notes/raw_client.py
@@ -41,6 +41,8 @@ def get_all_notes(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[typing.List[Note]]:
"""
+ 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.
+
Parameters
----------
entity : typing.Optional[GetCrmNotesRequestEntity]
@@ -126,10 +128,12 @@ def create_a_note(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[PostCrmNotesResponse]:
"""
+ 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.
+
Parameters
----------
text : str
- Text content of a note
+ 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`.
company_ids : typing.Optional[typing.Sequence[str]]
Company Ids linked to a note
@@ -206,6 +210,8 @@ def create_a_note(
def get_a_note(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Note]:
"""
+ 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.
+
Parameters
----------
id : str
@@ -267,6 +273,8 @@ def get_a_note(self, id: str, *, request_options: typing.Optional[RequestOptions
def delete_a_note(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
"""
+ Permanently delete a CRM note by its identifier. This removes the note and unlinks it from any associated contacts, companies, or deals.
+
Parameters
----------
id : str
@@ -329,13 +337,15 @@ def update_a_note(
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[None]:
"""
+ 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.
+
Parameters
----------
id : str
Note ID to update
text : str
- Text content of a note
+ 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`.
company_ids : typing.Optional[typing.Sequence[str]]
Company Ids linked to a note
@@ -431,6 +441,8 @@ async def get_all_notes(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[typing.List[Note]]:
"""
+ 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.
+
Parameters
----------
entity : typing.Optional[GetCrmNotesRequestEntity]
@@ -516,10 +528,12 @@ async def create_a_note(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[PostCrmNotesResponse]:
"""
+ 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.
+
Parameters
----------
text : str
- Text content of a note
+ Content of the note. Supports HTML for rich text formatting. Supported tags include: `` (paragraph), `` / `` (bold), `