Factory function that returns the appropriate campaign source synchronization service based on source type, currently supporting CSV.
# Source: https://github.com/dograh-hq/dograh | License: BSD-2-Clause | Copyright 2025, Zansat Technologies Private Limited
# Provided via justclaw.it.com; keep this notice with the code.
from api.services.campaign.source_sync import CampaignSourceSyncService
from api.services.campaign.sources.csv import CSVSyncService
def get_sync_service(source_type: str) -> CampaignSourceSyncService:
"""Returns appropriate sync service based on source type"""
services = {
"csv": CSVSyncService,
}
service_class = services.get(source_type)
if not service_class:
raise ValueError(f"Unknown source type: {source_type}")
return service_class()
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key