diff --git a/README.md b/README.md index d34fe05..8f8217c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The client is available in the [Maven Central Repository](https://mvnrepository. com.recombee api-client - 2.0.1 + 2.1.0 ``` @@ -90,22 +90,24 @@ import java.util.Random; public class ItemPropertiesExample { public static void main(String[] args) { - RecombeeClient client = new RecombeeClient("client-test", "jGGQ6ZKa8rQ1zTAyxTc0EMn55YPF7FJLUtaMLhbsGxmvwxgTwXYqmUk5xVZFw98L"); + RecombeeClient client = new RecombeeClient("--my-database-id--", "--my-secret-token--"); try { client.send(new ResetDatabase()); //Clear everything from the database /* We will use computers as items in this example - Computers have three properties + Computers have four properties - price (floating point number) - number of processor cores (integer number) - description (string) + - image (url of computer's photo) */ client.send(new AddItemProperty("price", "double")); client.send(new AddItemProperty("num-cores", "int")); client.send(new AddItemProperty("description", "string")); + client.send(new AddItemProperty("image", "image")); // Prepare requests for setting a catalog of computers final ArrayList requests = new ArrayList(); @@ -114,13 +116,15 @@ public class ItemPropertiesExample { for(int i=0; i() {{ put("price", 600.0 + 400*rand.nextDouble()); put("num-cores", 1 + rand.nextInt(7)); put("description", "Great computer"); + put("image", String.format("http://examplesite.com/products/%s.jpg", itemId)); }} ).setCascadeCreate(true); // Use cascadeCreate for creating item // with given itemId, if it doesn't exist; diff --git a/pom.xml b/pom.xml index 0e49aa8..af4f186 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.recombee api-client - 2.0.1 + 2.1.0 Recombee API Client A client library for easy use of the Recombee recommendation API http://recombee.com diff --git a/src/main/java/com/recombee/api_client/RecombeeClient.java b/src/main/java/com/recombee/api_client/RecombeeClient.java index ff9863e..b73f364 100644 --- a/src/main/java/com/recombee/api_client/RecombeeClient.java +++ b/src/main/java/com/recombee/api_client/RecombeeClient.java @@ -85,7 +85,7 @@ public class RecombeeClient { final int BATCH_MAX_SIZE = 10000; //Maximal number of requests within one batch request - final String USER_AGENT = "recombee-java-api-client/2.0.1"; + final String USER_AGENT = "recombee-java-api-client/2.1.0"; private final OkHttpClient httpClient = new OkHttpClient(); diff --git a/src/main/java/com/recombee/api_client/api_requests/AddItemProperty.java b/src/main/java/com/recombee/api_client/api_requests/AddItemProperty.java index 8954f16..bcf73d0 100644 --- a/src/main/java/com/recombee/api_client/api_requests/AddItemProperty.java +++ b/src/main/java/com/recombee/api_client/api_requests/AddItemProperty.java @@ -20,14 +20,14 @@ public class AddItemProperty extends Request { */ protected String propertyName; /** - * Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set` + * Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`. */ protected String type; /** * Construct the request * @param propertyName Name of the item property to be created. Currently, the following names are reserved:`id`, `itemid`, case insensitively. Also, the length of the property name must not exceed 63 characters. - * @param type Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set` + * @param type Value type of the item property to be created. One of: `int`, `double`, `string`, `boolean`, `timestamp`, `set`, `image` or `imageList`. */ public AddItemProperty (String propertyName,String type) { this.propertyName = propertyName; diff --git a/src/main/java/com/recombee/api_client/api_requests/DeleteViewPortion.java b/src/main/java/com/recombee/api_client/api_requests/DeleteViewPortion.java index 7d29762..661c96d 100644 --- a/src/main/java/com/recombee/api_client/api_requests/DeleteViewPortion.java +++ b/src/main/java/com/recombee/api_client/api_requests/DeleteViewPortion.java @@ -11,7 +11,6 @@ import com.recombee.api_client.util.HTTPMethod; /** - * The view portions feature is currently experimental. * Deletes an existing view portion specified by (`userId`, `itemId`, `sessionId`) from the database. */ public class DeleteViewPortion extends Request { diff --git a/src/main/java/com/recombee/api_client/api_requests/ItemBasedRecommendation.java b/src/main/java/com/recombee/api_client/api_requests/ItemBasedRecommendation.java index d862f43..e767c78 100644 --- a/src/main/java/com/recombee/api_client/api_requests/ItemBasedRecommendation.java +++ b/src/main/java/com/recombee/api_client/api_requests/ItemBasedRecommendation.java @@ -110,11 +110,11 @@ public class ItemBasedRecommendation extends Request { */ protected String minRelevance; /** - * **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. + * **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.01`. */ protected Double rotationRate; /** - * **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. + * **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`. */ protected Double rotationTime; /** @@ -261,7 +261,7 @@ public ItemBasedRecommendation setMinRelevance(String minRelevance) { } /** - * @param rotationRate **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. + * @param rotationRate **Expert option** If the *targetUserId* is provided: If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.01`. */ public ItemBasedRecommendation setRotationRate(double rotationRate) { this.rotationRate = rotationRate; @@ -269,7 +269,7 @@ public ItemBasedRecommendation setRotationRate(double rotationRate) { } /** - * @param rotationTime **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. + * @param rotationTime **Expert option** If the *targetUserId* is provided: Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`. */ public ItemBasedRecommendation setRotationTime(double rotationTime) { this.rotationTime = rotationTime; diff --git a/src/main/java/com/recombee/api_client/api_requests/ListItemViewPortions.java b/src/main/java/com/recombee/api_client/api_requests/ListItemViewPortions.java index f038dec..fd57eea 100644 --- a/src/main/java/com/recombee/api_client/api_requests/ListItemViewPortions.java +++ b/src/main/java/com/recombee/api_client/api_requests/ListItemViewPortions.java @@ -11,7 +11,6 @@ import com.recombee.api_client.util.HTTPMethod; /** - * The view portions feature is currently experimental. * List all the view portions of an item ever submitted by different users. */ public class ListItemViewPortions extends Request { diff --git a/src/main/java/com/recombee/api_client/api_requests/ListUserViewPortions.java b/src/main/java/com/recombee/api_client/api_requests/ListUserViewPortions.java index 1136e80..0007578 100644 --- a/src/main/java/com/recombee/api_client/api_requests/ListUserViewPortions.java +++ b/src/main/java/com/recombee/api_client/api_requests/ListUserViewPortions.java @@ -11,7 +11,6 @@ import com.recombee.api_client.util.HTTPMethod; /** - * The view portions feature is currently experimental. * List all the view portions ever submitted by a given user. */ public class ListUserViewPortions extends Request { diff --git a/src/main/java/com/recombee/api_client/api_requests/MergeUsers.java b/src/main/java/com/recombee/api_client/api_requests/MergeUsers.java index 231cd28..0e86134 100644 --- a/src/main/java/com/recombee/api_client/api_requests/MergeUsers.java +++ b/src/main/java/com/recombee/api_client/api_requests/MergeUsers.java @@ -17,11 +17,11 @@ public class MergeUsers extends Request { /** - * ID of the source user. + * ID of the targer user. */ protected String targetUserId; /** - * ID of the target user. + * ID of the source user. */ protected String sourceUserId; /** @@ -31,8 +31,8 @@ public class MergeUsers extends Request { /** * Construct the request - * @param targetUserId ID of the source user. - * @param sourceUserId ID of the target user. + * @param targetUserId ID of the targer user. + * @param sourceUserId ID of the source user. */ public MergeUsers (String targetUserId,String sourceUserId) { this.targetUserId = targetUserId; diff --git a/src/main/java/com/recombee/api_client/api_requests/RecommendItemsToUser.java b/src/main/java/com/recombee/api_client/api_requests/RecommendItemsToUser.java index bde3dd6..b5b8d1b 100644 --- a/src/main/java/com/recombee/api_client/api_requests/RecommendItemsToUser.java +++ b/src/main/java/com/recombee/api_client/api_requests/RecommendItemsToUser.java @@ -107,11 +107,11 @@ public class RecommendItemsToUser extends Request { */ protected String minRelevance; /** - * **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. + * **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.1`. */ protected Double rotationRate; /** - * **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. + * **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`. */ protected Double rotationTime; /** @@ -245,7 +245,7 @@ public RecommendItemsToUser setMinRelevance(String minRelevance) { } /** - * @param rotationRate **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. + * @param rotationRate **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.1`. */ public RecommendItemsToUser setRotationRate(double rotationRate) { this.rotationRate = rotationRate; @@ -253,7 +253,7 @@ public RecommendItemsToUser setRotationRate(double rotationRate) { } /** - * @param rotationTime **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. + * @param rotationTime **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`. */ public RecommendItemsToUser setRotationTime(double rotationTime) { this.rotationTime = rotationTime; diff --git a/src/main/java/com/recombee/api_client/api_requests/SetViewPortion.java b/src/main/java/com/recombee/api_client/api_requests/SetViewPortion.java index 3714aa7..f5e14d8 100644 --- a/src/main/java/com/recombee/api_client/api_requests/SetViewPortion.java +++ b/src/main/java/com/recombee/api_client/api_requests/SetViewPortion.java @@ -11,7 +11,6 @@ import com.recombee.api_client.util.HTTPMethod; /** - * The view portions feature is currently experimental. * Sets viewed portion of an item (for example a video or article) by a user (at a session). * If you send new request with the same (`userId`, `itemId`, `sessionId`), the portion gets updated. */ @@ -26,11 +25,11 @@ public class SetViewPortion extends Request { */ protected String itemId; /** - * Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). + * Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). It should be the really viewed part of the item, no matter seeking, so for example if the user seeked immediately to half of the item and then viewed 10% of the item, the `portion` should still be `0.1`. */ protected Double portion; /** - * Id of session in which the user viewed the item + * ID of session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc. depending on language). */ protected String sessionId; /** @@ -46,7 +45,7 @@ public class SetViewPortion extends Request { * Construct the request * @param userId User who viewed a portion of the item * @param itemId Viewed item - * @param portion Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). + * @param portion Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). It should be the really viewed part of the item, no matter seeking, so for example if the user seeked immediately to half of the item and then viewed 10% of the item, the `portion` should still be `0.1`. */ public SetViewPortion (String userId,String itemId,double portion) { this.userId = userId; @@ -56,7 +55,7 @@ public SetViewPortion (String userId,String itemId,double portion) { } /** - * @param sessionId Id of session in which the user viewed the item + * @param sessionId ID of session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc. depending on language). */ public SetViewPortion setSessionId(String sessionId) { this.sessionId = sessionId; diff --git a/src/main/java/com/recombee/api_client/api_requests/UserBasedRecommendation.java b/src/main/java/com/recombee/api_client/api_requests/UserBasedRecommendation.java index d783dea..43a575d 100644 --- a/src/main/java/com/recombee/api_client/api_requests/UserBasedRecommendation.java +++ b/src/main/java/com/recombee/api_client/api_requests/UserBasedRecommendation.java @@ -97,11 +97,11 @@ public class UserBasedRecommendation extends Request { */ protected String minRelevance; /** - * **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. + * **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.1`. */ protected Double rotationRate; /** - * **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. + * **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`. */ protected Double rotationTime; /** @@ -227,7 +227,7 @@ public UserBasedRecommendation setMinRelevance(String minRelevance) { } /** - * @param rotationRate **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. + * @param rotationRate **Expert option** If your users browse the system in real-time, it may easily happen that you wish to offer them recommendations multiple times. Here comes the question: how much should the recommendations change? Should they remain the same, or should they rotate? Recombee API allows you to control this per-request in backward fashion. You may penalize an item for being recommended in the near past. For the specific user, `rotationRate=1` means maximal rotation, `rotationRate=0` means absolutely no rotation. You may also use, for example `rotationRate=0.2` for only slight rotation of recommended items. Default: `0.1`. */ public UserBasedRecommendation setRotationRate(double rotationRate) { this.rotationRate = rotationRate; @@ -235,7 +235,7 @@ public UserBasedRecommendation setRotationRate(double rotationRate) { } /** - * @param rotationTime **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. + * @param rotationTime **Expert option** Taking *rotationRate* into account, specifies how long time it takes to an item to recover from the penalization. For example, `rotationTime=7200.0` means that items recommended less than 2 hours ago are penalized. Default: `7200.0`. */ public UserBasedRecommendation setRotationTime(double rotationTime) { this.rotationTime = rotationTime; diff --git a/src/main/java/com/recombee/api_client/bindings/ViewPortion.java b/src/main/java/com/recombee/api_client/bindings/ViewPortion.java index 10cd06b..f2cb73a 100644 --- a/src/main/java/com/recombee/api_client/bindings/ViewPortion.java +++ b/src/main/java/com/recombee/api_client/bindings/ViewPortion.java @@ -19,11 +19,11 @@ public class ViewPortion extends RecombeeBinding { */ protected String itemId; /** - * Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). + * Viewed portion of the item (number between 0.0 (viewed nothing) and 1.0 (viewed full item) ). It should be the really viewed part of the item, no matter seeking, so for example if the user seeked immediately to half of the item and then viewed 10% of the item, the `portion` should still be `0.1`. */ protected Double portion; /** - * Id of session in which the user viewed the item + * ID of session in which the user viewed the item. Default is `null` (`None`, `nil`, `NULL` etc. depending on language). */ protected String sessionId; /**