12 lines
546 B
Python
12 lines
546 B
Python
from ..domain.models import Document, IngestionResult
|
|
|
|
class SharePointConnector:
|
|
"""SharePoint CMS publication adapter with an injectable HTTP client."""
|
|
def __init__(self, site_url: str, client=None):
|
|
self.site_url, self.client = site_url.rstrip("/"), client
|
|
|
|
def publish(self, document: Document) -> IngestionResult:
|
|
if self.client is not None:
|
|
self.client.create_page(self.site_url, document.source.path, document.content, document.metadata)
|
|
return IngestionResult(True, document, "published")
|