Skip to content

Commit a850bab

Browse files
algolia-bote-krebsshortcutsmillotp
committed
feat(specs): rename composition to composition-full (private) and add composition (public) (generated)
algolia/api-clients-automation#4357 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Emmanuel Krebs <[email protected]> Co-authored-by: shortcuts <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 4f01c6f commit a850bab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6363
-0
lines changed
Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.api;
5+
6+
import com.algolia.ApiClient;
7+
import com.algolia.config.*;
8+
import com.algolia.config.ClientOptions;
9+
import com.algolia.exceptions.*;
10+
import com.algolia.model.composition.*;
11+
import com.algolia.utils.*;
12+
import com.fasterxml.jackson.core.type.TypeReference;
13+
import java.time.Duration;
14+
import java.util.ArrayList;
15+
import java.util.Collections;
16+
import java.util.EnumSet;
17+
import java.util.List;
18+
import java.util.Random;
19+
import java.util.concurrent.CompletableFuture;
20+
import java.util.stream.Collectors;
21+
import java.util.stream.Stream;
22+
import javax.annotation.Nonnull;
23+
import javax.annotation.Nullable;
24+
25+
public class CompositionClient extends ApiClient {
26+
27+
public CompositionClient(String appId, String apiKey) {
28+
this(appId, apiKey, null);
29+
}
30+
31+
public CompositionClient(String appId, String apiKey, ClientOptions options) {
32+
super(
33+
appId,
34+
apiKey,
35+
"Composition",
36+
options,
37+
getDefaultHosts(appId),
38+
Duration.ofMillis(2000L),
39+
Duration.ofMillis(5000L),
40+
Duration.ofMillis(30000L)
41+
);
42+
}
43+
44+
private static List<Host> getDefaultHosts(String appId) {
45+
List<Host> hosts = new ArrayList<>();
46+
hosts.add(new Host(appId + "-dsn.algolia.net", EnumSet.of(CallType.READ)));
47+
hosts.add(new Host(appId + ".algolia.net", EnumSet.of(CallType.WRITE)));
48+
49+
List<Host> commonHosts = new ArrayList<>();
50+
commonHosts.add(new Host(appId + "-1.algolianet.com", EnumSet.of(CallType.READ, CallType.WRITE)));
51+
commonHosts.add(new Host(appId + "-2.algolianet.com", EnumSet.of(CallType.READ, CallType.WRITE)));
52+
commonHosts.add(new Host(appId + "-3.algolianet.com", EnumSet.of(CallType.READ, CallType.WRITE)));
53+
54+
Collections.shuffle(commonHosts, new Random());
55+
56+
return Stream.concat(hosts.stream(), commonHosts.stream()).collect(Collectors.toList());
57+
}
58+
59+
/**
60+
* Runs a query on a single composition and returns matching results.
61+
*
62+
* @param compositionID Unique Composition ObjectID. (required)
63+
* @param requestBody (required)
64+
* @param innerType The class held by the index, could be your custom class or {@link Object}.
65+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
66+
* the transporter requestOptions.
67+
* @throws AlgoliaRuntimeException If it fails to process the API call
68+
*/
69+
public <T> SearchResponse<T> search(
70+
@Nonnull String compositionID,
71+
@Nonnull RequestBody requestBody,
72+
Class<T> innerType,
73+
@Nullable RequestOptions requestOptions
74+
) throws AlgoliaRuntimeException {
75+
return LaunderThrowable.await(searchAsync(compositionID, requestBody, innerType, requestOptions));
76+
}
77+
78+
/**
79+
* Runs a query on a single composition and returns matching results.
80+
*
81+
* @param compositionID Unique Composition ObjectID. (required)
82+
* @param requestBody (required)
83+
* @param innerType The class held by the index, could be your custom class or {@link Object}.
84+
* @throws AlgoliaRuntimeException If it fails to process the API call
85+
*/
86+
public <T> SearchResponse<T> search(@Nonnull String compositionID, @Nonnull RequestBody requestBody, Class<T> innerType)
87+
throws AlgoliaRuntimeException {
88+
return this.search(compositionID, requestBody, innerType, null);
89+
}
90+
91+
/**
92+
* (asynchronously) Runs a query on a single composition and returns matching results.
93+
*
94+
* @param compositionID Unique Composition ObjectID. (required)
95+
* @param requestBody (required)
96+
* @param innerType The class held by the index, could be your custom class or {@link Object}.
97+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
98+
* the transporter requestOptions.
99+
* @throws AlgoliaRuntimeException If it fails to process the API call
100+
*/
101+
public <T> CompletableFuture<SearchResponse<T>> searchAsync(
102+
@Nonnull String compositionID,
103+
@Nonnull RequestBody requestBody,
104+
Class<T> innerType,
105+
@Nullable RequestOptions requestOptions
106+
) throws AlgoliaRuntimeException {
107+
Parameters.requireNonNull(compositionID, "Parameter `compositionID` is required when calling `search`.");
108+
109+
Parameters.requireNonNull(requestBody, "Parameter `requestBody` is required when calling `search`.");
110+
111+
HttpRequest request = HttpRequest.builder()
112+
.setPath("/1/compositions/{compositionID}/run", compositionID)
113+
.setMethod("POST")
114+
.setBody(requestBody)
115+
.setRead(true)
116+
.build();
117+
return executeAsync(request, requestOptions, SearchResponse.class, innerType);
118+
}
119+
120+
/**
121+
* (asynchronously) Runs a query on a single composition and returns matching results.
122+
*
123+
* @param compositionID Unique Composition ObjectID. (required)
124+
* @param requestBody (required)
125+
* @param innerType The class held by the index, could be your custom class or {@link Object}.
126+
* @throws AlgoliaRuntimeException If it fails to process the API call
127+
*/
128+
public <T> CompletableFuture<SearchResponse<T>> searchAsync(
129+
@Nonnull String compositionID,
130+
@Nonnull RequestBody requestBody,
131+
Class<T> innerType
132+
) throws AlgoliaRuntimeException {
133+
return this.searchAsync(compositionID, requestBody, innerType, null);
134+
}
135+
136+
/**
137+
* Searches for values of a specified facet attribute on the composition's main source's index. -
138+
* By default, facet values are sorted by decreasing count. You can adjust this with the
139+
* `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than
140+
* 65 searchable facets and searchable attributes combined**.
141+
*
142+
* @param compositionID Unique Composition ObjectID. (required)
143+
* @param facetName Facet attribute in which to search for values. This attribute must be included
144+
* in the `attributesForFaceting` index setting with the `searchable()` modifier. (required)
145+
* @param searchForFacetValuesRequest (optional)
146+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
147+
* the transporter requestOptions.
148+
* @throws AlgoliaRuntimeException If it fails to process the API call
149+
*/
150+
public SearchForFacetValuesResponse searchForFacetValues(
151+
@Nonnull String compositionID,
152+
@Nonnull String facetName,
153+
SearchForFacetValuesRequest searchForFacetValuesRequest,
154+
@Nullable RequestOptions requestOptions
155+
) throws AlgoliaRuntimeException {
156+
return LaunderThrowable.await(searchForFacetValuesAsync(compositionID, facetName, searchForFacetValuesRequest, requestOptions));
157+
}
158+
159+
/**
160+
* Searches for values of a specified facet attribute on the composition's main source's index. -
161+
* By default, facet values are sorted by decreasing count. You can adjust this with the
162+
* `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than
163+
* 65 searchable facets and searchable attributes combined**.
164+
*
165+
* @param compositionID Unique Composition ObjectID. (required)
166+
* @param facetName Facet attribute in which to search for values. This attribute must be included
167+
* in the `attributesForFaceting` index setting with the `searchable()` modifier. (required)
168+
* @param searchForFacetValuesRequest (optional)
169+
* @throws AlgoliaRuntimeException If it fails to process the API call
170+
*/
171+
public SearchForFacetValuesResponse searchForFacetValues(
172+
@Nonnull String compositionID,
173+
@Nonnull String facetName,
174+
SearchForFacetValuesRequest searchForFacetValuesRequest
175+
) throws AlgoliaRuntimeException {
176+
return this.searchForFacetValues(compositionID, facetName, searchForFacetValuesRequest, null);
177+
}
178+
179+
/**
180+
* Searches for values of a specified facet attribute on the composition's main source's index. -
181+
* By default, facet values are sorted by decreasing count. You can adjust this with the
182+
* `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than
183+
* 65 searchable facets and searchable attributes combined**.
184+
*
185+
* @param compositionID Unique Composition ObjectID. (required)
186+
* @param facetName Facet attribute in which to search for values. This attribute must be included
187+
* in the `attributesForFaceting` index setting with the `searchable()` modifier. (required)
188+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
189+
* the transporter requestOptions.
190+
* @throws AlgoliaRuntimeException If it fails to process the API call
191+
*/
192+
public SearchForFacetValuesResponse searchForFacetValues(
193+
@Nonnull String compositionID,
194+
@Nonnull String facetName,
195+
@Nullable RequestOptions requestOptions
196+
) throws AlgoliaRuntimeException {
197+
return this.searchForFacetValues(compositionID, facetName, null, requestOptions);
198+
}
199+
200+
/**
201+
* Searches for values of a specified facet attribute on the composition's main source's index. -
202+
* By default, facet values are sorted by decreasing count. You can adjust this with the
203+
* `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than
204+
* 65 searchable facets and searchable attributes combined**.
205+
*
206+
* @param compositionID Unique Composition ObjectID. (required)
207+
* @param facetName Facet attribute in which to search for values. This attribute must be included
208+
* in the `attributesForFaceting` index setting with the `searchable()` modifier. (required)
209+
* @throws AlgoliaRuntimeException If it fails to process the API call
210+
*/
211+
public SearchForFacetValuesResponse searchForFacetValues(@Nonnull String compositionID, @Nonnull String facetName)
212+
throws AlgoliaRuntimeException {
213+
return this.searchForFacetValues(compositionID, facetName, null, null);
214+
}
215+
216+
/**
217+
* (asynchronously) Searches for values of a specified facet attribute on the composition's main
218+
* source's index. - By default, facet values are sorted by decreasing count. You can adjust this
219+
* with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have
220+
* **more than 65 searchable facets and searchable attributes combined**.
221+
*
222+
* @param compositionID Unique Composition ObjectID. (required)
223+
* @param facetName Facet attribute in which to search for values. This attribute must be included
224+
* in the `attributesForFaceting` index setting with the `searchable()` modifier. (required)
225+
* @param searchForFacetValuesRequest (optional)
226+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
227+
* the transporter requestOptions.
228+
* @throws AlgoliaRuntimeException If it fails to process the API call
229+
*/
230+
public CompletableFuture<SearchForFacetValuesResponse> searchForFacetValuesAsync(
231+
@Nonnull String compositionID,
232+
@Nonnull String facetName,
233+
SearchForFacetValuesRequest searchForFacetValuesRequest,
234+
@Nullable RequestOptions requestOptions
235+
) throws AlgoliaRuntimeException {
236+
Parameters.requireNonNull(compositionID, "Parameter `compositionID` is required when calling `searchForFacetValues`.");
237+
238+
Parameters.requireNonNull(facetName, "Parameter `facetName` is required when calling `searchForFacetValues`.");
239+
240+
HttpRequest request = HttpRequest.builder()
241+
.setPath("/1/compositions/{compositionID}/facets/{facetName}/query", compositionID, facetName)
242+
.setMethod("POST")
243+
.setBody(searchForFacetValuesRequest)
244+
.setRead(true)
245+
.build();
246+
return executeAsync(request, requestOptions, new TypeReference<SearchForFacetValuesResponse>() {});
247+
}
248+
249+
/**
250+
* (asynchronously) Searches for values of a specified facet attribute on the composition's main
251+
* source's index. - By default, facet values are sorted by decreasing count. You can adjust this
252+
* with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have
253+
* **more than 65 searchable facets and searchable attributes combined**.
254+
*
255+
* @param compositionID Unique Composition ObjectID. (required)
256+
* @param facetName Facet attribute in which to search for values. This attribute must be included
257+
* in the `attributesForFaceting` index setting with the `searchable()` modifier. (required)
258+
* @param searchForFacetValuesRequest (optional)
259+
* @throws AlgoliaRuntimeException If it fails to process the API call
260+
*/
261+
public CompletableFuture<SearchForFacetValuesResponse> searchForFacetValuesAsync(
262+
@Nonnull String compositionID,
263+
@Nonnull String facetName,
264+
SearchForFacetValuesRequest searchForFacetValuesRequest
265+
) throws AlgoliaRuntimeException {
266+
return this.searchForFacetValuesAsync(compositionID, facetName, searchForFacetValuesRequest, null);
267+
}
268+
269+
/**
270+
* (asynchronously) Searches for values of a specified facet attribute on the composition's main
271+
* source's index. - By default, facet values are sorted by decreasing count. You can adjust this
272+
* with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have
273+
* **more than 65 searchable facets and searchable attributes combined**.
274+
*
275+
* @param compositionID Unique Composition ObjectID. (required)
276+
* @param facetName Facet attribute in which to search for values. This attribute must be included
277+
* in the `attributesForFaceting` index setting with the `searchable()` modifier. (required)
278+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
279+
* the transporter requestOptions.
280+
* @throws AlgoliaRuntimeException If it fails to process the API call
281+
*/
282+
public CompletableFuture<SearchForFacetValuesResponse> searchForFacetValuesAsync(
283+
@Nonnull String compositionID,
284+
@Nonnull String facetName,
285+
@Nullable RequestOptions requestOptions
286+
) throws AlgoliaRuntimeException {
287+
return this.searchForFacetValuesAsync(compositionID, facetName, null, requestOptions);
288+
}
289+
290+
/**
291+
* (asynchronously) Searches for values of a specified facet attribute on the composition's main
292+
* source's index. - By default, facet values are sorted by decreasing count. You can adjust this
293+
* with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have
294+
* **more than 65 searchable facets and searchable attributes combined**.
295+
*
296+
* @param compositionID Unique Composition ObjectID. (required)
297+
* @param facetName Facet attribute in which to search for values. This attribute must be included
298+
* in the `attributesForFaceting` index setting with the `searchable()` modifier. (required)
299+
* @throws AlgoliaRuntimeException If it fails to process the API call
300+
*/
301+
public CompletableFuture<SearchForFacetValuesResponse> searchForFacetValuesAsync(
302+
@Nonnull String compositionID,
303+
@Nonnull String facetName
304+
) throws AlgoliaRuntimeException {
305+
return this.searchForFacetValuesAsync(compositionID, facetName, null, null);
306+
}
307+
}

0 commit comments

Comments
 (0)