diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a899ac7..2ce25fe 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.31" + ".": "0.1.0-alpha.32" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index aaa0f9f..9aae198 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 20 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-2cdd67823c6ac9d1ab68032a695c31a098ad285ffb0c073b9dfc00afe5de9b88.yml -openapi_spec_hash: ac8a965beb9b667b6204a5c573507219 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-3614380ba4315687bbaf6561e9872fd72dd876f9230ce690c35d7efc1250e808.yml +openapi_spec_hash: f1aa17e08d0379766a61de68714c7c21 config_hash: 4cd3173ea1cce7183640aae49cfbb374 diff --git a/CHANGELOG.md b/CHANGELOG.md index fa58760..d29d9ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.32 (2026-02-24) + +Full Changelog: [v0.1.0-alpha.31...v0.1.0-alpha.32](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.31...v0.1.0-alpha.32) + +### Features + +* **api:** api update ([c79807b](https://github.com/brand-dot-dev/java-sdk/commit/c79807b3193b735f868d6ca667eb149a054a5ad6)) + ## 0.1.0-alpha.31 (2026-02-23) Full Changelog: [v0.1.0-alpha.30...v0.1.0-alpha.31](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.30...v0.1.0-alpha.31) diff --git a/README.md b/README.md index 4493560..01ce85b 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.branddev.api/brand-dev-java)](https://central.sonatype.com/artifact/com.branddev.api/brand-dev-java/0.1.0-alpha.31) -[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.31/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.31) +[![Maven Central](https://img.shields.io/maven-central/v/com.branddev.api/brand-dev-java)](https://central.sonatype.com/artifact/com.branddev.api/brand-dev-java/0.1.0-alpha.32) +[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.32/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.32) @@ -22,7 +22,7 @@ Use the Brand Dev MCP Server to enable AI assistants to interact with this API, -The REST API documentation can be found on [docs.brand.dev](https://docs.brand.dev/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.31). +The REST API documentation can be found on [docs.brand.dev](https://docs.brand.dev/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.32). @@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.brand.dev](https://docs.brand.d ### Gradle ```kotlin -implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.31") +implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.32") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.31") com.branddev.api brand-dev-java - 0.1.0-alpha.31 + 0.1.0-alpha.32 ``` diff --git a/brand-dev-java-core/src/main/kotlin/com/branddev/api/models/brand/BrandStyleguideParams.kt b/brand-dev-java-core/src/main/kotlin/com/branddev/api/models/brand/BrandStyleguideParams.kt index 4ff729d..ad49edb 100644 --- a/brand-dev-java-core/src/main/kotlin/com/branddev/api/models/brand/BrandStyleguideParams.kt +++ b/brand-dev-java-core/src/main/kotlin/com/branddev/api/models/brand/BrandStyleguideParams.kt @@ -5,7 +5,6 @@ package com.branddev.api.models.brand import com.branddev.api.core.Enum import com.branddev.api.core.JsonField import com.branddev.api.core.Params -import com.branddev.api.core.checkRequired import com.branddev.api.core.http.Headers import com.branddev.api.core.http.QueryParams import com.branddev.api.errors.BrandDevInvalidDataException @@ -16,22 +15,30 @@ import kotlin.jvm.optionals.getOrNull /** * Automatically extract comprehensive design system information from a brand's website including - * colors, typography, spacing, shadows, and UI components. + * colors, typography, spacing, shadows, and UI components. Either 'domain' or 'directUrl' must be + * provided as a query parameter, but not both. */ class BrandStyleguideParams private constructor( - private val domain: String, + private val directUrl: String?, + private val domain: String?, private val prioritize: Prioritize?, private val timeoutMs: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { + /** + * A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., + * 'https://example.com/design-system'). + */ + fun directUrl(): Optional = Optional.ofNullable(directUrl) + /** * Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will * be automatically normalized and validated. */ - fun domain(): String = domain + fun domain(): Optional = Optional.ofNullable(domain) /** * Optional parameter to prioritize screenshot capture for styleguide extraction. If 'speed', @@ -57,20 +64,16 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [BrandStyleguideParams]. - * - * The following fields are required: - * ```java - * .domain() - * ``` - */ + @JvmStatic fun none(): BrandStyleguideParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [BrandStyleguideParams]. */ @JvmStatic fun builder() = Builder() } /** A builder for [BrandStyleguideParams]. */ class Builder internal constructor() { + private var directUrl: String? = null private var domain: String? = null private var prioritize: Prioritize? = null private var timeoutMs: Long? = null @@ -79,6 +82,7 @@ private constructor( @JvmSynthetic internal fun from(brandStyleguideParams: BrandStyleguideParams) = apply { + directUrl = brandStyleguideParams.directUrl domain = brandStyleguideParams.domain prioritize = brandStyleguideParams.prioritize timeoutMs = brandStyleguideParams.timeoutMs @@ -86,11 +90,23 @@ private constructor( additionalQueryParams = brandStyleguideParams.additionalQueryParams.toBuilder() } + /** + * A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., + * 'https://example.com/design-system'). + */ + fun directUrl(directUrl: String?) = apply { this.directUrl = directUrl } + + /** Alias for calling [Builder.directUrl] with `directUrl.orElse(null)`. */ + fun directUrl(directUrl: Optional) = directUrl(directUrl.getOrNull()) + /** * Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain * will be automatically normalized and validated. */ - fun domain(domain: String) = apply { this.domain = domain } + fun domain(domain: String?) = apply { this.domain = domain } + + /** Alias for calling [Builder.domain] with `domain.orElse(null)`. */ + fun domain(domain: Optional) = domain(domain.getOrNull()) /** * Optional parameter to prioritize screenshot capture for styleguide extraction. If @@ -221,17 +237,11 @@ private constructor( * Returns an immutable instance of [BrandStyleguideParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .domain() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): BrandStyleguideParams = BrandStyleguideParams( - checkRequired("domain", domain), + directUrl, + domain, prioritize, timeoutMs, additionalHeaders.build(), @@ -244,7 +254,8 @@ private constructor( override fun _queryParams(): QueryParams = QueryParams.builder() .apply { - put("domain", domain) + directUrl?.let { put("directUrl", it) } + domain?.let { put("domain", it) } prioritize?.let { put("prioritize", it.toString()) } timeoutMs?.let { put("timeoutMS", it.toString()) } putAll(additionalQueryParams) @@ -391,6 +402,7 @@ private constructor( } return other is BrandStyleguideParams && + directUrl == other.directUrl && domain == other.domain && prioritize == other.prioritize && timeoutMs == other.timeoutMs && @@ -399,8 +411,15 @@ private constructor( } override fun hashCode(): Int = - Objects.hash(domain, prioritize, timeoutMs, additionalHeaders, additionalQueryParams) + Objects.hash( + directUrl, + domain, + prioritize, + timeoutMs, + additionalHeaders, + additionalQueryParams, + ) override fun toString() = - "BrandStyleguideParams{domain=$domain, prioritize=$prioritize, timeoutMs=$timeoutMs, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "BrandStyleguideParams{directUrl=$directUrl, domain=$domain, prioritize=$prioritize, timeoutMs=$timeoutMs, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/brand-dev-java-core/src/main/kotlin/com/branddev/api/services/async/BrandServiceAsync.kt b/brand-dev-java-core/src/main/kotlin/com/branddev/api/services/async/BrandServiceAsync.kt index 70b9804..139844b 100644 --- a/brand-dev-java-core/src/main/kotlin/com/branddev/api/services/async/BrandServiceAsync.kt +++ b/brand-dev-java-core/src/main/kotlin/com/branddev/api/services/async/BrandServiceAsync.kt @@ -314,17 +314,27 @@ interface BrandServiceAsync { /** * Automatically extract comprehensive design system information from a brand's website - * including colors, typography, spacing, shadows, and UI components. + * including colors, typography, spacing, shadows, and UI components. Either 'domain' or + * 'directUrl' must be provided as a query parameter, but not both. */ - fun styleguide(params: BrandStyleguideParams): CompletableFuture = - styleguide(params, RequestOptions.none()) + fun styleguide(): CompletableFuture = + styleguide(BrandStyleguideParams.none()) /** @see styleguide */ fun styleguide( - params: BrandStyleguideParams, + params: BrandStyleguideParams = BrandStyleguideParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see styleguide */ + fun styleguide( + params: BrandStyleguideParams = BrandStyleguideParams.none() + ): CompletableFuture = styleguide(params, RequestOptions.none()) + + /** @see styleguide */ + fun styleguide(requestOptions: RequestOptions): CompletableFuture = + styleguide(BrandStyleguideParams.none(), requestOptions) + /** * Scrapes the given URL and returns the raw HTML content of the page. Uses automatic proxy * escalation to handle blocked sites. @@ -663,16 +673,26 @@ interface BrandServiceAsync { * Returns a raw HTTP response for `get /brand/styleguide`, but is otherwise the same as * [BrandServiceAsync.styleguide]. */ + fun styleguide(): CompletableFuture> = + styleguide(BrandStyleguideParams.none()) + + /** @see styleguide */ fun styleguide( - params: BrandStyleguideParams + params: BrandStyleguideParams = BrandStyleguideParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see styleguide */ + fun styleguide( + params: BrandStyleguideParams = BrandStyleguideParams.none() ): CompletableFuture> = styleguide(params, RequestOptions.none()) /** @see styleguide */ fun styleguide( - params: BrandStyleguideParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + requestOptions: RequestOptions + ): CompletableFuture> = + styleguide(BrandStyleguideParams.none(), requestOptions) /** * Returns a raw HTTP response for `get /web/scrape/html`, but is otherwise the same as diff --git a/brand-dev-java-core/src/main/kotlin/com/branddev/api/services/blocking/BrandService.kt b/brand-dev-java-core/src/main/kotlin/com/branddev/api/services/blocking/BrandService.kt index e7ea6df..f26dc6d 100644 --- a/brand-dev-java-core/src/main/kotlin/com/branddev/api/services/blocking/BrandService.kt +++ b/brand-dev-java-core/src/main/kotlin/com/branddev/api/services/blocking/BrandService.kt @@ -297,17 +297,26 @@ interface BrandService { /** * Automatically extract comprehensive design system information from a brand's website - * including colors, typography, spacing, shadows, and UI components. + * including colors, typography, spacing, shadows, and UI components. Either 'domain' or + * 'directUrl' must be provided as a query parameter, but not both. */ - fun styleguide(params: BrandStyleguideParams): BrandStyleguideResponse = - styleguide(params, RequestOptions.none()) + fun styleguide(): BrandStyleguideResponse = styleguide(BrandStyleguideParams.none()) /** @see styleguide */ fun styleguide( - params: BrandStyleguideParams, + params: BrandStyleguideParams = BrandStyleguideParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): BrandStyleguideResponse + /** @see styleguide */ + fun styleguide( + params: BrandStyleguideParams = BrandStyleguideParams.none() + ): BrandStyleguideResponse = styleguide(params, RequestOptions.none()) + + /** @see styleguide */ + fun styleguide(requestOptions: RequestOptions): BrandStyleguideResponse = + styleguide(BrandStyleguideParams.none(), requestOptions) + /** * Scrapes the given URL and returns the raw HTML content of the page. Uses automatic proxy * escalation to handle blocked sites. @@ -658,16 +667,27 @@ interface BrandService { * [BrandService.styleguide]. */ @MustBeClosed - fun styleguide(params: BrandStyleguideParams): HttpResponseFor = - styleguide(params, RequestOptions.none()) + fun styleguide(): HttpResponseFor = + styleguide(BrandStyleguideParams.none()) /** @see styleguide */ @MustBeClosed fun styleguide( - params: BrandStyleguideParams, + params: BrandStyleguideParams = BrandStyleguideParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + /** @see styleguide */ + @MustBeClosed + fun styleguide( + params: BrandStyleguideParams = BrandStyleguideParams.none() + ): HttpResponseFor = styleguide(params, RequestOptions.none()) + + /** @see styleguide */ + @MustBeClosed + fun styleguide(requestOptions: RequestOptions): HttpResponseFor = + styleguide(BrandStyleguideParams.none(), requestOptions) + /** * Returns a raw HTTP response for `get /web/scrape/html`, but is otherwise the same as * [BrandService.webScrapeHtml]. diff --git a/brand-dev-java-core/src/test/kotlin/com/branddev/api/models/brand/BrandStyleguideParamsTest.kt b/brand-dev-java-core/src/test/kotlin/com/branddev/api/models/brand/BrandStyleguideParamsTest.kt index 55ded8f..5d00553 100644 --- a/brand-dev-java-core/src/test/kotlin/com/branddev/api/models/brand/BrandStyleguideParamsTest.kt +++ b/brand-dev-java-core/src/test/kotlin/com/branddev/api/models/brand/BrandStyleguideParamsTest.kt @@ -11,6 +11,7 @@ internal class BrandStyleguideParamsTest { @Test fun create() { BrandStyleguideParams.builder() + .directUrl("https://example.com") .domain("domain") .prioritize(BrandStyleguideParams.Prioritize.SPEED) .timeoutMs(1000L) @@ -21,6 +22,7 @@ internal class BrandStyleguideParamsTest { fun queryParams() { val params = BrandStyleguideParams.builder() + .directUrl("https://example.com") .domain("domain") .prioritize(BrandStyleguideParams.Prioritize.SPEED) .timeoutMs(1000L) @@ -31,6 +33,7 @@ internal class BrandStyleguideParamsTest { assertThat(queryParams) .isEqualTo( QueryParams.builder() + .put("directUrl", "https://example.com") .put("domain", "domain") .put("prioritize", "speed") .put("timeoutMS", "1000") @@ -40,10 +43,10 @@ internal class BrandStyleguideParamsTest { @Test fun queryParamsWithoutOptionalFields() { - val params = BrandStyleguideParams.builder().domain("domain").build() + val params = BrandStyleguideParams.builder().build() val queryParams = params._queryParams() - assertThat(queryParams).isEqualTo(QueryParams.builder().put("domain", "domain").build()) + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) } } diff --git a/brand-dev-java-core/src/test/kotlin/com/branddev/api/services/async/BrandServiceAsyncTest.kt b/brand-dev-java-core/src/test/kotlin/com/branddev/api/services/async/BrandServiceAsyncTest.kt index e80725e..4464ebb 100644 --- a/brand-dev-java-core/src/test/kotlin/com/branddev/api/services/async/BrandServiceAsyncTest.kt +++ b/brand-dev-java-core/src/test/kotlin/com/branddev/api/services/async/BrandServiceAsyncTest.kt @@ -354,6 +354,7 @@ internal class BrandServiceAsyncTest { val responseFuture = brandServiceAsync.styleguide( BrandStyleguideParams.builder() + .directUrl("https://example.com") .domain("domain") .prioritize(BrandStyleguideParams.Prioritize.SPEED) .timeoutMs(1000L) diff --git a/brand-dev-java-core/src/test/kotlin/com/branddev/api/services/blocking/BrandServiceTest.kt b/brand-dev-java-core/src/test/kotlin/com/branddev/api/services/blocking/BrandServiceTest.kt index 396e12b..839c50b 100644 --- a/brand-dev-java-core/src/test/kotlin/com/branddev/api/services/blocking/BrandServiceTest.kt +++ b/brand-dev-java-core/src/test/kotlin/com/branddev/api/services/blocking/BrandServiceTest.kt @@ -337,6 +337,7 @@ internal class BrandServiceTest { val response = brandService.styleguide( BrandStyleguideParams.builder() + .directUrl("https://example.com") .domain("domain") .prioritize(BrandStyleguideParams.Prioritize.SPEED) .timeoutMs(1000L) diff --git a/build.gradle.kts b/build.gradle.kts index 8c840a6..ea86009 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ repositories { allprojects { group = "com.branddev.api" - version = "0.1.0-alpha.31" // x-release-please-version + version = "0.1.0-alpha.32" // x-release-please-version } subprojects {