recombee_api_client.api_requests.add_purchase module¶
-
class
recombee_api_client.api_requests.add_purchase.
AddPurchase
(user_id: str, item_id: str, timestamp: Union[str, int] = UUID('d3b4d741-6f04-4c81-a5e4-9cd99a46f70d'), cascade_create: bool = UUID('d3b4d741-6f04-4c81-a5e4-9cd99a46f70d'), amount: float = UUID('d3b4d741-6f04-4c81-a5e4-9cd99a46f70d'), price: float = UUID('d3b4d741-6f04-4c81-a5e4-9cd99a46f70d'), profit: float = UUID('d3b4d741-6f04-4c81-a5e4-9cd99a46f70d'), recomm_id: str = UUID('d3b4d741-6f04-4c81-a5e4-9cd99a46f70d'), additional_data: dict = UUID('d3b4d741-6f04-4c81-a5e4-9cd99a46f70d'))¶ Bases:
recombee_api_client.api_requests.request.Request
Adds a purchase of a given item made by a given user.
Required parameters:
- Parameters
user_id – User who purchased the item
item_id – Purchased item
Optional parameters:
- Parameters
timestamp – UTC timestamp of the purchase as ISO8601-1 pattern or UTC epoch time. The default value is the current time.
cascade_create – Sets whether the given user/item should be created if not present in the database.
amount – Amount (number) of purchased items. The default is 1. For example if user-x purchases two item-y during a single order (session…), the amount should equal to 2.
price – Price paid by the user for the item. If amount is greater than 1, sum of prices of all the items should be given.
profit – Your profit from the purchased item. The profit is natural in e-commerce domain (for example if user-x purchases item-y for $100 and the gross margin is 30 %, then the profit is $30), but is applicable also in other domains (for example at a news company it may be income from displayed advertisement on article page). If amount is greater than 1, sum of profit of all the items should be given.
recomm_id – If this purchase is based on a recommendation request, recommId is the id of the clicked recommendation.
additional_data – A dictionary of additional data for the interaction.
-
get_body_parameters
() → dict¶ Values of body parameters as a dictionary (name of parameter: value of the parameter).
-
get_query_parameters
() → dict¶ Values of query parameters as a dictionary (name of parameter: value of the parameter).