4
4
import com .algolia .search .models .HttpMethod ;
5
5
import com .algolia .search .models .RequestOptions ;
6
6
import com .algolia .search .models .common .CallType ;
7
+ import com .algolia .search .models .indexing .RecommendHit ;
7
8
import com .algolia .search .models .indexing .RecommendationsResult ;
8
- import com .algolia .search .models .recommend .FrequentlyBoughtTogetherQuery ;
9
- import com .algolia .search .models .recommend .GetRecommendationsResponse ;
10
- import com .algolia .search .models .recommend .RecommendationsQuery ;
11
- import com .algolia .search .models .recommend .RecommendationsRequests ;
12
- import com .algolia .search .models .recommend .RelatedProductsQuery ;
9
+ import com .algolia .search .models .recommend .*;
13
10
import java .io .Closeable ;
14
11
import java .io .IOException ;
15
12
import java .util .List ;
@@ -60,23 +57,13 @@ public SearchConfig getConfig() {
60
57
}
61
58
62
59
// region get_recommendations
63
- /**
64
- * Returns recommendations for a specific model and objectID.
65
- *
66
- * @param requests a list of recommendation requests to execute
67
- */
68
- public List <RecommendationsResult <Object >> getRecommendations (
69
- @ Nonnull List <RecommendationsQuery > requests ) {
70
- return LaunderThrowable .await (getRecommendationsAsync (requests ));
71
- }
72
-
73
60
/**
74
61
* Returns recommendations for a specific model and objectID.
75
62
*
76
63
* @param requests a list of recommendation requests to execute
77
64
* @param clazz The class held by the index. Could be your business object or {@link Object}
78
65
*/
79
- public <T > List <RecommendationsResult <T >> getRecommendations (
66
+ public <T extends RecommendHit > List <RecommendationsResult <T >> getRecommendations (
80
67
@ Nonnull List <RecommendationsQuery > requests , @ Nonnull Class <T > clazz ) {
81
68
return LaunderThrowable .await (getRecommendationsAsync (requests , clazz ));
82
69
}
@@ -88,31 +75,22 @@ public <T> List<RecommendationsResult<T>> getRecommendations(
88
75
* @param clazz The class held by the index. Could be your business object or {@link Object}
89
76
* @param requestOptions options to pass to this request
90
77
*/
91
- public <T > List <RecommendationsResult <T >> getRecommendations (
78
+ public <T extends RecommendHit > List <RecommendationsResult <T >> getRecommendations (
92
79
@ Nonnull List <RecommendationsQuery > requests ,
93
80
@ Nonnull Class <T > clazz ,
94
81
RequestOptions requestOptions ) {
95
82
return LaunderThrowable .await (getRecommendationsAsync (requests , clazz , requestOptions ));
96
83
}
97
84
98
- /**
99
- * Returns recommendations for a specific model and objectID.
100
- *
101
- * @param requests a list of recommendation requests to execute
102
- */
103
- public CompletableFuture <List <RecommendationsResult <Object >>> getRecommendationsAsync (
104
- @ Nonnull List <RecommendationsQuery > requests ) {
105
- return getRecommendationsAsync (requests , Object .class , null );
106
- }
107
-
108
85
/**
109
86
* Returns recommendations for a specific model and objectID.
110
87
*
111
88
* @param requests a list of recommendation requests to execute
112
89
* @param clazz The class held by the index. Could be your business object or {@link Object}
113
90
*/
114
- public <T > CompletableFuture <List <RecommendationsResult <T >>> getRecommendationsAsync (
115
- @ Nonnull List <RecommendationsQuery > requests , @ Nonnull Class <T > clazz ) {
91
+ public <T extends RecommendHit >
92
+ CompletableFuture <List <RecommendationsResult <T >>> getRecommendationsAsync (
93
+ @ Nonnull List <RecommendationsQuery > requests , @ Nonnull Class <T > clazz ) {
116
94
return getRecommendationsAsync (requests , clazz , null );
117
95
}
118
96
@@ -123,10 +101,11 @@ public <T> CompletableFuture<List<RecommendationsResult<T>>> getRecommendationsA
123
101
* @param clazz The class held by the index. Could be your business object or {@link Object}
124
102
* @param requestOptions options to pass to this request
125
103
*/
126
- public <T > CompletableFuture <List <RecommendationsResult <T >>> getRecommendationsAsync (
127
- @ Nonnull List <RecommendationsQuery > requests ,
128
- @ Nonnull Class <T > clazz ,
129
- RequestOptions requestOptions ) {
104
+ public <T extends RecommendHit >
105
+ CompletableFuture <List <RecommendationsResult <T >>> getRecommendationsAsync (
106
+ @ Nonnull List <RecommendationsQuery > requests ,
107
+ @ Nonnull Class <T > clazz ,
108
+ RequestOptions requestOptions ) {
130
109
Objects .requireNonNull (requests );
131
110
Objects .requireNonNull (clazz );
132
111
RecommendationsRequests <RecommendationsQuery > data = new RecommendationsRequests <>(requests );
@@ -135,23 +114,13 @@ public <T> CompletableFuture<List<RecommendationsResult<T>>> getRecommendationsA
135
114
// endregion
136
115
137
116
// region get_related_products
138
- /**
139
- * Returns related products recommendations for a specific model and objectID.
140
- *
141
- * @param requests a list of recommendation requests to execute
142
- */
143
- public List <RecommendationsResult <Object >> getRelatedProducts (
144
- @ Nonnull List <RelatedProductsQuery > requests ) {
145
- return LaunderThrowable .await (getRelatedProductsAsync (requests ));
146
- }
147
-
148
117
/**
149
118
* Returns related products recommendations for a specific model and objectID.
150
119
*
151
120
* @param requests a list of recommendation requests to execute
152
121
* @param clazz The class held by the index. Could be your business object or {@link Object}
153
122
*/
154
- public <T > List <RecommendationsResult <T >> getRelatedProducts (
123
+ public <T extends RecommendHit > List <RecommendationsResult <T >> getRelatedProducts (
155
124
@ Nonnull List <RelatedProductsQuery > requests , @ Nonnull Class <T > clazz ) {
156
125
return LaunderThrowable .await (getRelatedProductsAsync (requests , clazz ));
157
126
}
@@ -163,31 +132,22 @@ public <T> List<RecommendationsResult<T>> getRelatedProducts(
163
132
* @param clazz The class held by the index. Could be your business object or {@link Object}
164
133
* @param requestOptions options to pass to this request
165
134
*/
166
- public <T > List <RecommendationsResult <T >> getRelatedProducts (
135
+ public <T extends RecommendHit > List <RecommendationsResult <T >> getRelatedProducts (
167
136
@ Nonnull List <RelatedProductsQuery > requests ,
168
137
@ Nonnull Class <T > clazz ,
169
138
RequestOptions requestOptions ) {
170
139
return LaunderThrowable .await (getRelatedProductsAsync (requests , clazz , requestOptions ));
171
140
}
172
141
173
- /**
174
- * Returns related products recommendations for a specific model and objectID.
175
- *
176
- * @param requests a list of recommendation requests to execute
177
- */
178
- public CompletableFuture <List <RecommendationsResult <Object >>> getRelatedProductsAsync (
179
- @ Nonnull List <RelatedProductsQuery > requests ) {
180
- return getRelatedProductsAsync (requests , Object .class );
181
- }
182
-
183
142
/**
184
143
* Returns related products recommendations for a specific model and objectID.
185
144
*
186
145
* @param requests a list of recommendation requests to execute
187
146
* @param clazz The class held by the index. Could be your business object or {@link Object}
188
147
*/
189
- public <T > CompletableFuture <List <RecommendationsResult <T >>> getRelatedProductsAsync (
190
- @ Nonnull List <RelatedProductsQuery > requests , @ Nonnull Class <T > clazz ) {
148
+ public <T extends RecommendHit >
149
+ CompletableFuture <List <RecommendationsResult <T >>> getRelatedProductsAsync (
150
+ @ Nonnull List <RelatedProductsQuery > requests , @ Nonnull Class <T > clazz ) {
191
151
return getRelatedProductsAsync (requests , clazz , null );
192
152
}
193
153
@@ -198,10 +158,11 @@ public <T> CompletableFuture<List<RecommendationsResult<T>>> getRelatedProductsA
198
158
* @param clazz The class held by the index. Could be your business object or {@link Object}
199
159
* @param requestOptions options to pass to this request
200
160
*/
201
- public <T > CompletableFuture <List <RecommendationsResult <T >>> getRelatedProductsAsync (
202
- @ Nonnull List <RelatedProductsQuery > requests ,
203
- @ Nonnull Class <T > clazz ,
204
- RequestOptions requestOptions ) {
161
+ public <T extends RecommendHit >
162
+ CompletableFuture <List <RecommendationsResult <T >>> getRelatedProductsAsync (
163
+ @ Nonnull List <RelatedProductsQuery > requests ,
164
+ @ Nonnull Class <T > clazz ,
165
+ RequestOptions requestOptions ) {
205
166
Objects .requireNonNull (requests );
206
167
Objects .requireNonNull (clazz );
207
168
RecommendationsRequests <RelatedProductsQuery > data = new RecommendationsRequests <>(requests );
@@ -210,23 +171,13 @@ public <T> CompletableFuture<List<RecommendationsResult<T>>> getRelatedProductsA
210
171
// endregion
211
172
212
173
// region get_frequently_bought_together
213
- /**
214
- * Returns frequently bought together recommendations for a specific model and objectID.
215
- *
216
- * @param requests a list of recommendation requests to execute
217
- */
218
- public List <RecommendationsResult <Object >> getFrequentlyBoughtTogether (
219
- @ Nonnull List <FrequentlyBoughtTogetherQuery > requests ) {
220
- return LaunderThrowable .await (getFrequentlyBoughtTogetherAsync (requests ));
221
- }
222
-
223
174
/**
224
175
* Returns frequently bought together recommendations for a specific model and objectID.
225
176
*
226
177
* @param requests a list of recommendation requests to execute
227
178
* @param clazz The class held by the index. Could be your business object or {@link Object}
228
179
*/
229
- public <T > List <RecommendationsResult <T >> getFrequentlyBoughtTogether (
180
+ public <T extends RecommendHit > List <RecommendationsResult <T >> getFrequentlyBoughtTogether (
230
181
@ Nonnull List <FrequentlyBoughtTogetherQuery > requests , @ Nonnull Class <T > clazz ) {
231
182
return LaunderThrowable .await (getFrequentlyBoughtTogetherAsync (requests , clazz ));
232
183
}
@@ -238,32 +189,23 @@ public <T> List<RecommendationsResult<T>> getFrequentlyBoughtTogether(
238
189
* @param clazz The class held by the index. Could be your business object or {@link Object}
239
190
* @param requestOptions options to pass to this request
240
191
*/
241
- public <T > List <RecommendationsResult <T >> getFrequentlyBoughtTogether (
192
+ public <T extends RecommendHit > List <RecommendationsResult <T >> getFrequentlyBoughtTogether (
242
193
@ Nonnull List <FrequentlyBoughtTogetherQuery > requests ,
243
194
@ Nonnull Class <T > clazz ,
244
195
RequestOptions requestOptions ) {
245
196
return LaunderThrowable .await (
246
197
getFrequentlyBoughtTogetherAsync (requests , clazz , requestOptions ));
247
198
}
248
199
249
- /**
250
- * Returns frequently bought together recommendations for a specific model and objectID.
251
- *
252
- * @param requests a list of recommendation requests to execute
253
- */
254
- public CompletableFuture <List <RecommendationsResult <Object >>> getFrequentlyBoughtTogetherAsync (
255
- @ Nonnull List <FrequentlyBoughtTogetherQuery > requests ) {
256
- return getFrequentlyBoughtTogetherAsync (requests , Object .class , null );
257
- }
258
-
259
200
/**
260
201
* Returns frequently bought together recommendations for a specific model and objectID.
261
202
*
262
203
* @param requests a list of recommendation requests to execute
263
204
* @param clazz The class held by the index. Could be your business object or {@link Object}
264
205
*/
265
- public <T > CompletableFuture <List <RecommendationsResult <T >>> getFrequentlyBoughtTogetherAsync (
266
- @ Nonnull List <FrequentlyBoughtTogetherQuery > requests , @ Nonnull Class <T > clazz ) {
206
+ public <T extends RecommendHit >
207
+ CompletableFuture <List <RecommendationsResult <T >>> getFrequentlyBoughtTogetherAsync (
208
+ @ Nonnull List <FrequentlyBoughtTogetherQuery > requests , @ Nonnull Class <T > clazz ) {
267
209
return getFrequentlyBoughtTogetherAsync (requests , clazz , null );
268
210
}
269
211
@@ -274,10 +216,11 @@ public <T> CompletableFuture<List<RecommendationsResult<T>>> getFrequentlyBought
274
216
* @param clazz The class held by the index. Could be your business object or {@link Object}
275
217
* @param requestOptions options to pass to this request
276
218
*/
277
- public <T > CompletableFuture <List <RecommendationsResult <T >>> getFrequentlyBoughtTogetherAsync (
278
- @ Nonnull List <FrequentlyBoughtTogetherQuery > requests ,
279
- @ Nonnull Class <T > clazz ,
280
- RequestOptions requestOptions ) {
219
+ public <T extends RecommendHit >
220
+ CompletableFuture <List <RecommendationsResult <T >>> getFrequentlyBoughtTogetherAsync (
221
+ @ Nonnull List <FrequentlyBoughtTogetherQuery > requests ,
222
+ @ Nonnull Class <T > clazz ,
223
+ RequestOptions requestOptions ) {
281
224
Objects .requireNonNull (requests );
282
225
Objects .requireNonNull (clazz );
283
226
RecommendationsRequests <FrequentlyBoughtTogetherQuery > data =
@@ -287,8 +230,9 @@ public <T> CompletableFuture<List<RecommendationsResult<T>>> getFrequentlyBought
287
230
// endregion
288
231
289
232
@ SuppressWarnings ("unchecked" )
290
- private <T > CompletableFuture <List <RecommendationsResult <T >>> performGetRecommends (
291
- Class <T > clazz , RequestOptions requestOptions , RecommendationsRequests <?> data ) {
233
+ private <T extends RecommendHit >
234
+ CompletableFuture <List <RecommendationsResult <T >>> performGetRecommends (
235
+ Class <T > clazz , RequestOptions requestOptions , RecommendationsRequests <?> data ) {
292
236
return transport
293
237
.executeRequestAsync (
294
238
HttpMethod .POST ,
0 commit comments