Skip to content

Commit 7fbf189

Browse files
committed
additionalData for interactions, returnAbGroup for recommendation endpoints
1 parent f810f2d commit 7fbf189

32 files changed

+312
-22
lines changed

README.md

+1-1
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>2.2.2</version>
16+
<version>2.3.0</version>
1717
</dependency>
1818
```
1919

pom.xml

+1-1
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>2.2.2</version>
9+
<version>2.3.0</version>
1010
<name>Recombee API Client</name>
1111
<description>A client library for easy use of the Recombee recommendation API</description>
1212
<url>http://recombee.com</url>

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class RecombeeClient {
8585

8686
final int BATCH_MAX_SIZE = 10000; //Maximal number of requests within one batch request
8787

88-
final String USER_AGENT = "recombee-java-api-client/2.2.2";
88+
final String USER_AGENT = "recombee-java-api-client/2.3.0";
8989

9090
private final OkHttpClient httpClient = new OkHttpClient();
9191

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

+19
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public class AddBookmark extends Request {
3535
* If this bookmark is based on a recommendation request, `recommId` is the id of the clicked recommendation.
3636
*/
3737
protected String recommId;
38+
/**
39+
* A dictionary of additional data for the interaction.
40+
*/
41+
protected Map<String, Object> additionalData;
3842

3943
/**
4044
* Construct the request
@@ -71,6 +75,14 @@ public AddBookmark setRecommId(String recommId) {
7175
return this;
7276
}
7377

78+
/**
79+
* @param additionalData A dictionary of additional data for the interaction.
80+
*/
81+
public AddBookmark setAdditionalData(Map<String, Object> additionalData) {
82+
this.additionalData = additionalData;
83+
return this;
84+
}
85+
7486
public String getUserId() {
7587
return this.userId;
7688
}
@@ -92,6 +104,10 @@ public String getRecommId() {
92104
return this.recommId;
93105
}
94106

107+
public Map<String, Object> getAdditionalData() {
108+
return this.additionalData;
109+
}
110+
95111
/**
96112
* @return Used HTTP method
97113
*/
@@ -136,6 +152,9 @@ public Map<String, Object> getBodyParameters() {
136152
if (this.recommId!=null) {
137153
params.put("recommId", this.recommId);
138154
}
155+
if (this.additionalData!=null) {
156+
params.put("additionalData", this.additionalData);
157+
}
139158
return params;
140159
}
141160

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

+19
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public class AddCartAddition extends Request {
4343
* If this cart addition is based on a recommendation request, `recommId` is the id of the clicked recommendation.
4444
*/
4545
protected String recommId;
46+
/**
47+
* A dictionary of additional data for the interaction.
48+
*/
49+
protected Map<String, Object> additionalData;
4650

4751
/**
4852
* Construct the request
@@ -95,6 +99,14 @@ public AddCartAddition setRecommId(String recommId) {
9599
return this;
96100
}
97101

102+
/**
103+
* @param additionalData A dictionary of additional data for the interaction.
104+
*/
105+
public AddCartAddition setAdditionalData(Map<String, Object> additionalData) {
106+
this.additionalData = additionalData;
107+
return this;
108+
}
109+
98110
public String getUserId() {
99111
return this.userId;
100112
}
@@ -124,6 +136,10 @@ public String getRecommId() {
124136
return this.recommId;
125137
}
126138

139+
public Map<String, Object> getAdditionalData() {
140+
return this.additionalData;
141+
}
142+
127143
/**
128144
* @return Used HTTP method
129145
*/
@@ -174,6 +190,9 @@ public Map<String, Object> getBodyParameters() {
174190
if (this.recommId!=null) {
175191
params.put("recommId", this.recommId);
176192
}
193+
if (this.additionalData!=null) {
194+
params.put("additionalData", this.additionalData);
195+
}
177196
return params;
178197
}
179198

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

+19
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public class AddDetailView extends Request {
3939
* If this detail view is based on a recommendation request, `recommId` is the id of the clicked recommendation.
4040
*/
4141
protected String recommId;
42+
/**
43+
* A dictionary of additional data for the interaction.
44+
*/
45+
protected Map<String, Object> additionalData;
4246

4347
/**
4448
* Construct the request
@@ -83,6 +87,14 @@ public AddDetailView setRecommId(String recommId) {
8387
return this;
8488
}
8589

90+
/**
91+
* @param additionalData A dictionary of additional data for the interaction.
92+
*/
93+
public AddDetailView setAdditionalData(Map<String, Object> additionalData) {
94+
this.additionalData = additionalData;
95+
return this;
96+
}
97+
8698
public String getUserId() {
8799
return this.userId;
88100
}
@@ -108,6 +120,10 @@ public String getRecommId() {
108120
return this.recommId;
109121
}
110122

123+
public Map<String, Object> getAdditionalData() {
124+
return this.additionalData;
125+
}
126+
111127
/**
112128
* @return Used HTTP method
113129
*/
@@ -155,6 +171,9 @@ public Map<String, Object> getBodyParameters() {
155171
if (this.recommId!=null) {
156172
params.put("recommId", this.recommId);
157173
}
174+
if (this.additionalData!=null) {
175+
params.put("additionalData", this.additionalData);
176+
}
158177
return params;
159178
}
160179

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

+19
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public class AddPurchase extends Request {
4747
* If this purchase is based on a recommendation request, `recommId` is the id of the clicked recommendation.
4848
*/
4949
protected String recommId;
50+
/**
51+
* A dictionary of additional data for the interaction.
52+
*/
53+
protected Map<String, Object> additionalData;
5054

5155
/**
5256
* Construct the request
@@ -107,6 +111,14 @@ public AddPurchase setRecommId(String recommId) {
107111
return this;
108112
}
109113

114+
/**
115+
* @param additionalData A dictionary of additional data for the interaction.
116+
*/
117+
public AddPurchase setAdditionalData(Map<String, Object> additionalData) {
118+
this.additionalData = additionalData;
119+
return this;
120+
}
121+
110122
public String getUserId() {
111123
return this.userId;
112124
}
@@ -140,6 +152,10 @@ public String getRecommId() {
140152
return this.recommId;
141153
}
142154

155+
public Map<String, Object> getAdditionalData() {
156+
return this.additionalData;
157+
}
158+
143159
/**
144160
* @return Used HTTP method
145161
*/
@@ -193,6 +209,9 @@ public Map<String, Object> getBodyParameters() {
193209
if (this.recommId!=null) {
194210
params.put("recommId", this.recommId);
195211
}
212+
if (this.additionalData!=null) {
213+
params.put("additionalData", this.additionalData);
214+
}
196215
return params;
197216
}
198217

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

+19
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public class AddRating extends Request {
3939
* If this rating is based on a recommendation request, `recommId` is the id of the clicked recommendation.
4040
*/
4141
protected String recommId;
42+
/**
43+
* A dictionary of additional data for the interaction.
44+
*/
45+
protected Map<String, Object> additionalData;
4246

4347
/**
4448
* Construct the request
@@ -77,6 +81,14 @@ public AddRating setRecommId(String recommId) {
7781
return this;
7882
}
7983

84+
/**
85+
* @param additionalData A dictionary of additional data for the interaction.
86+
*/
87+
public AddRating setAdditionalData(Map<String, Object> additionalData) {
88+
this.additionalData = additionalData;
89+
return this;
90+
}
91+
8092
public String getUserId() {
8193
return this.userId;
8294
}
@@ -102,6 +114,10 @@ public String getRecommId() {
102114
return this.recommId;
103115
}
104116

117+
public Map<String, Object> getAdditionalData() {
118+
return this.additionalData;
119+
}
120+
105121
/**
106122
* @return Used HTTP method
107123
*/
@@ -147,6 +163,9 @@ public Map<String, Object> getBodyParameters() {
147163
if (this.recommId!=null) {
148164
params.put("recommId", this.recommId);
149165
}
166+
if (this.additionalData!=null) {
167+
params.put("additionalData", this.additionalData);
168+
}
150169
return params;
151170
}
152171

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

+21
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/**
1414
* Recommends set of items that are somehow related to one given item, *X*. Typical scenario is when user *A* is viewing *X*. Then you may display items to the user that he might be also interested in. Recommend items to item request gives you Top-N such items, optionally taking the target user *A* into account.
1515
* It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
16+
* The returned items are sorted by relevancy (first item being the most relevant).
1617
*/
1718
public class RecommendItemsToItem extends Request {
1819

@@ -138,6 +139,10 @@ public class RecommendItemsToItem extends Request {
138139
* Dictionary of custom options.
139140
*/
140141
protected Map<String, Object> expertSettings;
142+
/**
143+
* If there is a custom AB-testing running, return name of group to which the request belongs.
144+
*/
145+
protected Boolean returnAbGroup;
141146

142147
/**
143148
* Construct the request
@@ -310,6 +315,14 @@ public RecommendItemsToItem setExpertSettings(Map<String, Object> expertSettings
310315
return this;
311316
}
312317

318+
/**
319+
* @param returnAbGroup If there is a custom AB-testing running, return name of group to which the request belongs.
320+
*/
321+
public RecommendItemsToItem setReturnAbGroup(boolean returnAbGroup) {
322+
this.returnAbGroup = returnAbGroup;
323+
return this;
324+
}
325+
313326
public String getItemId() {
314327
return this.itemId;
315328
}
@@ -372,6 +385,11 @@ public Map<String, Object> getExpertSettings() {
372385
return this.expertSettings;
373386
}
374387

388+
public boolean getReturnAbGroup() {
389+
if (this.returnAbGroup==null) return false;
390+
return this.returnAbGroup;
391+
}
392+
375393
/**
376394
* @return Used HTTP method
377395
*/
@@ -443,6 +461,9 @@ public Map<String, Object> getBodyParameters() {
443461
if (this.expertSettings!=null) {
444462
params.put("expertSettings", this.expertSettings);
445463
}
464+
if (this.returnAbGroup!=null) {
465+
params.put("returnAbGroup", this.returnAbGroup);
466+
}
446467
return params;
447468
}
448469

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

+21
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/**
1414
* Based on user's past interactions (purchases, ratings, etc.) with the items, recommends top-N items that are most likely to be of high value for a given user.
1515
* It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
16+
* The returned items are sorted by relevancy (first item being the most relevant).
1617
*/
1718
public class RecommendItemsToUser extends Request {
1819

@@ -118,6 +119,10 @@ public class RecommendItemsToUser extends Request {
118119
* Dictionary of custom options.
119120
*/
120121
protected Map<String, Object> expertSettings;
122+
/**
123+
* If there is a custom AB-testing running, return name of group to which the request belongs.
124+
*/
125+
protected Boolean returnAbGroup;
121126

122127
/**
123128
* Construct the request
@@ -268,6 +273,14 @@ public RecommendItemsToUser setExpertSettings(Map<String, Object> expertSettings
268273
return this;
269274
}
270275

276+
/**
277+
* @param returnAbGroup If there is a custom AB-testing running, return name of group to which the request belongs.
278+
*/
279+
public RecommendItemsToUser setReturnAbGroup(boolean returnAbGroup) {
280+
this.returnAbGroup = returnAbGroup;
281+
return this;
282+
}
283+
271284
public String getUserId() {
272285
return this.userId;
273286
}
@@ -322,6 +335,11 @@ public Map<String, Object> getExpertSettings() {
322335
return this.expertSettings;
323336
}
324337

338+
public boolean getReturnAbGroup() {
339+
if (this.returnAbGroup==null) return false;
340+
return this.returnAbGroup;
341+
}
342+
325343
/**
326344
* @return Used HTTP method
327345
*/
@@ -389,6 +407,9 @@ public Map<String, Object> getBodyParameters() {
389407
if (this.expertSettings!=null) {
390408
params.put("expertSettings", this.expertSettings);
391409
}
410+
if (this.returnAbGroup!=null) {
411+
params.put("returnAbGroup", this.returnAbGroup);
412+
}
392413
return params;
393414
}
394415

0 commit comments

Comments
 (0)