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

Source Code for Module recombee_api_client.api_requests.add_bookmark

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