diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4eb8987..31d8238 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.27.0" + ".": "1.28.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index f4a2e85..ccc6aee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 14 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-1391c1e69bcdce517f71265a2f22f4e8d35c3f12a224899e64f85e25897b743a.yml -openapi_spec_hash: f8a2917cc425300d272ae943f88d7bb7 -config_hash: 7f48d078645cb8331328bcd6f6ab3281 +configured_endpoints: 15 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-863ddc13e032497459a639cf02a16349831dda7e39557cbd5ce33da34d086b02.yml +openapi_spec_hash: f972aac9618fe8df340d96344b3d0578 +config_hash: 6f10592c7d0c3bafefc1271472283217 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dcc4a1..5756670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 1.28.0 (2026-01-05) + +Full Changelog: [v1.27.0...v1.28.0](https://github.com/brand-dot-dev/python-sdk/compare/v1.27.0...v1.28.0) + +### Features + +* **api:** api update ([5e513f4](https://github.com/brand-dot-dev/python-sdk/commit/5e513f457d07e9f0560aa8f50542934d7393c929)) +* **api:** api update ([9556441](https://github.com/brand-dot-dev/python-sdk/commit/95564414d4f0ec6095e06df2d5e1e8e2b9d2d889)) +* **api:** manual updates ([62ec1b4](https://github.com/brand-dot-dev/python-sdk/commit/62ec1b480e338243030e770e4a0cae33468575c2)) + ## 1.27.0 (2025-12-22) Full Changelog: [v1.26.0...v1.27.0](https://github.com/brand-dot-dev/python-sdk/compare/v1.26.0...v1.27.0) diff --git a/LICENSE b/LICENSE index d93da50..295331e 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 Brand Dev + Copyright 2026 Brand Dev Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/api.md b/api.md index c258df9..9f48a8b 100644 --- a/api.md +++ b/api.md @@ -5,6 +5,7 @@ Types: ```python from brand.dev.types import ( BrandRetrieveResponse, + BrandAIProductsResponse, BrandAIQueryResponse, BrandFontsResponse, BrandIdentifyFromTransactionResponse, @@ -24,6 +25,7 @@ from brand.dev.types import ( Methods: - client.brand.retrieve(\*\*params) -> BrandRetrieveResponse +- client.brand.ai_products(\*\*params) -> BrandAIProductsResponse - client.brand.ai_query(\*\*params) -> BrandAIQueryResponse - client.brand.fonts(\*\*params) -> BrandFontsResponse - client.brand.identify_from_transaction(\*\*params) -> BrandIdentifyFromTransactionResponse diff --git a/pyproject.toml b/pyproject.toml index 69c176d..98ce3e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "brand.dev" -version = "1.27.0" +version = "1.28.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 89f64e9..f67f9fb 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.27.0" # x-release-please-version +__version__ = "1.28.0" # x-release-please-version diff --git a/src/brand/dev/resources/brand.py b/src/brand/dev/resources/brand.py index a120e2e..fe9cbe7 100644 --- a/src/brand/dev/resources/brand.py +++ b/src/brand/dev/resources/brand.py @@ -14,6 +14,7 @@ brand_retrieve_params, brand_screenshot_params, brand_styleguide_params, + brand_ai_products_params, brand_retrieve_naics_params, brand_retrieve_by_isin_params, brand_retrieve_by_name_params, @@ -40,6 +41,7 @@ from ..types.brand_retrieve_response import BrandRetrieveResponse from ..types.brand_screenshot_response import BrandScreenshotResponse from ..types.brand_styleguide_response import BrandStyleguideResponse +from ..types.brand_ai_products_response import BrandAIProductsResponse from ..types.brand_retrieve_naics_response import BrandRetrieveNaicsResponse from ..types.brand_retrieve_by_isin_response import BrandRetrieveByIsinResponse from ..types.brand_retrieve_by_name_response import BrandRetrieveByNameResponse @@ -187,6 +189,58 @@ def retrieve( cast_to=BrandRetrieveResponse, ) + def ai_products( + self, + *, + domain: str, + max_products: int | Omit = omit, + 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, + ) -> BrandAIProductsResponse: + """Beta feature: Extract product information from a brand's website. + + Brand.dev will + analyze the website and return a list of products with details such as name, + description, image, pricing, features, and more. + + Args: + domain: The domain name to analyze + + max_products: Maximum number of products to extract. + + timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer + than this value, it will be aborted with a 408 status code. 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/products", + body=maybe_transform( + { + "domain": domain, + "max_products": max_products, + "timeout_ms": timeout_ms, + }, + brand_ai_products_params.BrandAIProductsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BrandAIProductsResponse, + ) + def ai_query( self, *, @@ -201,11 +255,11 @@ def ai_query( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BrandAIQueryResponse: - """Beta feature: Use AI to extract specific data points from a brand's website. + """Use AI to extract specific data points from a brand's website. - The - AI will crawl the website and extract the requested information based on the - provided data points. + The AI will crawl + the website and extract the requested information based on the provided data + points. Args: data_to_extract: Array of data points to extract from the website @@ -256,8 +310,8 @@ def fonts( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BrandFontsResponse: """ - Beta feature: Extract font information from a brand's website including font - families, usage statistics, fallbacks, and element/word counts. + Extract font information from a brand's website including font families, usage + statistics, fallbacks, and element/word counts. Args: domain: Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The @@ -1429,12 +1483,12 @@ def screenshot( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BrandScreenshotResponse: - """Beta feature: Capture a screenshot of a website. + """Capture a screenshot of a website. - Supports both viewport - (standard browser view) and full-page screenshots. Can also screenshot specific - page types (login, pricing, etc.) by using heuristics to find the appropriate - URL. Returns a URL to the uploaded screenshot image hosted on our CDN. + Supports both viewport (standard browser + view) and full-page screenshots. Can also screenshot specific page types (login, + pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to + the uploaded screenshot image hosted on our CDN. Args: domain: Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The @@ -1495,9 +1549,8 @@ def styleguide( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BrandStyleguideResponse: """ - Beta feature: Automatically extract comprehensive design system information from - a brand's website including colors, typography, spacing, shadows, and UI - components. + Automatically extract comprehensive design system information from a brand's + website including colors, typography, spacing, shadows, and UI components. Args: domain: Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The @@ -1675,6 +1728,58 @@ async def retrieve( cast_to=BrandRetrieveResponse, ) + async def ai_products( + self, + *, + domain: str, + max_products: int | Omit = omit, + 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, + ) -> BrandAIProductsResponse: + """Beta feature: Extract product information from a brand's website. + + Brand.dev will + analyze the website and return a list of products with details such as name, + description, image, pricing, features, and more. + + Args: + domain: The domain name to analyze + + max_products: Maximum number of products to extract. + + timeout_ms: Optional timeout in milliseconds for the request. If the request takes longer + than this value, it will be aborted with a 408 status code. 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/products", + body=await async_maybe_transform( + { + "domain": domain, + "max_products": max_products, + "timeout_ms": timeout_ms, + }, + brand_ai_products_params.BrandAIProductsParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BrandAIProductsResponse, + ) + async def ai_query( self, *, @@ -1689,11 +1794,11 @@ async def ai_query( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BrandAIQueryResponse: - """Beta feature: Use AI to extract specific data points from a brand's website. + """Use AI to extract specific data points from a brand's website. - The - AI will crawl the website and extract the requested information based on the - provided data points. + The AI will crawl + the website and extract the requested information based on the provided data + points. Args: data_to_extract: Array of data points to extract from the website @@ -1744,8 +1849,8 @@ async def fonts( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BrandFontsResponse: """ - Beta feature: Extract font information from a brand's website including font - families, usage statistics, fallbacks, and element/word counts. + Extract font information from a brand's website including font families, usage + statistics, fallbacks, and element/word counts. Args: domain: Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The @@ -2917,12 +3022,12 @@ async def screenshot( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BrandScreenshotResponse: - """Beta feature: Capture a screenshot of a website. + """Capture a screenshot of a website. - Supports both viewport - (standard browser view) and full-page screenshots. Can also screenshot specific - page types (login, pricing, etc.) by using heuristics to find the appropriate - URL. Returns a URL to the uploaded screenshot image hosted on our CDN. + Supports both viewport (standard browser + view) and full-page screenshots. Can also screenshot specific page types (login, + pricing, etc.) by using heuristics to find the appropriate URL. Returns a URL to + the uploaded screenshot image hosted on our CDN. Args: domain: Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The @@ -2983,9 +3088,8 @@ async def styleguide( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BrandStyleguideResponse: """ - Beta feature: Automatically extract comprehensive design system information from - a brand's website including colors, typography, spacing, shadows, and UI - components. + Automatically extract comprehensive design system information from a brand's + website including colors, typography, spacing, shadows, and UI components. Args: domain: Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The @@ -3035,6 +3139,9 @@ def __init__(self, brand: BrandResource) -> None: self.retrieve = to_raw_response_wrapper( brand.retrieve, ) + self.ai_products = to_raw_response_wrapper( + brand.ai_products, + ) self.ai_query = to_raw_response_wrapper( brand.ai_query, ) @@ -3083,6 +3190,9 @@ def __init__(self, brand: AsyncBrandResource) -> None: self.retrieve = async_to_raw_response_wrapper( brand.retrieve, ) + self.ai_products = async_to_raw_response_wrapper( + brand.ai_products, + ) self.ai_query = async_to_raw_response_wrapper( brand.ai_query, ) @@ -3131,6 +3241,9 @@ def __init__(self, brand: BrandResource) -> None: self.retrieve = to_streamed_response_wrapper( brand.retrieve, ) + self.ai_products = to_streamed_response_wrapper( + brand.ai_products, + ) self.ai_query = to_streamed_response_wrapper( brand.ai_query, ) @@ -3179,6 +3292,9 @@ def __init__(self, brand: AsyncBrandResource) -> None: self.retrieve = async_to_streamed_response_wrapper( brand.retrieve, ) + self.ai_products = async_to_streamed_response_wrapper( + brand.ai_products, + ) self.ai_query = async_to_streamed_response_wrapper( brand.ai_query, ) diff --git a/src/brand/dev/types/__init__.py b/src/brand/dev/types/__init__.py index 7617e44..1f767b1 100644 --- a/src/brand/dev/types/__init__.py +++ b/src/brand/dev/types/__init__.py @@ -12,8 +12,10 @@ 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_screenshot_response import BrandScreenshotResponse as BrandScreenshotResponse from .brand_styleguide_response import BrandStyleguideResponse as BrandStyleguideResponse +from .brand_ai_products_response import BrandAIProductsResponse as BrandAIProductsResponse from .brand_retrieve_naics_params import BrandRetrieveNaicsParams as BrandRetrieveNaicsParams from .brand_retrieve_by_isin_params import BrandRetrieveByIsinParams as BrandRetrieveByIsinParams from .brand_retrieve_by_name_params import BrandRetrieveByNameParams as BrandRetrieveByNameParams diff --git a/src/brand/dev/types/brand_ai_products_params.py b/src/brand/dev/types/brand_ai_products_params.py new file mode 100644 index 0000000..e9ad4ec --- /dev/null +++ b/src/brand/dev/types/brand_ai_products_params.py @@ -0,0 +1,24 @@ +# 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__ = ["BrandAIProductsParams"] + + +class BrandAIProductsParams(TypedDict, total=False): + domain: Required[str] + """The domain name to analyze""" + + max_products: Annotated[int, PropertyInfo(alias="maxProducts")] + """Maximum number of products to extract.""" + + timeout_ms: Annotated[int, PropertyInfo(alias="timeoutMS")] + """Optional timeout in milliseconds for the request. + + If the request takes longer than this value, it will be aborted with a 408 + status code. Maximum allowed value is 300000ms (5 minutes). + """ diff --git a/src/brand/dev/types/brand_ai_products_response.py b/src/brand/dev/types/brand_ai_products_response.py new file mode 100644 index 0000000..1ec6a60 --- /dev/null +++ b/src/brand/dev/types/brand_ai_products_response.py @@ -0,0 +1,51 @@ +# 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__ = ["BrandAIProductsResponse", "Product"] + + +class Product(BaseModel): + 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 BrandAIProductsResponse(BaseModel): + products: Optional[List[Product]] = None + """Array of products extracted from the website""" diff --git a/tests/api_resources/test_brand.py b/tests/api_resources/test_brand.py index a4b713d..06d0515 100644 --- a/tests/api_resources/test_brand.py +++ b/tests/api_resources/test_brand.py @@ -14,6 +14,7 @@ BrandAIQueryResponse, BrandPrefetchResponse, BrandRetrieveResponse, + BrandAIProductsResponse, BrandScreenshotResponse, BrandStyleguideResponse, BrandRetrieveNaicsResponse, @@ -71,6 +72,50 @@ 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_products(self, client: BrandDev) -> None: + brand = client.brand.ai_products( + domain="domain", + ) + assert_matches_type(BrandAIProductsResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_method_ai_products_with_all_params(self, client: BrandDev) -> None: + brand = client.brand.ai_products( + domain="domain", + max_products=1, + timeout_ms=1, + ) + assert_matches_type(BrandAIProductsResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_raw_response_ai_products(self, client: BrandDev) -> None: + response = client.brand.with_raw_response.ai_products( + domain="domain", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + brand = response.parse() + assert_matches_type(BrandAIProductsResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + def test_streaming_response_ai_products(self, client: BrandDev) -> None: + with client.brand.with_streaming_response.ai_products( + domain="domain", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + brand = response.parse() + assert_matches_type(BrandAIProductsResponse, brand, path=["response"]) + + assert cast(Any, response.is_closed) is True + @pytest.mark.skip(reason="Prism tests are disabled") @parametrize def test_method_ai_query(self, client: BrandDev) -> None: @@ -743,6 +788,50 @@ 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_products(self, async_client: AsyncBrandDev) -> None: + brand = await async_client.brand.ai_products( + domain="domain", + ) + assert_matches_type(BrandAIProductsResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_method_ai_products_with_all_params(self, async_client: AsyncBrandDev) -> None: + brand = await async_client.brand.ai_products( + domain="domain", + max_products=1, + timeout_ms=1, + ) + assert_matches_type(BrandAIProductsResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_raw_response_ai_products(self, async_client: AsyncBrandDev) -> None: + response = await async_client.brand.with_raw_response.ai_products( + domain="domain", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + brand = await response.parse() + assert_matches_type(BrandAIProductsResponse, brand, path=["response"]) + + @pytest.mark.skip(reason="Prism tests are disabled") + @parametrize + async def test_streaming_response_ai_products(self, async_client: AsyncBrandDev) -> None: + async with async_client.brand.with_streaming_response.ai_products( + domain="domain", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + brand = await response.parse() + assert_matches_type(BrandAIProductsResponse, 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_query(self, async_client: AsyncBrandDev) -> None: