Package recombee_api_client :: Package api_requests :: Module add_detail_view
[hide private]
[frames] | no frames]

Source Code for Module recombee_api_client.api_requests.add_detail_view

 1  from recombee_api_client.api_requests.request import Request 
 2  import uuid 
 3   
 4  DEFAULT = uuid.uuid4() 
 5   
6 -class AddDetailView(Request):
7 """ 8 Adds a detail view of a given item made by a given user. 9 10 """ 11
12 - def __init__(self, user_id, item_id, timestamp=DEFAULT, duration=DEFAULT, cascade_create=DEFAULT, recomm_id=DEFAULT):
13 """ 14 Required parameters: 15 @param user_id: User who viewed the item 16 17 @param item_id: Viewed item 18 19 20 Optional parameters: 21 @param timestamp: UTC timestamp of the view as ISO8601-1 pattern or UTC epoch time. The default value is the current time. 22 23 @param duration: Duration of the view 24 25 @param cascade_create: Sets whether the given user/item should be created if not present in the database. 26 27 @param recomm_id: If this detail view is based on a recommendation request, `recommId` is the id of the clicked recommendation. 28 29 """ 30 self.user_id = user_id 31 self.item_id = item_id 32 self.timestamp = timestamp 33 self.duration = duration 34 self.cascade_create = cascade_create 35 self.recomm_id = recomm_id 36 self.timeout = 1000 37 self.ensure_https = False 38 self.method = 'post' 39 self.path = "/detailviews/" % ()
40
41 - def get_body_parameters(self):
42 """ 43 Values of body parameters as a dictionary (name of parameter: value of the parameter). 44 """ 45 p = dict() 46 p['userId'] = self.user_id 47 p['itemId'] = self.item_id 48 if self.timestamp is not DEFAULT: 49 p['timestamp'] = self.timestamp 50 if self.duration is not DEFAULT: 51 p['duration'] = self.duration 52 if self.cascade_create is not DEFAULT: 53 p['cascadeCreate'] = self.cascade_create 54 if self.recomm_id is not DEFAULT: 55 p['recommId'] = self.recomm_id 56 return p
57
58 - def get_query_parameters(self):
59 """ 60 Values of query parameters as a dictionary (name of parameter: value of the parameter). 61 """ 62 params = dict() 63 return params
64