@@ -7,7 +7,6 @@ import com.branddev.api.core.JsonField
77import com.branddev.api.core.JsonMissing
88import com.branddev.api.core.JsonValue
99import com.branddev.api.core.Params
10- import com.branddev.api.core.checkRequired
1110import com.branddev.api.core.http.Headers
1211import com.branddev.api.core.http.QueryParams
1312import com.branddev.api.errors.BrandDevInvalidDataException
@@ -32,12 +31,23 @@ private constructor(
3231) : Params {
3332
3433 /* *
35- * The domain name to analyze
34+ * A specific URL to use directly as the starting point for extraction without domain
35+ * resolution. Useful when you want to extract products from a specific page rather than
36+ * discovering the site's product pages automatically. Either 'domain' or 'directUrl' must be
37+ * provided, but not both.
3638 *
37- * @throws BrandDevInvalidDataException if the JSON field has an unexpected type or is
38- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
39+ * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if the
40+ * server responded with an unexpected value).
41+ */
42+ fun directUrl (): Optional <String > = body.directUrl()
43+
44+ /* *
45+ * The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but not both.
46+ *
47+ * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if the
48+ * server responded with an unexpected value).
3949 */
40- fun domain (): String = body.domain()
50+ fun domain (): Optional < String > = body.domain()
4151
4252 /* *
4353 * Maximum number of products to extract.
@@ -57,6 +67,13 @@ private constructor(
5767 */
5868 fun timeoutMs (): Optional <Long > = body.timeoutMs()
5969
70+ /* *
71+ * Returns the raw JSON value of [directUrl].
72+ *
73+ * Unlike [directUrl], this method doesn't throw if the JSON field has an unexpected type.
74+ */
75+ fun _directUrl (): JsonField <String > = body._directUrl ()
76+
6077 /* *
6178 * Returns the raw JSON value of [domain].
6279 *
@@ -90,14 +107,9 @@ private constructor(
90107
91108 companion object {
92109
93- /* *
94- * Returns a mutable builder for constructing an instance of [BrandAiProductsParams].
95- *
96- * The following fields are required:
97- * ```java
98- * .domain()
99- * ```
100- */
110+ @JvmStatic fun none (): BrandAiProductsParams = builder().build()
111+
112+ /* * Returns a mutable builder for constructing an instance of [BrandAiProductsParams]. */
101113 @JvmStatic fun builder () = Builder ()
102114 }
103115
@@ -120,13 +132,34 @@ private constructor(
120132 *
121133 * This is generally only useful if you are already constructing the body separately.
122134 * Otherwise, it's more convenient to use the top-level setters instead:
135+ * - [directUrl]
123136 * - [domain]
124137 * - [maxProducts]
125138 * - [timeoutMs]
126139 */
127140 fun body (body : Body ) = apply { this .body = body.toBuilder() }
128141
129- /* * The domain name to analyze */
142+ /* *
143+ * A specific URL to use directly as the starting point for extraction without domain
144+ * resolution. Useful when you want to extract products from a specific page rather than
145+ * discovering the site's product pages automatically. Either 'domain' or 'directUrl' must
146+ * be provided, but not both.
147+ */
148+ fun directUrl (directUrl : String ) = apply { body.directUrl(directUrl) }
149+
150+ /* *
151+ * Sets [Builder.directUrl] to an arbitrary JSON value.
152+ *
153+ * You should usually call [Builder.directUrl] with a well-typed [String] value instead.
154+ * This method is primarily for setting the field to an undocumented or not yet supported
155+ * value.
156+ */
157+ fun directUrl (directUrl : JsonField <String >) = apply { body.directUrl(directUrl) }
158+
159+ /* *
160+ * The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but not
161+ * both.
162+ */
130163 fun domain (domain : String ) = apply { body.domain(domain) }
131164
132165 /* *
@@ -285,13 +318,6 @@ private constructor(
285318 * Returns an immutable instance of [BrandAiProductsParams].
286319 *
287320 * Further updates to this [Builder] will not mutate the returned instance.
288- *
289- * The following fields are required:
290- * ```java
291- * .domain()
292- * ```
293- *
294- * @throws IllegalStateException if any required field is unset.
295321 */
296322 fun build (): BrandAiProductsParams =
297323 BrandAiProductsParams (
@@ -310,6 +336,7 @@ private constructor(
310336 class Body
311337 @JsonCreator(mode = JsonCreator .Mode .DISABLED )
312338 private constructor (
339+ private val directUrl: JsonField <String >,
313340 private val domain: JsonField <String >,
314341 private val maxProducts: JsonField <Long >,
315342 private val timeoutMs: JsonField <Long >,
@@ -318,20 +345,35 @@ private constructor(
318345
319346 @JsonCreator
320347 private constructor (
348+ @JsonProperty(" directUrl" )
349+ @ExcludeMissing
350+ directUrl: JsonField <String > = JsonMissing .of(),
321351 @JsonProperty(" domain" ) @ExcludeMissing domain: JsonField <String > = JsonMissing .of(),
322352 @JsonProperty(" maxProducts" )
323353 @ExcludeMissing
324354 maxProducts: JsonField <Long > = JsonMissing .of(),
325355 @JsonProperty(" timeoutMS" ) @ExcludeMissing timeoutMs: JsonField <Long > = JsonMissing .of(),
326- ) : this (domain, maxProducts, timeoutMs, mutableMapOf ())
356+ ) : this (directUrl, domain, maxProducts, timeoutMs, mutableMapOf ())
327357
328358 /* *
329- * The domain name to analyze
359+ * A specific URL to use directly as the starting point for extraction without domain
360+ * resolution. Useful when you want to extract products from a specific page rather than
361+ * discovering the site's product pages automatically. Either 'domain' or 'directUrl' must
362+ * be provided, but not both.
330363 *
331- * @throws BrandDevInvalidDataException if the JSON field has an unexpected type or is
332- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
364+ * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if
365+ * the server responded with an unexpected value).
333366 */
334- fun domain (): String = domain.getRequired(" domain" )
367+ fun directUrl (): Optional <String > = directUrl.getOptional(" directUrl" )
368+
369+ /* *
370+ * The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but not
371+ * both.
372+ *
373+ * @throws BrandDevInvalidDataException if the JSON field has an unexpected type (e.g. if
374+ * the server responded with an unexpected value).
375+ */
376+ fun domain (): Optional <String > = domain.getOptional(" domain" )
335377
336378 /* *
337379 * Maximum number of products to extract.
@@ -351,6 +393,13 @@ private constructor(
351393 */
352394 fun timeoutMs (): Optional <Long > = timeoutMs.getOptional(" timeoutMS" )
353395
396+ /* *
397+ * Returns the raw JSON value of [directUrl].
398+ *
399+ * Unlike [directUrl], this method doesn't throw if the JSON field has an unexpected type.
400+ */
401+ @JsonProperty(" directUrl" ) @ExcludeMissing fun _directUrl (): JsonField <String > = directUrl
402+
354403 /* *
355404 * Returns the raw JSON value of [domain].
356405 *
@@ -388,34 +437,49 @@ private constructor(
388437
389438 companion object {
390439
391- /* *
392- * Returns a mutable builder for constructing an instance of [Body].
393- *
394- * The following fields are required:
395- * ```java
396- * .domain()
397- * ```
398- */
440+ /* * Returns a mutable builder for constructing an instance of [Body]. */
399441 @JvmStatic fun builder () = Builder ()
400442 }
401443
402444 /* * A builder for [Body]. */
403445 class Builder internal constructor() {
404446
405- private var domain: JsonField <String >? = null
447+ private var directUrl: JsonField <String > = JsonMissing .of()
448+ private var domain: JsonField <String > = JsonMissing .of()
406449 private var maxProducts: JsonField <Long > = JsonMissing .of()
407450 private var timeoutMs: JsonField <Long > = JsonMissing .of()
408451 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
409452
410453 @JvmSynthetic
411454 internal fun from (body : Body ) = apply {
455+ directUrl = body.directUrl
412456 domain = body.domain
413457 maxProducts = body.maxProducts
414458 timeoutMs = body.timeoutMs
415459 additionalProperties = body.additionalProperties.toMutableMap()
416460 }
417461
418- /* * The domain name to analyze */
462+ /* *
463+ * A specific URL to use directly as the starting point for extraction without domain
464+ * resolution. Useful when you want to extract products from a specific page rather than
465+ * discovering the site's product pages automatically. Either 'domain' or 'directUrl'
466+ * must be provided, but not both.
467+ */
468+ fun directUrl (directUrl : String ) = directUrl(JsonField .of(directUrl))
469+
470+ /* *
471+ * Sets [Builder.directUrl] to an arbitrary JSON value.
472+ *
473+ * You should usually call [Builder.directUrl] with a well-typed [String] value instead.
474+ * This method is primarily for setting the field to an undocumented or not yet
475+ * supported value.
476+ */
477+ fun directUrl (directUrl : JsonField <String >) = apply { this .directUrl = directUrl }
478+
479+ /* *
480+ * The domain name to analyze. Either 'domain' or 'directUrl' must be provided, but not
481+ * both.
482+ */
419483 fun domain (domain : String ) = domain(JsonField .of(domain))
420484
421485 /* *
@@ -478,21 +542,9 @@ private constructor(
478542 * Returns an immutable instance of [Body].
479543 *
480544 * Further updates to this [Builder] will not mutate the returned instance.
481- *
482- * The following fields are required:
483- * ```java
484- * .domain()
485- * ```
486- *
487- * @throws IllegalStateException if any required field is unset.
488545 */
489546 fun build (): Body =
490- Body (
491- checkRequired(" domain" , domain),
492- maxProducts,
493- timeoutMs,
494- additionalProperties.toMutableMap(),
495- )
547+ Body (directUrl, domain, maxProducts, timeoutMs, additionalProperties.toMutableMap())
496548 }
497549
498550 private var validated: Boolean = false
@@ -502,6 +554,7 @@ private constructor(
502554 return @apply
503555 }
504556
557+ directUrl()
505558 domain()
506559 maxProducts()
507560 timeoutMs()
@@ -524,7 +577,8 @@ private constructor(
524577 */
525578 @JvmSynthetic
526579 internal fun validity (): Int =
527- (if (domain.asKnown().isPresent) 1 else 0 ) +
580+ (if (directUrl.asKnown().isPresent) 1 else 0 ) +
581+ (if (domain.asKnown().isPresent) 1 else 0 ) +
528582 (if (maxProducts.asKnown().isPresent) 1 else 0 ) +
529583 (if (timeoutMs.asKnown().isPresent) 1 else 0 )
530584
@@ -534,20 +588,21 @@ private constructor(
534588 }
535589
536590 return other is Body &&
591+ directUrl == other.directUrl &&
537592 domain == other.domain &&
538593 maxProducts == other.maxProducts &&
539594 timeoutMs == other.timeoutMs &&
540595 additionalProperties == other.additionalProperties
541596 }
542597
543598 private val hashCode: Int by lazy {
544- Objects .hash(domain, maxProducts, timeoutMs, additionalProperties)
599+ Objects .hash(directUrl, domain, maxProducts, timeoutMs, additionalProperties)
545600 }
546601
547602 override fun hashCode (): Int = hashCode
548603
549604 override fun toString () =
550- " Body{domain=$domain , maxProducts=$maxProducts , timeoutMs=$timeoutMs , additionalProperties=$additionalProperties }"
605+ " Body{directUrl= $directUrl , domain=$domain , maxProducts=$maxProducts , timeoutMs=$timeoutMs , additionalProperties=$additionalProperties }"
551606 }
552607
553608 override fun equals (other : Any? ): Boolean {
0 commit comments