from anydi import singleton from owsclient import OwsClient @singleton class OwsPreferenceCenterClient: service_name = "ows-preference-center" def __init__(self, ows_client: OwsClient) -> None: self.ows_client = ows_client def unsubscribe_from_all( self, email: str, origin_id: str | None = None, origin_type: str | None = None, automated_trigger_id: str | None = None, ) -> None: """ Unsubscribe user from all in Preference center """ data = { "email": email, "origin_id": origin_id, "origin_type": origin_type, "automated_trigger_id": automated_trigger_id, } response = self.ows_client.post( self.service_name, "/subscriptions/unsubscribe-all", json=data, timeout=15 ) response.raise_for_status()