(marketing) create marketing backend abstraction

Marteking backends will have to implement an abstract base backend in
order to be able to not be dependant from only one implementation
This commit is contained in:
Manuel Raynaud
2025-12-03 16:31:41 +01:00
parent 7e88f9d111
commit 879a153d90
4 changed files with 44 additions and 0 deletions

View File

@@ -8,6 +8,10 @@ and this project adheres to
## [Unreleased]
### Added
- ✨(marketing) create marketing module
## [0.0.21] - 2025-12-04
### Added

View File

@@ -0,0 +1 @@
"""Marketing module."""

View File

@@ -0,0 +1,13 @@
"""Marketing backends module."""
from dataclasses import dataclass
@dataclass
class ContactData:
"""Contact data for marketing service integration."""
email: str
attributes: dict[str, str] | None = None
list_ids: list[int] | None = None
update_enabled: bool = True

View File

@@ -0,0 +1,26 @@
"""Marketing backend base module."""
from abc import ABC, abstractmethod
from lasuite.marketing.backends import ContactData
class BaseBackend(ABC):
"""Base class for all marketing backends."""
@abstractmethod
def create_or_update_contact(self, contact_data: ContactData, timeout: int = None) -> dict:
"""
Create or update a contact.
Args:
contact_data: Contact information and attributes
timeout: API request timeout in seconds
Returns:
dict: Service response
Raises:
ContactCreationError: If contact creation fails
"""