diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f471069..c412e97 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.28" + ".": "0.1.0-alpha.29" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ef7f019..3c2db8b 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-73562e26b663cf10185b9e98966accf5f151c6d3cf99b5e060ce5a847045e383.yml -openapi_spec_hash: bf5994966b84f9dda998ad5059ff8318 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-10f7ae53f4fe4f2394c22788b648d9db742a178ed41a87beb39de741660e646b.yml +openapi_spec_hash: 9885c47a02677471a38f16dddbad1823 config_hash: 6f10592c7d0c3bafefc1271472283217 diff --git a/CHANGELOG.md b/CHANGELOG.md index 929b089..6b35897 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.1.0-alpha.29 (2026-02-07) + +Full Changelog: [v0.1.0-alpha.28...v0.1.0-alpha.29](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.28...v0.1.0-alpha.29) + +### Features + +* **api:** api update ([dd15661](https://github.com/brand-dot-dev/java-sdk/commit/dd15661ea9caa7439136a3ad116a48cd16865531)) + ## 0.1.0-alpha.28 (2026-02-07) Full Changelog: [v0.1.0-alpha.27...v0.1.0-alpha.28](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.27...v0.1.0-alpha.28) diff --git a/README.md b/README.md index 8435cb6..a597701 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.28) -[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.28/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.28) +[![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.29) +[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.29/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.29) @@ -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.28). +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.29). @@ -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.28") +implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.29") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.28") com.branddev.api brand-dev-java - 0.1.0-alpha.28 + 0.1.0-alpha.29 ``` diff --git a/brand-dev-java-core/src/main/kotlin/com/branddev/api/models/brand/BrandAiProductsParams.kt b/brand-dev-java-core/src/main/kotlin/com/branddev/api/models/brand/BrandAiProductsParams.kt index 15e5122..9e68d15 100644 --- a/brand-dev-java-core/src/main/kotlin/com/branddev/api/models/brand/BrandAiProductsParams.kt +++ b/brand-dev-java-core/src/main/kotlin/com/branddev/api/models/brand/BrandAiProductsParams.kt @@ -2,11 +2,16 @@ package com.branddev.api.models.brand +import com.branddev.api.core.BaseDeserializer +import com.branddev.api.core.BaseSerializer import com.branddev.api.core.ExcludeMissing import com.branddev.api.core.JsonField import com.branddev.api.core.JsonMissing import com.branddev.api.core.JsonValue import com.branddev.api.core.Params +import com.branddev.api.core.allMaxBy +import com.branddev.api.core.checkRequired +import com.branddev.api.core.getOrThrow import com.branddev.api.core.http.Headers import com.branddev.api.core.http.QueryParams import com.branddev.api.errors.BrandDevInvalidDataException @@ -14,6 +19,13 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import java.util.Collections import java.util.Objects import java.util.Optional @@ -30,72 +42,7 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { - /** - * A specific URL to use directly as the starting point for extraction without domain - * resolution. Useful when you want to extract products from a specific page rather than - * discovering the site's product pages automatically. Either 'domain' or 'directUrl' must be - * provided, but not both. - * - * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun directUrl(): Optional = body.directUrl() - - /** - * The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but not both. - * - * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun domain(): Optional = body.domain() - - /** - * Maximum number of products to extract. - * - * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun maxProducts(): Optional = body.maxProducts() - - /** - * 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). - * - * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun timeoutMs(): Optional = body.timeoutMs() - - /** - * Returns the raw JSON value of [directUrl]. - * - * Unlike [directUrl], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _directUrl(): JsonField = body._directUrl() - - /** - * Returns the raw JSON value of [domain]. - * - * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _domain(): JsonField = body._domain() - - /** - * Returns the raw JSON value of [maxProducts]. - * - * Unlike [maxProducts], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _maxProducts(): JsonField = body._maxProducts() - - /** - * Returns the raw JSON value of [timeoutMs]. - * - * Unlike [timeoutMs], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _timeoutMs(): JsonField = body._timeoutMs() - - fun _additionalBodyProperties(): Map = body._additionalProperties() + fun body(): Body = body /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -107,114 +54,38 @@ private constructor( companion object { - @JvmStatic fun none(): BrandAiProductsParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [BrandAiProductsParams]. */ + /** + * Returns a mutable builder for constructing an instance of [BrandAiProductsParams]. + * + * The following fields are required: + * ```java + * .body() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [BrandAiProductsParams]. */ class Builder internal constructor() { - private var body: Body.Builder = Body.builder() + private var body: Body? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @JvmSynthetic internal fun from(brandAiProductsParams: BrandAiProductsParams) = apply { - body = brandAiProductsParams.body.toBuilder() + body = brandAiProductsParams.body additionalHeaders = brandAiProductsParams.additionalHeaders.toBuilder() additionalQueryParams = brandAiProductsParams.additionalQueryParams.toBuilder() } - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [directUrl] - * - [domain] - * - [maxProducts] - * - [timeoutMs] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** - * A specific URL to use directly as the starting point for extraction without domain - * resolution. Useful when you want to extract products from a specific page rather than - * discovering the site's product pages automatically. Either 'domain' or 'directUrl' must - * be provided, but not both. - */ - fun directUrl(directUrl: String) = apply { body.directUrl(directUrl) } - - /** - * Sets [Builder.directUrl] to an arbitrary JSON value. - * - * You should usually call [Builder.directUrl] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun directUrl(directUrl: JsonField) = apply { body.directUrl(directUrl) } - - /** - * The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but not - * both. - */ - fun domain(domain: String) = apply { body.domain(domain) } - - /** - * Sets [Builder.domain] to an arbitrary JSON value. - * - * You should usually call [Builder.domain] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun domain(domain: JsonField) = apply { body.domain(domain) } - - /** Maximum number of products to extract. */ - fun maxProducts(maxProducts: Long) = apply { body.maxProducts(maxProducts) } - - /** - * Sets [Builder.maxProducts] to an arbitrary JSON value. - * - * You should usually call [Builder.maxProducts] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun maxProducts(maxProducts: JsonField) = apply { body.maxProducts(maxProducts) } - - /** - * 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). - */ - fun timeoutMs(timeoutMs: Long) = apply { body.timeoutMs(timeoutMs) } - - /** - * Sets [Builder.timeoutMs] to an arbitrary JSON value. - * - * You should usually call [Builder.timeoutMs] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun timeoutMs(timeoutMs: JsonField) = apply { body.timeoutMs(timeoutMs) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } + fun body(body: Body) = apply { this.body = body } - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + /** Alias for calling [body] with `Body.ofByDomain(byDomain)`. */ + fun body(byDomain: Body.ByDomain) = body(Body.ofByDomain(byDomain)) - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } + /** Alias for calling [body] with `Body.ofByDirectUrl(byDirectUrl)`. */ + fun body(byDirectUrl: Body.ByDirectUrl) = body(Body.ofByDirectUrl(byDirectUrl)) fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() @@ -318,10 +189,17 @@ private constructor( * Returns an immutable instance of [BrandAiProductsParams]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .body() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ fun build(): BrandAiProductsParams = BrandAiProductsParams( - body.build(), + checkRequired("body", body), additionalHeaders.build(), additionalQueryParams.build(), ) @@ -333,276 +211,687 @@ private constructor( override fun _queryParams(): QueryParams = additionalQueryParams + @JsonDeserialize(using = Body.Deserializer::class) + @JsonSerialize(using = Body.Serializer::class) class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val directUrl: JsonField, - private val domain: JsonField, - private val maxProducts: JsonField, - private val timeoutMs: JsonField, - private val additionalProperties: MutableMap, + private val byDomain: ByDomain? = null, + private val byDirectUrl: ByDirectUrl? = null, + private val _json: JsonValue? = null, ) { - @JsonCreator - private constructor( - @JsonProperty("directUrl") - @ExcludeMissing - directUrl: JsonField = JsonMissing.of(), - @JsonProperty("domain") @ExcludeMissing domain: JsonField = JsonMissing.of(), - @JsonProperty("maxProducts") - @ExcludeMissing - maxProducts: JsonField = JsonMissing.of(), - @JsonProperty("timeoutMS") @ExcludeMissing timeoutMs: JsonField = JsonMissing.of(), - ) : this(directUrl, domain, maxProducts, timeoutMs, mutableMapOf()) + fun byDomain(): Optional = Optional.ofNullable(byDomain) - /** - * A specific URL to use directly as the starting point for extraction without domain - * resolution. Useful when you want to extract products from a specific page rather than - * discovering the site's product pages automatically. Either 'domain' or 'directUrl' must - * be provided, but not both. - * - * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun directUrl(): Optional = directUrl.getOptional("directUrl") + fun byDirectUrl(): Optional = Optional.ofNullable(byDirectUrl) - /** - * The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but not - * both. - * - * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun domain(): Optional = domain.getOptional("domain") + fun isByDomain(): Boolean = byDomain != null - /** - * Maximum number of products to extract. - * - * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun maxProducts(): Optional = maxProducts.getOptional("maxProducts") + fun isByDirectUrl(): Boolean = byDirectUrl != null - /** - * 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). - * - * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun timeoutMs(): Optional = timeoutMs.getOptional("timeoutMS") + fun asByDomain(): ByDomain = byDomain.getOrThrow("byDomain") - /** - * Returns the raw JSON value of [directUrl]. - * - * Unlike [directUrl], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("directUrl") @ExcludeMissing fun _directUrl(): JsonField = directUrl + fun asByDirectUrl(): ByDirectUrl = byDirectUrl.getOrThrow("byDirectUrl") - /** - * Returns the raw JSON value of [domain]. - * - * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("domain") @ExcludeMissing fun _domain(): JsonField = domain + fun _json(): Optional = Optional.ofNullable(_json) - /** - * Returns the raw JSON value of [maxProducts]. - * - * Unlike [maxProducts], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("maxProducts") - @ExcludeMissing - fun _maxProducts(): JsonField = maxProducts + fun accept(visitor: Visitor): T = + when { + byDomain != null -> visitor.visitByDomain(byDomain) + byDirectUrl != null -> visitor.visitByDirectUrl(byDirectUrl) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitByDomain(byDomain: ByDomain) { + byDomain.validate() + } + + override fun visitByDirectUrl(byDirectUrl: ByDirectUrl) { + byDirectUrl.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: BrandDevInvalidDataException) { + false + } /** - * Returns the raw JSON value of [timeoutMs]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * Unlike [timeoutMs], this method doesn't throw if the JSON field has an unexpected type. + * Used for best match union deserialization. */ - @JsonProperty("timeoutMS") @ExcludeMissing fun _timeoutMs(): JsonField = timeoutMs + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitByDomain(byDomain: ByDomain) = byDomain.validity() + + override fun visitByDirectUrl(byDirectUrl: ByDirectUrl) = byDirectUrl.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + return other is Body && byDomain == other.byDomain && byDirectUrl == other.byDirectUrl } - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + override fun hashCode(): Int = Objects.hash(byDomain, byDirectUrl) - fun toBuilder() = Builder().from(this) + override fun toString(): String = + when { + byDomain != null -> "Body{byDomain=$byDomain}" + byDirectUrl != null -> "Body{byDirectUrl=$byDirectUrl}" + _json != null -> "Body{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Body") + } companion object { - /** Returns a mutable builder for constructing an instance of [Body]. */ - @JvmStatic fun builder() = Builder() + @JvmStatic fun ofByDomain(byDomain: ByDomain) = Body(byDomain = byDomain) + + @JvmStatic fun ofByDirectUrl(byDirectUrl: ByDirectUrl) = Body(byDirectUrl = byDirectUrl) } - /** A builder for [Body]. */ - class Builder internal constructor() { + /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ + interface Visitor { - private var directUrl: JsonField = JsonMissing.of() - private var domain: JsonField = JsonMissing.of() - private var maxProducts: JsonField = JsonMissing.of() - private var timeoutMs: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + fun visitByDomain(byDomain: ByDomain): T - @JvmSynthetic - internal fun from(body: Body) = apply { - directUrl = body.directUrl - domain = body.domain - maxProducts = body.maxProducts - timeoutMs = body.timeoutMs - additionalProperties = body.additionalProperties.toMutableMap() - } + fun visitByDirectUrl(byDirectUrl: ByDirectUrl): T /** - * A specific URL to use directly as the starting point for extraction without domain - * resolution. Useful when you want to extract products from a specific page rather than - * discovering the site's product pages automatically. Either 'domain' or 'directUrl' - * must be provided, but not both. + * Maps an unknown variant of [Body] to a value of type [T]. + * + * An instance of [Body] can contain an unknown variant if it was deserialized from data + * that doesn't match any known variant. For example, if the SDK is on an older version + * than the API, then the API may respond with new variants that the SDK is unaware of. + * + * @throws BrandDevInvalidDataException in the default implementation. */ - fun directUrl(directUrl: String) = directUrl(JsonField.of(directUrl)) + fun unknown(json: JsonValue?): T { + throw BrandDevInvalidDataException("Unknown Body: $json") + } + } + + internal class Deserializer : BaseDeserializer(Body::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Body { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Body(byDomain = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Body(byDirectUrl = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with + // all the possible variants (e.g. deserializing from boolean). + 0 -> Body(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely + // valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Body::class) { + + override fun serialize( + value: Body, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.byDomain != null -> generator.writeObject(value.byDomain) + value.byDirectUrl != null -> generator.writeObject(value.byDirectUrl) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Body") + } + } + } + + class ByDomain + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val domain: JsonField, + private val maxProducts: JsonField, + private val timeoutMs: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("domain") + @ExcludeMissing + domain: JsonField = JsonMissing.of(), + @JsonProperty("maxProducts") + @ExcludeMissing + maxProducts: JsonField = JsonMissing.of(), + @JsonProperty("timeoutMS") + @ExcludeMissing + timeoutMs: JsonField = JsonMissing.of(), + ) : this(domain, maxProducts, timeoutMs, mutableMapOf()) /** - * Sets [Builder.directUrl] to an arbitrary JSON value. + * The domain name to analyze. * - * You should usually call [Builder.directUrl] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws BrandDevInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). */ - fun directUrl(directUrl: JsonField) = apply { this.directUrl = directUrl } + fun domain(): String = domain.getRequired("domain") /** - * The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but not - * both. + * Maximum number of products to extract. + * + * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ - fun domain(domain: String) = domain(JsonField.of(domain)) + fun maxProducts(): Optional = maxProducts.getOptional("maxProducts") /** - * Sets [Builder.domain] to an arbitrary JSON value. + * Optional timeout in milliseconds for the request. Maximum allowed value is 300000ms + * (5 minutes). * - * You should usually call [Builder.domain] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ - fun domain(domain: JsonField) = apply { this.domain = domain } - - /** Maximum number of products to extract. */ - fun maxProducts(maxProducts: Long) = maxProducts(JsonField.of(maxProducts)) + fun timeoutMs(): Optional = timeoutMs.getOptional("timeoutMS") /** - * Sets [Builder.maxProducts] to an arbitrary JSON value. + * Returns the raw JSON value of [domain]. * - * You should usually call [Builder.maxProducts] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [domain], this method doesn't throw if the JSON field has an unexpected type. */ - fun maxProducts(maxProducts: JsonField) = apply { this.maxProducts = maxProducts } + @JsonProperty("domain") @ExcludeMissing fun _domain(): JsonField = domain /** - * 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). + * Returns the raw JSON value of [maxProducts]. + * + * Unlike [maxProducts], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun timeoutMs(timeoutMs: Long) = timeoutMs(JsonField.of(timeoutMs)) + @JsonProperty("maxProducts") + @ExcludeMissing + fun _maxProducts(): JsonField = maxProducts /** - * Sets [Builder.timeoutMs] to an arbitrary JSON value. + * Returns the raw JSON value of [timeoutMs]. * - * You should usually call [Builder.timeoutMs] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. + * Unlike [timeoutMs], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun timeoutMs(timeoutMs: JsonField) = apply { this.timeoutMs = timeoutMs } + @JsonProperty("timeoutMS") @ExcludeMissing fun _timeoutMs(): JsonField = timeoutMs - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ByDomain]. + * + * The following fields are required: + * ```java + * .domain() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + /** A builder for [ByDomain]. */ + class Builder internal constructor() { + + private var domain: JsonField? = null + private var maxProducts: JsonField = JsonMissing.of() + private var timeoutMs: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(byDomain: ByDomain) = apply { + domain = byDomain.domain + maxProducts = byDomain.maxProducts + timeoutMs = byDomain.timeoutMs + additionalProperties = byDomain.additionalProperties.toMutableMap() + } + + /** The domain name to analyze. */ + fun domain(domain: String) = domain(JsonField.of(domain)) + + /** + * Sets [Builder.domain] to an arbitrary JSON value. + * + * You should usually call [Builder.domain] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun domain(domain: JsonField) = apply { this.domain = domain } + + /** Maximum number of products to extract. */ + fun maxProducts(maxProducts: Long) = maxProducts(JsonField.of(maxProducts)) + + /** + * Sets [Builder.maxProducts] to an arbitrary JSON value. + * + * You should usually call [Builder.maxProducts] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun maxProducts(maxProducts: JsonField) = apply { + this.maxProducts = maxProducts + } + + /** + * Optional timeout in milliseconds for the request. Maximum allowed value is + * 300000ms (5 minutes). + */ + fun timeoutMs(timeoutMs: Long) = timeoutMs(JsonField.of(timeoutMs)) + + /** + * Sets [Builder.timeoutMs] to an arbitrary JSON value. + * + * You should usually call [Builder.timeoutMs] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun timeoutMs(timeoutMs: JsonField) = apply { this.timeoutMs = timeoutMs } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ByDomain]. + * + * 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(): ByDomain = + ByDomain( + checkRequired("domain", domain), + maxProducts, + timeoutMs, + additionalProperties.toMutableMap(), + ) } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + private var validated: Boolean = false + + fun validate(): ByDomain = apply { + if (validated) { + return@apply + } - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + domain() + maxProducts() + timeoutMs() + validated = true } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: BrandDevInvalidDataException) { + false + } + /** - * Returns an immutable instance of [Body]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * Further updates to this [Builder] will not mutate the returned instance. + * Used for best match union deserialization. */ - fun build(): Body = - Body(directUrl, domain, maxProducts, timeoutMs, additionalProperties.toMutableMap()) + @JvmSynthetic + internal fun validity(): Int = + (if (domain.asKnown().isPresent) 1 else 0) + + (if (maxProducts.asKnown().isPresent) 1 else 0) + + (if (timeoutMs.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ByDomain && + domain == other.domain && + maxProducts == other.maxProducts && + timeoutMs == other.timeoutMs && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(domain, maxProducts, timeoutMs, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ByDomain{domain=$domain, maxProducts=$maxProducts, timeoutMs=$timeoutMs, additionalProperties=$additionalProperties}" } - private var validated: Boolean = false + class ByDirectUrl + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val directUrl: JsonField, + private val maxProducts: JsonField, + private val timeoutMs: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("directUrl") + @ExcludeMissing + directUrl: JsonField = JsonMissing.of(), + @JsonProperty("maxProducts") + @ExcludeMissing + maxProducts: JsonField = JsonMissing.of(), + @JsonProperty("timeoutMS") + @ExcludeMissing + timeoutMs: JsonField = JsonMissing.of(), + ) : this(directUrl, maxProducts, timeoutMs, mutableMapOf()) - fun validate(): Body = apply { - if (validated) { - return@apply + /** + * A specific URL to use directly as the starting point for extraction without domain + * resolution. + * + * @throws BrandDevInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun directUrl(): String = directUrl.getRequired("directUrl") + + /** + * Maximum number of products to extract. + * + * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun maxProducts(): Optional = maxProducts.getOptional("maxProducts") + + /** + * Optional timeout in milliseconds for the request. Maximum allowed value is 300000ms + * (5 minutes). + * + * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun timeoutMs(): Optional = timeoutMs.getOptional("timeoutMS") + + /** + * Returns the raw JSON value of [directUrl]. + * + * Unlike [directUrl], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("directUrl") + @ExcludeMissing + fun _directUrl(): JsonField = directUrl + + /** + * Returns the raw JSON value of [maxProducts]. + * + * Unlike [maxProducts], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("maxProducts") + @ExcludeMissing + fun _maxProducts(): JsonField = maxProducts + + /** + * Returns the raw JSON value of [timeoutMs]. + * + * Unlike [timeoutMs], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("timeoutMS") @ExcludeMissing fun _timeoutMs(): JsonField = timeoutMs + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - directUrl() - domain() - maxProducts() - timeoutMs() - validated = true - } + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ByDirectUrl]. + * + * The following fields are required: + * ```java + * .directUrl() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: BrandDevInvalidDataException) { - false + /** A builder for [ByDirectUrl]. */ + class Builder internal constructor() { + + private var directUrl: JsonField? = null + private var maxProducts: JsonField = JsonMissing.of() + private var timeoutMs: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(byDirectUrl: ByDirectUrl) = apply { + directUrl = byDirectUrl.directUrl + maxProducts = byDirectUrl.maxProducts + timeoutMs = byDirectUrl.timeoutMs + additionalProperties = byDirectUrl.additionalProperties.toMutableMap() + } + + /** + * A specific URL to use directly as the starting point for extraction without + * domain resolution. + */ + fun directUrl(directUrl: String) = directUrl(JsonField.of(directUrl)) + + /** + * Sets [Builder.directUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.directUrl] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun directUrl(directUrl: JsonField) = apply { this.directUrl = directUrl } + + /** Maximum number of products to extract. */ + fun maxProducts(maxProducts: Long) = maxProducts(JsonField.of(maxProducts)) + + /** + * Sets [Builder.maxProducts] to an arbitrary JSON value. + * + * You should usually call [Builder.maxProducts] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun maxProducts(maxProducts: JsonField) = apply { + this.maxProducts = maxProducts + } + + /** + * Optional timeout in milliseconds for the request. Maximum allowed value is + * 300000ms (5 minutes). + */ + fun timeoutMs(timeoutMs: Long) = timeoutMs(JsonField.of(timeoutMs)) + + /** + * Sets [Builder.timeoutMs] to an arbitrary JSON value. + * + * You should usually call [Builder.timeoutMs] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun timeoutMs(timeoutMs: JsonField) = apply { this.timeoutMs = timeoutMs } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ByDirectUrl]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .directUrl() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ByDirectUrl = + ByDirectUrl( + checkRequired("directUrl", directUrl), + maxProducts, + timeoutMs, + additionalProperties.toMutableMap(), + ) } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (directUrl.asKnown().isPresent) 1 else 0) + - (if (domain.asKnown().isPresent) 1 else 0) + - (if (maxProducts.asKnown().isPresent) 1 else 0) + - (if (timeoutMs.asKnown().isPresent) 1 else 0) + private var validated: Boolean = false - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun validate(): ByDirectUrl = apply { + if (validated) { + return@apply + } + + directUrl() + maxProducts() + timeoutMs() + validated = true } - return other is Body && - directUrl == other.directUrl && - domain == other.domain && - maxProducts == other.maxProducts && - timeoutMs == other.timeoutMs && - additionalProperties == other.additionalProperties - } + fun isValid(): Boolean = + try { + validate() + true + } catch (e: BrandDevInvalidDataException) { + false + } - private val hashCode: Int by lazy { - Objects.hash(directUrl, domain, maxProducts, timeoutMs, additionalProperties) - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (directUrl.asKnown().isPresent) 1 else 0) + + (if (maxProducts.asKnown().isPresent) 1 else 0) + + (if (timeoutMs.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ByDirectUrl && + directUrl == other.directUrl && + maxProducts == other.maxProducts && + timeoutMs == other.timeoutMs && + additionalProperties == other.additionalProperties + } - override fun hashCode(): Int = hashCode + private val hashCode: Int by lazy { + Objects.hash(directUrl, maxProducts, timeoutMs, additionalProperties) + } + + override fun hashCode(): Int = hashCode - override fun toString() = - "Body{directUrl=$directUrl, domain=$domain, maxProducts=$maxProducts, timeoutMs=$timeoutMs, additionalProperties=$additionalProperties}" + override fun toString() = + "ByDirectUrl{directUrl=$directUrl, maxProducts=$maxProducts, timeoutMs=$timeoutMs, additionalProperties=$additionalProperties}" + } } override fun equals(other: Any?): Boolean { 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 a5d9434..4500458 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 @@ -67,24 +67,15 @@ interface BrandServiceAsync { * website and return a list of products with details such as name, description, image, pricing, * features, and more. */ - fun aiProducts(): CompletableFuture = - aiProducts(BrandAiProductsParams.none()) + fun aiProducts(params: BrandAiProductsParams): CompletableFuture = + aiProducts(params, RequestOptions.none()) /** @see aiProducts */ fun aiProducts( - params: BrandAiProductsParams = BrandAiProductsParams.none(), + params: BrandAiProductsParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** @see aiProducts */ - fun aiProducts( - params: BrandAiProductsParams = BrandAiProductsParams.none() - ): CompletableFuture = aiProducts(params, RequestOptions.none()) - - /** @see aiProducts */ - fun aiProducts(requestOptions: RequestOptions): CompletableFuture = - aiProducts(BrandAiProductsParams.none(), requestOptions) - /** * 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. @@ -306,26 +297,16 @@ interface BrandServiceAsync { * Returns a raw HTTP response for `post /brand/ai/products`, but is otherwise the same as * [BrandServiceAsync.aiProducts]. */ - fun aiProducts(): CompletableFuture> = - aiProducts(BrandAiProductsParams.none()) - - /** @see aiProducts */ fun aiProducts( - params: BrandAiProductsParams = BrandAiProductsParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see aiProducts */ - fun aiProducts( - params: BrandAiProductsParams = BrandAiProductsParams.none() + params: BrandAiProductsParams ): CompletableFuture> = aiProducts(params, RequestOptions.none()) /** @see aiProducts */ fun aiProducts( - requestOptions: RequestOptions - ): CompletableFuture> = - aiProducts(BrandAiProductsParams.none(), requestOptions) + params: BrandAiProductsParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> /** * Returns a raw HTTP response for `post /brand/ai/query`, 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 05f66f8..b467fc0 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 @@ -67,23 +67,15 @@ interface BrandService { * website and return a list of products with details such as name, description, image, pricing, * features, and more. */ - fun aiProducts(): BrandAiProductsResponse = aiProducts(BrandAiProductsParams.none()) + fun aiProducts(params: BrandAiProductsParams): BrandAiProductsResponse = + aiProducts(params, RequestOptions.none()) /** @see aiProducts */ fun aiProducts( - params: BrandAiProductsParams = BrandAiProductsParams.none(), + params: BrandAiProductsParams, requestOptions: RequestOptions = RequestOptions.none(), ): BrandAiProductsResponse - /** @see aiProducts */ - fun aiProducts( - params: BrandAiProductsParams = BrandAiProductsParams.none() - ): BrandAiProductsResponse = aiProducts(params, RequestOptions.none()) - - /** @see aiProducts */ - fun aiProducts(requestOptions: RequestOptions): BrandAiProductsResponse = - aiProducts(BrandAiProductsParams.none(), requestOptions) - /** * 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. @@ -289,27 +281,16 @@ interface BrandService { * [BrandService.aiProducts]. */ @MustBeClosed - fun aiProducts(): HttpResponseFor = - aiProducts(BrandAiProductsParams.none()) + fun aiProducts(params: BrandAiProductsParams): HttpResponseFor = + aiProducts(params, RequestOptions.none()) /** @see aiProducts */ @MustBeClosed fun aiProducts( - params: BrandAiProductsParams = BrandAiProductsParams.none(), + params: BrandAiProductsParams, requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor - /** @see aiProducts */ - @MustBeClosed - fun aiProducts( - params: BrandAiProductsParams = BrandAiProductsParams.none() - ): HttpResponseFor = aiProducts(params, RequestOptions.none()) - - /** @see aiProducts */ - @MustBeClosed - fun aiProducts(requestOptions: RequestOptions): HttpResponseFor = - aiProducts(BrandAiProductsParams.none(), requestOptions) - /** * Returns a raw HTTP response for `post /brand/ai/query`, but is otherwise the same as * [BrandService.aiQuery]. diff --git a/brand-dev-java-core/src/test/kotlin/com/branddev/api/models/brand/BrandAiProductsParamsTest.kt b/brand-dev-java-core/src/test/kotlin/com/branddev/api/models/brand/BrandAiProductsParamsTest.kt index 43b5833..5d5ad09 100644 --- a/brand-dev-java-core/src/test/kotlin/com/branddev/api/models/brand/BrandAiProductsParamsTest.kt +++ b/brand-dev-java-core/src/test/kotlin/com/branddev/api/models/brand/BrandAiProductsParamsTest.kt @@ -10,10 +10,13 @@ internal class BrandAiProductsParamsTest { @Test fun create() { BrandAiProductsParams.builder() - .directUrl("https://example.com") - .domain("domain") - .maxProducts(1L) - .timeoutMs(1L) + .body( + BrandAiProductsParams.Body.ByDomain.builder() + .domain("domain") + .maxProducts(1L) + .timeoutMs(1L) + .build() + ) .build() } @@ -21,24 +24,43 @@ internal class BrandAiProductsParamsTest { fun body() { val params = BrandAiProductsParams.builder() - .directUrl("https://example.com") - .domain("domain") - .maxProducts(1L) - .timeoutMs(1L) + .body( + BrandAiProductsParams.Body.ByDomain.builder() + .domain("domain") + .maxProducts(1L) + .timeoutMs(1L) + .build() + ) .build() val body = params._body() - assertThat(body.directUrl()).contains("https://example.com") - assertThat(body.domain()).contains("domain") - assertThat(body.maxProducts()).contains(1L) - assertThat(body.timeoutMs()).contains(1L) + assertThat(body) + .isEqualTo( + BrandAiProductsParams.Body.ofByDomain( + BrandAiProductsParams.Body.ByDomain.builder() + .domain("domain") + .maxProducts(1L) + .timeoutMs(1L) + .build() + ) + ) } @Test fun bodyWithoutOptionalFields() { - val params = BrandAiProductsParams.builder().build() + val params = + BrandAiProductsParams.builder() + .body(BrandAiProductsParams.Body.ByDomain.builder().domain("domain").build()) + .build() val body = params._body() + + assertThat(body) + .isEqualTo( + BrandAiProductsParams.Body.ofByDomain( + BrandAiProductsParams.Body.ByDomain.builder().domain("domain").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 27645b2..e600a78 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 @@ -64,10 +64,13 @@ internal class BrandServiceAsyncTest { val responseFuture = brandServiceAsync.aiProducts( BrandAiProductsParams.builder() - .directUrl("https://example.com") - .domain("domain") - .maxProducts(1L) - .timeoutMs(1L) + .body( + BrandAiProductsParams.Body.ByDomain.builder() + .domain("domain") + .maxProducts(1L) + .timeoutMs(1L) + .build() + ) .build() ) 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 b755776..c042765 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 @@ -63,10 +63,13 @@ internal class BrandServiceTest { val response = brandService.aiProducts( BrandAiProductsParams.builder() - .directUrl("https://example.com") - .domain("domain") - .maxProducts(1L) - .timeoutMs(1L) + .body( + BrandAiProductsParams.Body.ByDomain.builder() + .domain("domain") + .maxProducts(1L) + .timeoutMs(1L) + .build() + ) .build() ) diff --git a/build.gradle.kts b/build.gradle.kts index bc78627..0f41d01 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ repositories { allprojects { group = "com.branddev.api" - version = "0.1.0-alpha.28" // x-release-please-version + version = "0.1.0-alpha.29" // x-release-please-version } subprojects {