"""ows-product-digital connector.""" from http import HTTPStatus from owsclient import OwsClient class OwsProductDigitalConnector: def __init__(self, client: OwsClient): """Initialize ows-product-digital connector.""" self.client = client def create_product_spatial(self, stereo_release_id: int, spatial_upc: int) -> None: """Create a upc_spatial record linking a stereo product to its spatial counterpart. Args: stereo_release_id (int): stereo release_id spatial_upc (int): spatial upc """ response = self.client.post( "ows-product-digital", path=f"/product/{stereo_release_id}/spatial", json={"upc": spatial_upc}, ) if response.status_code == HTTPStatus.CONFLICT: print( f"release_spatial record already exists for release_id={stereo_release_id}, spatial_upc={spatial_upc}, skipping" ) return response.raise_for_status()