Skip to content

Commit 1d34c95

Browse files
committed
Release: v6.1.0
- Added support for `reqlExpressions` on recommended item segments
1 parent 407b44b commit 1d34c95

7 files changed

Lines changed: 335 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The client is available in the [Maven Central Repository](https://mvnrepository.
1313
<dependency>
1414
<groupId>com.recombee</groupId>
1515
<artifactId>api-client</artifactId>
16-
<version>6.0.0</version>
16+
<version>6.1.0</version>
1717
</dependency>
1818
```
1919

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.recombee</groupId>
88
<artifactId>api-client</artifactId>
9-
<version>6.0.0</version>
9+
<version>6.1.0</version>
1010
<name>Recombee API Client</name>
1111
<description>A client library for easy use of the Recombee recommendation API</description>
1212
<url>https://www.recombee.com</url>

src/main/java/com/recombee/api_client/RecombeeClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public class RecombeeClient {
9898

9999
final int BATCH_MAX_SIZE = 10000; //Maximal number of requests within one batch request
100100

101-
final String USER_AGENT = "recombee-java-api-client/6.0.0";
101+
final String USER_AGENT = "recombee-java-api-client/6.1.0";
102102

103103
private final OkHttpClient httpClient = new OkHttpClient();
104104

src/main/java/com/recombee/api_client/api_requests/RecommendItemSegmentsToItem.java

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,42 @@ public class RecommendItemSegmentsToItem extends Request {
8282
* If there is a custom AB-testing running, return the name of the group to which the request belongs.
8383
*/
8484
protected Boolean returnAbGroup;
85+
/**
86+
* A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
87+
* This can be used to compute additional properties of the recommended Item Segments.
88+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
89+
* Example request:
90+
* ```json
91+
* {
92+
* "reqlExpressions": {
93+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
94+
* }
95+
* }
96+
* ```
97+
* Example response:
98+
* ```json
99+
* {
100+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
101+
* "recomms":
102+
* [
103+
* {
104+
* "id": "category-fantasy-books",
105+
* "reqlEvaluations": {
106+
* "countItems": 486
107+
* }
108+
* },
109+
* {
110+
* "id": "category-sci-fi-costumes",
111+
* "reqlEvaluations": {
112+
* "countItems": 19
113+
* }
114+
* }
115+
* ],
116+
* "numberNextRecommsCalls": 0
117+
* }
118+
* ```
119+
*/
120+
protected Map<String, String> reqlExpressions;
85121

86122
/**
87123
* Construct the request
@@ -169,6 +205,46 @@ public RecommendItemSegmentsToItem setReturnAbGroup(boolean returnAbGroup) {
169205
return this;
170206
}
171207

208+
/**
209+
* @param reqlExpressions A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
210+
* This can be used to compute additional properties of the recommended Item Segments.
211+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
212+
* Example request:
213+
* ```json
214+
* {
215+
* "reqlExpressions": {
216+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
217+
* }
218+
* }
219+
* ```
220+
* Example response:
221+
* ```json
222+
* {
223+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
224+
* "recomms":
225+
* [
226+
* {
227+
* "id": "category-fantasy-books",
228+
* "reqlEvaluations": {
229+
* "countItems": 486
230+
* }
231+
* },
232+
* {
233+
* "id": "category-sci-fi-costumes",
234+
* "reqlEvaluations": {
235+
* "countItems": 19
236+
* }
237+
* }
238+
* ],
239+
* "numberNextRecommsCalls": 0
240+
* }
241+
* ```
242+
*/
243+
public RecommendItemSegmentsToItem setReqlExpressions(Map<String, String> reqlExpressions) {
244+
this.reqlExpressions = reqlExpressions;
245+
return this;
246+
}
247+
172248
public String getItemId() {
173249
return this.itemId;
174250
}
@@ -211,6 +287,10 @@ public boolean getReturnAbGroup() {
211287
return this.returnAbGroup;
212288
}
213289

290+
public Map<String, String> getReqlExpressions() {
291+
return this.reqlExpressions;
292+
}
293+
214294
/**
215295
* @return Used HTTP method
216296
*/
@@ -267,6 +347,9 @@ public Map<String, Object> getBodyParameters() {
267347
if (this.returnAbGroup!=null) {
268348
params.put("returnAbGroup", this.returnAbGroup);
269349
}
350+
if (this.reqlExpressions!=null) {
351+
params.put("reqlExpressions", this.reqlExpressions);
352+
}
270353
return params;
271354
}
272355

src/main/java/com/recombee/api_client/api_requests/RecommendItemSegmentsToItemSegment.java

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,42 @@ public class RecommendItemSegmentsToItemSegment extends Request {
8181
* If there is a custom AB-testing running, return the name of the group to which the request belongs.
8282
*/
8383
protected Boolean returnAbGroup;
84+
/**
85+
* A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
86+
* This can be used to compute additional properties of the recommended Item Segments.
87+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
88+
* Example request:
89+
* ```json
90+
* {
91+
* "reqlExpressions": {
92+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
93+
* }
94+
* }
95+
* ```
96+
* Example response:
97+
* ```json
98+
* {
99+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
100+
* "recomms":
101+
* [
102+
* {
103+
* "id": "category-fantasy-books",
104+
* "reqlEvaluations": {
105+
* "countItems": 486
106+
* }
107+
* },
108+
* {
109+
* "id": "category-sci-fi-costumes",
110+
* "reqlEvaluations": {
111+
* "countItems": 19
112+
* }
113+
* }
114+
* ],
115+
* "numberNextRecommsCalls": 0
116+
* }
117+
* ```
118+
*/
119+
protected Map<String, String> reqlExpressions;
84120

85121
/**
86122
* Construct the request
@@ -168,6 +204,46 @@ public RecommendItemSegmentsToItemSegment setReturnAbGroup(boolean returnAbGroup
168204
return this;
169205
}
170206

207+
/**
208+
* @param reqlExpressions A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
209+
* This can be used to compute additional properties of the recommended Item Segments.
210+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
211+
* Example request:
212+
* ```json
213+
* {
214+
* "reqlExpressions": {
215+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
216+
* }
217+
* }
218+
* ```
219+
* Example response:
220+
* ```json
221+
* {
222+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
223+
* "recomms":
224+
* [
225+
* {
226+
* "id": "category-fantasy-books",
227+
* "reqlEvaluations": {
228+
* "countItems": 486
229+
* }
230+
* },
231+
* {
232+
* "id": "category-sci-fi-costumes",
233+
* "reqlEvaluations": {
234+
* "countItems": 19
235+
* }
236+
* }
237+
* ],
238+
* "numberNextRecommsCalls": 0
239+
* }
240+
* ```
241+
*/
242+
public RecommendItemSegmentsToItemSegment setReqlExpressions(Map<String, String> reqlExpressions) {
243+
this.reqlExpressions = reqlExpressions;
244+
return this;
245+
}
246+
171247
public String getContextSegmentId() {
172248
return this.contextSegmentId;
173249
}
@@ -210,6 +286,10 @@ public boolean getReturnAbGroup() {
210286
return this.returnAbGroup;
211287
}
212288

289+
public Map<String, String> getReqlExpressions() {
290+
return this.reqlExpressions;
291+
}
292+
213293
/**
214294
* @return Used HTTP method
215295
*/
@@ -267,6 +347,9 @@ public Map<String, Object> getBodyParameters() {
267347
if (this.returnAbGroup!=null) {
268348
params.put("returnAbGroup", this.returnAbGroup);
269349
}
350+
if (this.reqlExpressions!=null) {
351+
params.put("reqlExpressions", this.reqlExpressions);
352+
}
270353
return params;
271354
}
272355

src/main/java/com/recombee/api_client/api_requests/RecommendItemSegmentsToUser.java

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,42 @@ public class RecommendItemSegmentsToUser extends Request {
6666
* If there is a custom AB-testing running, return the name of the group to which the request belongs.
6767
*/
6868
protected Boolean returnAbGroup;
69+
/**
70+
* A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
71+
* This can be used to compute additional properties of the recommended Item Segments.
72+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
73+
* Example request:
74+
* ```json
75+
* {
76+
* "reqlExpressions": {
77+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
78+
* }
79+
* }
80+
* ```
81+
* Example response:
82+
* ```json
83+
* {
84+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
85+
* "recomms":
86+
* [
87+
* {
88+
* "id": "category-fantasy-books",
89+
* "reqlEvaluations": {
90+
* "countItems": 486
91+
* }
92+
* },
93+
* {
94+
* "id": "category-sci-fi-costumes",
95+
* "reqlEvaluations": {
96+
* "countItems": 19
97+
* }
98+
* }
99+
* ],
100+
* "numberNextRecommsCalls": 0
101+
* }
102+
* ```
103+
*/
104+
protected Map<String, String> reqlExpressions;
69105

70106
/**
71107
* Construct the request
@@ -139,6 +175,46 @@ public RecommendItemSegmentsToUser setReturnAbGroup(boolean returnAbGroup) {
139175
return this;
140176
}
141177

178+
/**
179+
* @param reqlExpressions A dictionary of [ReQL](https://docs.recombee.com/reql) expressions that will be executed for each recommended Item Segment.
180+
* This can be used to compute additional properties of the recommended Item Segments.
181+
* The keys are the names of the expressions, and the values are the actual ReQL expressions.
182+
* Example request:
183+
* ```json
184+
* {
185+
* "reqlExpressions": {
186+
* "countItems": "size(segment_items(\"categories\", 'segmentId'))"
187+
* }
188+
* }
189+
* ```
190+
* Example response:
191+
* ```json
192+
* {
193+
* "recommId": "a7ac55a4-8d6e-4f19-addc-abac4164d8a8",
194+
* "recomms":
195+
* [
196+
* {
197+
* "id": "category-fantasy-books",
198+
* "reqlEvaluations": {
199+
* "countItems": 486
200+
* }
201+
* },
202+
* {
203+
* "id": "category-sci-fi-costumes",
204+
* "reqlEvaluations": {
205+
* "countItems": 19
206+
* }
207+
* }
208+
* ],
209+
* "numberNextRecommsCalls": 0
210+
* }
211+
* ```
212+
*/
213+
public RecommendItemSegmentsToUser setReqlExpressions(Map<String, String> reqlExpressions) {
214+
this.reqlExpressions = reqlExpressions;
215+
return this;
216+
}
217+
142218
public String getUserId() {
143219
return this.userId;
144220
}
@@ -177,6 +253,10 @@ public boolean getReturnAbGroup() {
177253
return this.returnAbGroup;
178254
}
179255

256+
public Map<String, String> getReqlExpressions() {
257+
return this.reqlExpressions;
258+
}
259+
180260
/**
181261
* @return Used HTTP method
182262
*/
@@ -232,6 +312,9 @@ public Map<String, Object> getBodyParameters() {
232312
if (this.returnAbGroup!=null) {
233313
params.put("returnAbGroup", this.returnAbGroup);
234314
}
315+
if (this.reqlExpressions!=null) {
316+
params.put("reqlExpressions", this.reqlExpressions);
317+
}
235318
return params;
236319
}
237320

0 commit comments

Comments
 (0)