Skip to content

Commit 9c10b27

Browse files
committed
Support ListScenarios endpoint
1 parent de26026 commit 9c10b27

33 files changed

+452
-239
lines changed

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>5.0.0</version>
16+
<version>5.1.0</version>
1717
</dependency>
1818
```
1919

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

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

1414
<licenses>
1515
<license>
@@ -32,7 +32,7 @@
3232
<email>[email protected]</email>
3333
<url>https://github.com/OndraFiedler</url>
3434
<organization>Recombee</organization>
35-
<organizationUrl>http://recombee.com</organizationUrl>
35+
<organizationUrl>https://www.recombee.com</organizationUrl>
3636
</developer>
3737
</developers>
3838

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

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,20 @@
6767
import com.recombee.api_client.api_requests.ListUserViewPortions;
6868
import com.recombee.api_client.api_requests.RecommendItemsToUser;
6969
import com.recombee.api_client.api_requests.RecommendItemsToItem;
70+
import com.recombee.api_client.api_requests.RecommendItemsToItemSegment;
7071
import com.recombee.api_client.api_requests.RecommendNextItems;
7172
import com.recombee.api_client.api_requests.RecommendUsersToUser;
7273
import com.recombee.api_client.api_requests.RecommendUsersToItem;
7374
import com.recombee.api_client.api_requests.RecommendItemSegmentsToUser;
7475
import com.recombee.api_client.api_requests.RecommendItemSegmentsToItem;
7576
import com.recombee.api_client.api_requests.RecommendItemSegmentsToItemSegment;
76-
import com.recombee.api_client.api_requests.RecommendItemsToItemSegment;
7777
import com.recombee.api_client.api_requests.SearchItems;
7878
import com.recombee.api_client.api_requests.SearchItemSegments;
7979
import com.recombee.api_client.api_requests.AddSearchSynonym;
8080
import com.recombee.api_client.api_requests.ListSearchSynonyms;
8181
import com.recombee.api_client.api_requests.ListSegmentations;
8282
import com.recombee.api_client.api_requests.GetSegmentation;
83+
import com.recombee.api_client.api_requests.ListScenarios;
8384

8485
/* End of the generated code */
8586
/**
@@ -96,7 +97,7 @@ public class RecombeeClient {
9697

9798
final int BATCH_MAX_SIZE = 10000; //Maximal number of requests within one batch request
9899

99-
final String USER_AGENT = "recombee-java-api-client/5.0.0";
100+
final String USER_AGENT = "recombee-java-api-client/5.1.0";
100101

101102
private final OkHttpClient httpClient = new OkHttpClient();
102103

@@ -372,7 +373,7 @@ public RecommendationResponse send(RecommendItemsToItem request) throws ApiExcep
372373
return null;
373374
}
374375

375-
public RecommendationResponse send(RecommendNextItems request) throws ApiException {
376+
public RecommendationResponse send(RecommendItemsToItemSegment request) throws ApiException {
376377
String responseStr = sendRequest(request);
377378
try {
378379
return this.mapper.readValue(responseStr, RecommendationResponse.class);
@@ -382,7 +383,7 @@ public RecommendationResponse send(RecommendNextItems request) throws ApiExcepti
382383
return null;
383384
}
384385

385-
public RecommendationResponse send(RecommendUsersToUser request) throws ApiException {
386+
public RecommendationResponse send(RecommendNextItems request) throws ApiException {
386387
String responseStr = sendRequest(request);
387388
try {
388389
return this.mapper.readValue(responseStr, RecommendationResponse.class);
@@ -392,7 +393,7 @@ public RecommendationResponse send(RecommendUsersToUser request) throws ApiExcep
392393
return null;
393394
}
394395

395-
public RecommendationResponse send(RecommendUsersToItem request) throws ApiException {
396+
public RecommendationResponse send(RecommendUsersToUser request) throws ApiException {
396397
String responseStr = sendRequest(request);
397398
try {
398399
return this.mapper.readValue(responseStr, RecommendationResponse.class);
@@ -402,7 +403,7 @@ public RecommendationResponse send(RecommendUsersToItem request) throws ApiExcep
402403
return null;
403404
}
404405

405-
public RecommendationResponse send(RecommendItemSegmentsToUser request) throws ApiException {
406+
public RecommendationResponse send(RecommendUsersToItem request) throws ApiException {
406407
String responseStr = sendRequest(request);
407408
try {
408409
return this.mapper.readValue(responseStr, RecommendationResponse.class);
@@ -412,7 +413,7 @@ public RecommendationResponse send(RecommendItemSegmentsToUser request) throws A
412413
return null;
413414
}
414415

415-
public RecommendationResponse send(RecommendItemSegmentsToItem request) throws ApiException {
416+
public RecommendationResponse send(RecommendItemSegmentsToUser request) throws ApiException {
416417
String responseStr = sendRequest(request);
417418
try {
418419
return this.mapper.readValue(responseStr, RecommendationResponse.class);
@@ -422,7 +423,7 @@ public RecommendationResponse send(RecommendItemSegmentsToItem request) throws A
422423
return null;
423424
}
424425

425-
public RecommendationResponse send(RecommendItemSegmentsToItemSegment request) throws ApiException {
426+
public RecommendationResponse send(RecommendItemSegmentsToItem request) throws ApiException {
426427
String responseStr = sendRequest(request);
427428
try {
428429
return this.mapper.readValue(responseStr, RecommendationResponse.class);
@@ -432,7 +433,7 @@ public RecommendationResponse send(RecommendItemSegmentsToItemSegment request) t
432433
return null;
433434
}
434435

435-
public RecommendationResponse send(RecommendItemsToItemSegment request) throws ApiException {
436+
public RecommendationResponse send(RecommendItemSegmentsToItemSegment request) throws ApiException {
436437
String responseStr = sendRequest(request);
437438
try {
438439
return this.mapper.readValue(responseStr, RecommendationResponse.class);
@@ -502,6 +503,16 @@ public Segmentation send(GetSegmentation request) throws ApiException {
502503
return null;
503504
}
504505

506+
public Scenario[] send(ListScenarios request) throws ApiException {
507+
String responseStr = sendRequest(request);
508+
try {
509+
return this.mapper.readValue(responseStr, Scenario[].class);
510+
} catch (IOException e) {
511+
e.printStackTrace();
512+
}
513+
return null;
514+
}
515+
505516
/* End of the generated code */
506517

507518
public BatchResponse[] send(Batch batchRequest) throws ApiException {
@@ -748,6 +759,14 @@ else if (request instanceof GetSegmentation)
748759
Map<String, Object> obj = (Map<String, Object>) parsedResponse;
749760
parsedResponse = new Segmentation(obj);
750761
}
762+
763+
else if (request instanceof ListScenarios)
764+
{
765+
ArrayList<Map<String, Object>> array = (ArrayList<Map<String, Object>>) parsedResponse;
766+
Scenario[] ar = new Scenario[array.size()];
767+
for(int j=0;j<ar.length;j++) ar[j] = new Scenario(array.get(j));
768+
parsedResponse = ar;
769+
}
751770
/* End of the generated code */
752771
}
753772

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

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

1414
/**
1515
* Adds a new Segment into a Manual ReQL Segmentation.
16-
* The new Segment is defined by a [ReQL](https://docs.recombee.com/reql.html) filter that returns `true` for an item in case that this item belongs to the segment.
16+
* The new Segment is defined by a [ReQL](https://docs.recombee.com/reql) filter that returns `true` for an item in case that this item belongs to the segment.
1717
*/
1818
public class AddManualReqlSegment extends Request {
1919

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import com.recombee.api_client.util.HTTPMethod;
1313

1414
/**
15-
* Adds a new synonym for the [Search items](https://docs.recombee.com/api.html#search-items).
15+
* Adds a new synonym for the [Search items](https://docs.recombee.com/api#search-items).
1616
* When the `term` is used in the search query, the `synonym` is also used for the full-text search.
1717
* Unless `oneWay=true`, it works also in the opposite way (`synonym` -&gt; `term`).
1818
* An example of a synonym can be `science fiction` for the term `sci-fi`.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import com.recombee.api_client.util.HTTPMethod;
1313

1414
/**
15-
* Segment the items using a [ReQL](https://docs.recombee.com/reql.html) expression.
15+
* Segment the items using a [ReQL](https://docs.recombee.com/reql) expression.
1616
* For each item, the expression should return a set that contains IDs of segments to which the item belongs to.
1717
*/
1818
public class CreateAutoReqlSegmentation extends Request {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import com.recombee.api_client.util.HTTPMethod;
1313

1414
/**
15-
* Segment the items using multiple [ReQL](https://docs.recombee.com/reql.html) filters.
15+
* Segment the items using multiple [ReQL](https://docs.recombee.com/reql) filters.
1616
* Use the Add Manual ReQL Items Segment endpoint to create the individual segments.
1717
*/
1818
public class CreateManualReqlSegmentation extends Request {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* Deletes an item of the given `itemId` from the catalog.
1616
* If there are any *purchases*, *ratings*, *bookmarks*, *cart additions*, or *detail views* of the item present in the database, they will be deleted in cascade as well. Also, if the item is present in some *series*, it will be removed from all the *series* where present.
17-
* If an item becomes obsolete/no longer available, it is meaningful to keep it in the catalog (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql.html) instead of deleting the item completely.
17+
* If an item becomes obsolete/no longer available, it is meaningful to keep it in the catalog (along with all the interaction data, which are very useful), and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql) instead of deleting the item completely.
1818
*/
1919
public class DeleteItem extends Request {
2020

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313

1414
/**
1515
* Deletes all the items that pass the filter.
16-
* If an item becomes obsolete/no longer available, it is meaningful to **keep it in the catalog** (along with all the interaction data, which are very useful) and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql.html) instead of deleting the item completely.
16+
* If an item becomes obsolete/no longer available, it is meaningful to **keep it in the catalog** (along with all the interaction data, which are very useful) and **only exclude the item from recommendations**. In such a case, use [ReQL filter](https://docs.recombee.com/reql) instead of deleting the item completely.
1717
*/
1818
public class DeleteMoreItems extends Request {
1919

2020
/**
21-
* A [ReQL](https://docs.recombee.com/reql.html) expression, which returns `true` for the items that shall be updated.
21+
* A [ReQL](https://docs.recombee.com/reql) expression, which returns `true` for the items that shall be updated.
2222
*/
2323
protected String filter;
2424

2525
/**
2626
* Construct the request
27-
* @param filter A [ReQL](https://docs.recombee.com/reql.html) expression, which returns `true` for the items that shall be updated.
27+
* @param filter A [ReQL](https://docs.recombee.com/reql) expression, which returns `true` for the items that shall be updated.
2828
*/
2929
public DeleteMoreItems (String filter) {
3030
this.filter = filter;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import com.recombee.api_client.util.HTTPMethod;
1313

1414
/**
15-
* Deletes synonym of the given `id`. This synonym is no longer taken into account in the [Search items](https://docs.recombee.com/api.html#search-items).
15+
* Deletes synonym of the given `id`. This synonym is no longer taken into account in the [Search items](https://docs.recombee.com/api#search-items).
1616
*/
1717
public class DeleteSearchSynonym extends Request {
1818

0 commit comments

Comments
 (0)