API client release 4.0 contains backward incompatible changes.
This guide will help you upgrade your codebase.
Class Sorting
was renamed to ItemSorting
. All its methods and behavior remained the same.
$response = $matej->request()
->sorting(Sorting::create('user-id', ['item-id-1', 'item-id-2', 'item-id-3']))
->send();
$response = $matej->request()
->sorting(ItemSorting::create('user-id', ['item-id-1', 'item-id-2', 'item-id-3']))
->send();
API client now supports new types of recommendation commands:
- Recommend items to user (
UserItemRecommendation
, originallyUserRecommendation
) - Recommend users to user (
UserUserRecommendation
) - Recommend items to item (
ItemItemRecommendation
) - Recommend users to item (
ItemUserRecommendation
)
Each recommendation type supports different parameter options. Available parameters are documented in readme.
Class UserRecommendation
was renamed to UserItemRecommendation
. Class MinimalRelevance
was
renamed to ItemMinimalRelevance
. All other methods and attributes remained unchanged.
$recommendation = UserRecommendation::create('user-id', 'scenario')
->setMinimalRelevance(MinimalRelevance::LOW())
->setCount(5)
->setRotationRate(1.0)
->setRotationTime(3600);
$recommendation = UserItemRecommendation::create('user-id', 'scenario')
->setMinimalRelevance(ItemMinimalRelevance::LOW())
->setCount(5)
->setRotationRate(1.0)
->setRotationTime(3600);
New types of recommendations can be created in a similar way to UserItemRecommendation
. For example:
$recommendation = ItemUserRecommendation::create('item-id', 'scenario')
->setCount(5)
->setAllowSeen(false);
$recommendation = UserUserRecommendation::create('user-id', 'scenario')
->setCount(5)
->setRotationRate(1.0)
->setRotationTime(3600);
$recommendation = ItemItemRecommendation::create('item-id', 'scenario')
->setCount(5);