diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 81d2de2..592b0e1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.31.0" + ".": "1.32.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 3c2db8b..a831e36 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 15 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-10f7ae53f4fe4f2394c22788b648d9db742a178ed41a87beb39de741660e646b.yml -openapi_spec_hash: 9885c47a02677471a38f16dddbad1823 -config_hash: 6f10592c7d0c3bafefc1271472283217 +configured_endpoints: 16 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-f6fec0ae4fa4572aefa111e660f98f6acfb6149c22cbd413bd3defad6c100478.yml +openapi_spec_hash: a82bf07982eae3814e8a60eb368e0ce5 +config_hash: c3aaaa9794dba44d524c06591ab17894 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd5141..ade957c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.32.0 (2026-02-09) + +Full Changelog: [v1.31.0...v1.32.0](https://github.com/brand-dot-dev/python-sdk/compare/v1.31.0...v1.32.0) + +### Features + +* **api:** manual updates ([4dc72c5](https://github.com/brand-dot-dev/python-sdk/commit/4dc72c5ee1563a72f7d0cfbc3196fc94694acf95)) + ## 1.31.0 (2026-02-07) Full Changelog: [v1.30.0...v1.31.0](https://github.com/brand-dot-dev/python-sdk/compare/v1.30.0...v1.31.0) diff --git a/api.md b/api.md index 9f48a8b..a5e159f 100644 --- a/api.md +++ b/api.md @@ -5,6 +5,7 @@ Types: ```python from brand.dev.types import ( BrandRetrieveResponse, + BrandAIProductResponse, BrandAIProductsResponse, BrandAIQueryResponse, BrandFontsResponse, @@ -25,6 +26,7 @@ from brand.dev.types import ( Methods: - client.brand.retrieve(\*\*params) -> BrandRetrieveResponse +- client.brand.ai_product(\*\*params) -> BrandAIProductResponse - client.brand.ai_products(\*\*params) -> BrandAIProductsResponse - client.brand.ai_query(\*\*params) -> BrandAIQueryResponse - client.brand.fonts(\*\*params) -> BrandFontsResponse diff --git a/pyproject.toml b/pyproject.toml index 5c7bf0c..bfddd27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "brand.dev" -version = "1.31.0" +version = "1.32.0" description = "The official Python library for the brand.dev API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/brand/dev/_version.py b/src/brand/dev/_version.py index a46a396..72688e4 100644 --- a/src/brand/dev/_version.py +++ b/src/brand/dev/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "brand.dev" -__version__ = "1.31.0" # x-release-please-version +__version__ = "1.32.0" # x-release-please-version diff --git a/src/brand/dev/resources/brand.py b/src/brand/dev/resources/brand.py index 053ae2a..0e290f7 100644 --- a/src/brand/dev/resources/brand.py +++ b/src/brand/dev/resources/brand.py @@ -12,6 +12,7 @@ brand_ai_query_params, brand_prefetch_params, brand_retrieve_params, + brand_ai_product_params, brand_screenshot_params, brand_styleguide_params, brand_ai_products_params, @@ -39,6 +40,7 @@ from ..types.brand_ai_query_response import BrandAIQueryResponse from ..types.brand_prefetch_response import BrandPrefetchResponse from ..types.brand_retrieve_response import BrandRetrieveResponse +from ..types.brand_ai_product_response import BrandAIProductResponse from ..types.brand_screenshot_response import BrandScreenshotResponse from ..types.brand_styleguide_response import BrandStyleguideResponse from ..types.brand_ai_products_response import BrandAIProductsResponse @@ -189,6 +191,52 @@ def retrieve( cast_to=BrandRetrieveResponse, ) + def ai_product( + self, + *, + url: str, + timeout_ms: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BrandAIProductResponse: + """ + Beta feature: Given a single URL, determines if it is a product detail page, + classifies the platform/product type, and extracts the product information. + Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites. + + Args: + url: The product page URL to extract product data from. + + timeout_ms: Optional timeout in milliseconds for the request. Maximum allowed value is + 300000ms (5 minutes). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._post( + "/brand/ai/product", + body=maybe_transform( + { + "url": url, + "timeout_ms": timeout_ms, + }, + brand_ai_product_params.BrandAIProductParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BrandAIProductResponse, + ) + @overload def ai_products( self, @@ -1785,6 +1833,52 @@ async def retrieve( cast_to=BrandRetrieveResponse, ) + async def ai_product( + self, + *, + url: str, + timeout_ms: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> BrandAIProductResponse: + """ + Beta feature: Given a single URL, determines if it is a product detail page, + classifies the platform/product type, and extracts the product information. + Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites. + + Args: + url: The product page URL to extract product data from. + + timeout_ms: Optional timeout in milliseconds for the request. Maximum allowed value is + 300000ms (5 minutes). + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return await self._post( + "/brand/ai/product", + body=await async_maybe_transform( + { + "url": url, + "timeout_ms": timeout_ms, + }, + brand_ai_product_params.BrandAIProductParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BrandAIProductResponse, + ) + @overload async def ai_products( self, @@ -3253,6 +3347,9 @@ def __init__(self, brand: BrandResource) -> None: self.retrieve = to_raw_response_wrapper( brand.retrieve, ) + self.ai_product = to_raw_response_wrapper( + brand.ai_product, + ) self.ai_products = to_raw_response_wrapper( brand.ai_products, ) @@ -3304,6 +3401,9 @@ def __init__(self, brand: AsyncBrandResource) -> None: self.retrieve = async_to_raw_response_wrapper( brand.retrieve, ) + self.ai_product = async_to_raw_response_wrapper( + brand.ai_product, + ) self.ai_products = async_to_raw_response_wrapper( brand.ai_products, ) @@ -3355,6 +3455,9 @@ def __init__(self, brand: BrandResource) -> None: self.retrieve = to_streamed_response_wrapper( brand.retrieve, ) + self.ai_product = to_streamed_response_wrapper( + brand.ai_product, + ) self.ai_products = to_streamed_response_wrapper( brand.ai_products, ) @@ -3406,6 +3509,9 @@ def __init__(self, brand: AsyncBrandResource) -> None: self.retrieve = async_to_streamed_response_wrapper( brand.retrieve, ) + self.ai_product = async_to_streamed_response_wrapper( + brand.ai_product, + ) self.ai_products = async_to_streamed_response_wrapper( brand.ai_products, ) diff --git a/src/brand/dev/types/__init__.py b/src/brand/dev/types/__init__.py index 1f767b1..88b9a02 100644 --- a/src/brand/dev/types/__init__.py +++ b/src/brand/dev/types/__init__.py @@ -7,12 +7,14 @@ from .brand_ai_query_params import BrandAIQueryParams as BrandAIQueryParams from .brand_prefetch_params import BrandPrefetchParams as BrandPrefetchParams from .brand_retrieve_params import BrandRetrieveParams as BrandRetrieveParams +from .brand_ai_product_params import BrandAIProductParams as BrandAIProductParams from .brand_ai_query_response import BrandAIQueryResponse as BrandAIQueryResponse from .brand_prefetch_response import BrandPrefetchResponse as BrandPrefetchResponse from .brand_retrieve_response import BrandRetrieveResponse as BrandRetrieveResponse from .brand_screenshot_params import BrandScreenshotParams as BrandScreenshotParams from .brand_styleguide_params import BrandStyleguideParams as BrandStyleguideParams from .brand_ai_products_params import BrandAIProductsParams as BrandAIProductsParams +from .brand_ai_product_response import BrandAIProductResponse as BrandAIProductResponse from .brand_screenshot_response import BrandScreenshotResponse as BrandScreenshotResponse from .brand_styleguide_response import BrandStyleguideResponse as BrandStyleguideResponse from .brand_ai_products_response import BrandAIProductsResponse as BrandAIProductsResponse diff --git a/src/brand/dev/types/brand_ai_product_params.py b/src/brand/dev/types/brand_ai_product_params.py new file mode 100644 index 0000000..17e62c9 --- /dev/null +++ b/src/brand/dev/types/brand_ai_product_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["BrandAIProductParams"] + + +class BrandAIProductParams(TypedDict, total=False): + url: Required[str] + """The product page URL to extract product data from.""" + + timeout_ms: Annotated[int, PropertyInfo(alias="timeoutMS")] + """Optional timeout in milliseconds for the request. + + Maximum allowed value is 300000ms (5 minutes). + """ diff --git a/src/brand/dev/types/brand_ai_product_response.py b/src/brand/dev/types/brand_ai_product_response.py new file mode 100644 index 0000000..788dce9 --- /dev/null +++ b/src/brand/dev/types/brand_ai_product_response.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["BrandAIProductResponse", "Product"] + + +class Product(BaseModel): + """The extracted product data, or null if not a product page""" + + description: str + """Description of the product""" + + features: List[str] + """List of product features""" + + name: str + """Name of the product""" + + tags: List[str] + """Tags associated with the product""" + + target_audience: List[str] + """Target audience for the product (array of strings)""" + + billing_frequency: Optional[Literal["monthly", "yearly", "one_time", "usage_based"]] = None + """Billing frequency for the product""" + + category: Optional[str] = None + """Category of the product""" + + currency: Optional[str] = None + """Currency code for the price (e.g., USD, EUR)""" + + image_url: Optional[str] = None + """URL to the product image""" + + price: Optional[float] = None + """Price of the product""" + + pricing_model: Optional[Literal["per_seat", "flat", "tiered", "freemium", "custom"]] = None + """Pricing model for the product""" + + url: Optional[str] = None + """URL to the product page""" + + +class BrandAIProductResponse(BaseModel): + is_product_page: Optional[bool] = None + """Whether the given URL is a product detail page""" + + platform: Optional[Literal["amazon", "tiktok_shop", "etsy", "generic"]] = None + """The detected ecommerce platform, or null if not a product page""" + + product: Optional[Product] = None + """The extracted product data, or null if not a product page""" diff --git a/tests/api_resources/test_brand.py b/tests/api_resources/test_brand.py index 478c685..020efd4 100644 --- a/tests/api_resources/test_brand.py +++ b/tests/api_resources/test_brand.py @@ -14,6 +14,7 @@ BrandAIQueryResponse, BrandPrefetchResponse, BrandRetrieveResponse, + BrandAIProductResponse, BrandAIProductsResponse, BrandScreenshotResponse, BrandStyleguideResponse, @@ -78,6 +79,49 @@ def test_streaming_response_retrieve(self, client: BrandDev) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_ai_product(self, client: BrandDev) -> None: + brand = client.brand.ai_product( + url="https://example.com", + ) + assert_matches_type(BrandAIProductResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_ai_product_with_all_params(self, client: BrandDev) -> None: + brand = client.brand.ai_product( + url="https://example.com", + timeout_ms=1, + ) + assert_matches_type(BrandAIProductResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_ai_product(self, client: BrandDev) -> None: + response = client.brand.with_raw_response.ai_product( + url="https://example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + brand = response.parse() + assert_matches_type(BrandAIProductResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_ai_product(self, client: BrandDev) -> None: + with client.brand.with_streaming_response.ai_product( + url="https://example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + brand = response.parse() + assert_matches_type(BrandAIProductResponse, brand, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_ai_products_overload_1(self, client: BrandDev) -> None: @@ -844,6 +888,49 @@ async def test_streaming_response_retrieve(self, async_client: AsyncBrandDev) -> assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_ai_product(self, async_client: AsyncBrandDev) -> None: + brand = await async_client.brand.ai_product( + url="https://example.com", + ) + assert_matches_type(BrandAIProductResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_ai_product_with_all_params(self, async_client: AsyncBrandDev) -> None: + brand = await async_client.brand.ai_product( + url="https://example.com", + timeout_ms=1, + ) + assert_matches_type(BrandAIProductResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_ai_product(self, async_client: AsyncBrandDev) -> None: + response = await async_client.brand.with_raw_response.ai_product( + url="https://example.com", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + brand = await response.parse() + assert_matches_type(BrandAIProductResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_ai_product(self, async_client: AsyncBrandDev) -> None: + async with async_client.brand.with_streaming_response.ai_product( + url="https://example.com", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + brand = await response.parse() + assert_matches_type(BrandAIProductResponse, brand, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize async def test_method_ai_products_overload_1(self, async_client: AsyncBrandDev) -> None: