Model/infrastructure/hubspot/deal_properties_client.py
Daniel Roth ed08a6adfe HubSpot clients share one scrubbed-retry call policy 🟪
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 16:02:22 +00:00

28 lines
1.1 KiB
Python

from hubspot.client import Client # type: ignore[reportMissingTypeStubs]
from hubspot.crm.deals import SimplePublicObjectInput # type: ignore[reportMissingTypeStubs]
from infrastructure.hubspot.scrubbed_calls import scrubbed_call_with_retry
class HubspotDealPropertiesClient:
"""Focused HubSpot client for writing single deal properties.
Deliberately separate from the legacy HubspotClient (frozen for the
refactor tracked in issue #1473): the SDK client is constructor-injected,
and SDK errors are re-raised scrubbed of response bodies.
"""
def __init__(self, sdk_client: Client) -> None:
self._client: Client = sdk_client
def write_deal_property(
self, deal_id: str, property_name: str, value: str
) -> None:
scrubbed_call_with_retry(
lambda: self._client.crm.deals.basic_api.update( # type: ignore[reportUnknownMemberType]
deal_id,
simple_public_object_input=SimplePublicObjectInput(
properties={property_name: value}
),
)
)