Skip to content

Commit 63d98a3

Browse files
feat(client): add more convenience service method overloads
1 parent 7176a5a commit 63d98a3

File tree

4 files changed

+156
-16
lines changed

4 files changed

+156
-16
lines changed

brand-dev-java-core/src/main/kotlin/com/branddev/api/services/async/BrandServiceAsync.kt

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,41 @@ interface BrandServiceAsync {
9292
requestOptions: RequestOptions = RequestOptions.none(),
9393
): CompletableFuture<BrandAiProductsResponse>
9494

95+
/** @see aiProducts */
96+
fun aiProducts(
97+
body: BrandAiProductsParams.Body,
98+
requestOptions: RequestOptions = RequestOptions.none(),
99+
): CompletableFuture<BrandAiProductsResponse> =
100+
aiProducts(BrandAiProductsParams.builder().body(body).build(), requestOptions)
101+
102+
/** @see aiProducts */
103+
fun aiProducts(body: BrandAiProductsParams.Body): CompletableFuture<BrandAiProductsResponse> =
104+
aiProducts(body, RequestOptions.none())
105+
106+
/** @see aiProducts */
107+
fun aiProducts(
108+
byDomain: BrandAiProductsParams.Body.ByDomain,
109+
requestOptions: RequestOptions = RequestOptions.none(),
110+
): CompletableFuture<BrandAiProductsResponse> =
111+
aiProducts(BrandAiProductsParams.Body.ofByDomain(byDomain), requestOptions)
112+
113+
/** @see aiProducts */
114+
fun aiProducts(
115+
byDomain: BrandAiProductsParams.Body.ByDomain
116+
): CompletableFuture<BrandAiProductsResponse> = aiProducts(byDomain, RequestOptions.none())
117+
118+
/** @see aiProducts */
119+
fun aiProducts(
120+
byDirectUrl: BrandAiProductsParams.Body.ByDirectUrl,
121+
requestOptions: RequestOptions = RequestOptions.none(),
122+
): CompletableFuture<BrandAiProductsResponse> =
123+
aiProducts(BrandAiProductsParams.Body.ofByDirectUrl(byDirectUrl), requestOptions)
124+
125+
/** @see aiProducts */
126+
fun aiProducts(
127+
byDirectUrl: BrandAiProductsParams.Body.ByDirectUrl
128+
): CompletableFuture<BrandAiProductsResponse> = aiProducts(byDirectUrl, RequestOptions.none())
129+
95130
/**
96131
* Use AI to extract specific data points from a brand's website. The AI will crawl the website
97132
* and extract the requested information based on the provided data points.
@@ -339,6 +374,45 @@ interface BrandServiceAsync {
339374
requestOptions: RequestOptions = RequestOptions.none(),
340375
): CompletableFuture<HttpResponseFor<BrandAiProductsResponse>>
341376

377+
/** @see aiProducts */
378+
fun aiProducts(
379+
body: BrandAiProductsParams.Body,
380+
requestOptions: RequestOptions = RequestOptions.none(),
381+
): CompletableFuture<HttpResponseFor<BrandAiProductsResponse>> =
382+
aiProducts(BrandAiProductsParams.builder().body(body).build(), requestOptions)
383+
384+
/** @see aiProducts */
385+
fun aiProducts(
386+
body: BrandAiProductsParams.Body
387+
): CompletableFuture<HttpResponseFor<BrandAiProductsResponse>> =
388+
aiProducts(body, RequestOptions.none())
389+
390+
/** @see aiProducts */
391+
fun aiProducts(
392+
byDomain: BrandAiProductsParams.Body.ByDomain,
393+
requestOptions: RequestOptions = RequestOptions.none(),
394+
): CompletableFuture<HttpResponseFor<BrandAiProductsResponse>> =
395+
aiProducts(BrandAiProductsParams.Body.ofByDomain(byDomain), requestOptions)
396+
397+
/** @see aiProducts */
398+
fun aiProducts(
399+
byDomain: BrandAiProductsParams.Body.ByDomain
400+
): CompletableFuture<HttpResponseFor<BrandAiProductsResponse>> =
401+
aiProducts(byDomain, RequestOptions.none())
402+
403+
/** @see aiProducts */
404+
fun aiProducts(
405+
byDirectUrl: BrandAiProductsParams.Body.ByDirectUrl,
406+
requestOptions: RequestOptions = RequestOptions.none(),
407+
): CompletableFuture<HttpResponseFor<BrandAiProductsResponse>> =
408+
aiProducts(BrandAiProductsParams.Body.ofByDirectUrl(byDirectUrl), requestOptions)
409+
410+
/** @see aiProducts */
411+
fun aiProducts(
412+
byDirectUrl: BrandAiProductsParams.Body.ByDirectUrl
413+
): CompletableFuture<HttpResponseFor<BrandAiProductsResponse>> =
414+
aiProducts(byDirectUrl, RequestOptions.none())
415+
342416
/**
343417
* Returns a raw HTTP response for `post /brand/ai/query`, but is otherwise the same as
344418
* [BrandServiceAsync.aiQuery].

brand-dev-java-core/src/main/kotlin/com/branddev/api/services/blocking/BrandService.kt

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,39 @@ interface BrandService {
9292
requestOptions: RequestOptions = RequestOptions.none(),
9393
): BrandAiProductsResponse
9494

95+
/** @see aiProducts */
96+
fun aiProducts(
97+
body: BrandAiProductsParams.Body,
98+
requestOptions: RequestOptions = RequestOptions.none(),
99+
): BrandAiProductsResponse =
100+
aiProducts(BrandAiProductsParams.builder().body(body).build(), requestOptions)
101+
102+
/** @see aiProducts */
103+
fun aiProducts(body: BrandAiProductsParams.Body): BrandAiProductsResponse =
104+
aiProducts(body, RequestOptions.none())
105+
106+
/** @see aiProducts */
107+
fun aiProducts(
108+
byDomain: BrandAiProductsParams.Body.ByDomain,
109+
requestOptions: RequestOptions = RequestOptions.none(),
110+
): BrandAiProductsResponse =
111+
aiProducts(BrandAiProductsParams.Body.ofByDomain(byDomain), requestOptions)
112+
113+
/** @see aiProducts */
114+
fun aiProducts(byDomain: BrandAiProductsParams.Body.ByDomain): BrandAiProductsResponse =
115+
aiProducts(byDomain, RequestOptions.none())
116+
117+
/** @see aiProducts */
118+
fun aiProducts(
119+
byDirectUrl: BrandAiProductsParams.Body.ByDirectUrl,
120+
requestOptions: RequestOptions = RequestOptions.none(),
121+
): BrandAiProductsResponse =
122+
aiProducts(BrandAiProductsParams.Body.ofByDirectUrl(byDirectUrl), requestOptions)
123+
124+
/** @see aiProducts */
125+
fun aiProducts(byDirectUrl: BrandAiProductsParams.Body.ByDirectUrl): BrandAiProductsResponse =
126+
aiProducts(byDirectUrl, RequestOptions.none())
127+
95128
/**
96129
* Use AI to extract specific data points from a brand's website. The AI will crawl the website
97130
* and extract the requested information based on the provided data points.
@@ -322,6 +355,47 @@ interface BrandService {
322355
requestOptions: RequestOptions = RequestOptions.none(),
323356
): HttpResponseFor<BrandAiProductsResponse>
324357

358+
/** @see aiProducts */
359+
@MustBeClosed
360+
fun aiProducts(
361+
body: BrandAiProductsParams.Body,
362+
requestOptions: RequestOptions = RequestOptions.none(),
363+
): HttpResponseFor<BrandAiProductsResponse> =
364+
aiProducts(BrandAiProductsParams.builder().body(body).build(), requestOptions)
365+
366+
/** @see aiProducts */
367+
@MustBeClosed
368+
fun aiProducts(body: BrandAiProductsParams.Body): HttpResponseFor<BrandAiProductsResponse> =
369+
aiProducts(body, RequestOptions.none())
370+
371+
/** @see aiProducts */
372+
@MustBeClosed
373+
fun aiProducts(
374+
byDomain: BrandAiProductsParams.Body.ByDomain,
375+
requestOptions: RequestOptions = RequestOptions.none(),
376+
): HttpResponseFor<BrandAiProductsResponse> =
377+
aiProducts(BrandAiProductsParams.Body.ofByDomain(byDomain), requestOptions)
378+
379+
/** @see aiProducts */
380+
@MustBeClosed
381+
fun aiProducts(
382+
byDomain: BrandAiProductsParams.Body.ByDomain
383+
): HttpResponseFor<BrandAiProductsResponse> = aiProducts(byDomain, RequestOptions.none())
384+
385+
/** @see aiProducts */
386+
@MustBeClosed
387+
fun aiProducts(
388+
byDirectUrl: BrandAiProductsParams.Body.ByDirectUrl,
389+
requestOptions: RequestOptions = RequestOptions.none(),
390+
): HttpResponseFor<BrandAiProductsResponse> =
391+
aiProducts(BrandAiProductsParams.Body.ofByDirectUrl(byDirectUrl), requestOptions)
392+
393+
/** @see aiProducts */
394+
@MustBeClosed
395+
fun aiProducts(
396+
byDirectUrl: BrandAiProductsParams.Body.ByDirectUrl
397+
): HttpResponseFor<BrandAiProductsResponse> = aiProducts(byDirectUrl, RequestOptions.none())
398+
325399
/**
326400
* Returns a raw HTTP response for `post /brand/ai/query`, but is otherwise the same as
327401
* [BrandService.aiQuery].

brand-dev-java-core/src/test/kotlin/com/branddev/api/services/async/BrandServiceAsyncTest.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,10 @@ internal class BrandServiceAsyncTest {
8383

8484
val responseFuture =
8585
brandServiceAsync.aiProducts(
86-
BrandAiProductsParams.builder()
87-
.body(
88-
BrandAiProductsParams.Body.ByDomain.builder()
89-
.domain("domain")
90-
.maxProducts(1L)
91-
.timeoutMs(1000L)
92-
.build()
93-
)
86+
BrandAiProductsParams.Body.ByDomain.builder()
87+
.domain("domain")
88+
.maxProducts(1L)
89+
.timeoutMs(1000L)
9490
.build()
9591
)
9692

brand-dev-java-core/src/test/kotlin/com/branddev/api/services/blocking/BrandServiceTest.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,10 @@ internal class BrandServiceTest {
8181

8282
val response =
8383
brandService.aiProducts(
84-
BrandAiProductsParams.builder()
85-
.body(
86-
BrandAiProductsParams.Body.ByDomain.builder()
87-
.domain("domain")
88-
.maxProducts(1L)
89-
.timeoutMs(1000L)
90-
.build()
91-
)
84+
BrandAiProductsParams.Body.ByDomain.builder()
85+
.domain("domain")
86+
.maxProducts(1L)
87+
.timeoutMs(1000L)
9288
.build()
9389
)
9490

0 commit comments

Comments
 (0)