mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
28 lines
1.1 KiB
Python
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}
|
|
),
|
|
)
|
|
)
|