mirror of
https://github.com/suitenumerique/django-lasuite
synced 2026-04-25 17:15:14 +02:00
✨(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:
@@ -8,6 +8,10 @@ and this project adheres to
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- ✨(marketing) create marketing module
|
||||
|
||||
## [0.0.21] - 2025-12-04
|
||||
|
||||
### Added
|
||||
|
||||
1
src/lasuite/marketing/__init__.py
Normal file
1
src/lasuite/marketing/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Marketing module."""
|
||||
13
src/lasuite/marketing/backends/__init__.py
Normal file
13
src/lasuite/marketing/backends/__init__.py
Normal 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
|
||||
26
src/lasuite/marketing/backends/base.py
Normal file
26
src/lasuite/marketing/backends/base.py
Normal 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
|
||||
|
||||
"""
|
||||
Reference in New Issue
Block a user