Skip to content

Commit

Permalink
Release: v5.0.0
Browse files Browse the repository at this point in the history
- Support new Recommend Items to Item Segment endpoint
- Series API improvements:
	- Add Series endpoint creates associated Item for the Series automatically (based on the cascadeCreate parameter)
	- Breaking change: Remove From Series no longer requires the time parameter
- Removed deprecated Groups endpoints
  • Loading branch information
OndraFiedler committed Jan 14, 2025
1 parent c7ab39b commit 5b56bae
Show file tree
Hide file tree
Showing 108 changed files with 608 additions and 580 deletions.
1 change: 1 addition & 0 deletions recombee_api_client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion recombee_api_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __get_base_uri(options: dict, region: str) -> str:

@staticmethod
def __get_http_headers(additional_headers: dict = None) -> dict:
headers = {'User-Agent': 'recombee-python-api-client/4.1.0'}
headers = {'User-Agent': 'recombee-python-api-client/5.0.0'}
if additional_headers:
headers.update(additional_headers)
return headers
Expand Down
7 changes: 1 addition & 6 deletions recombee_api_client/api_requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
from recombee_api_client.api_requests.list_series_items import ListSeriesItems
from recombee_api_client.api_requests.insert_to_series import InsertToSeries
from recombee_api_client.api_requests.remove_from_series import RemoveFromSeries
from recombee_api_client.api_requests.add_group import AddGroup
from recombee_api_client.api_requests.delete_group import DeleteGroup
from recombee_api_client.api_requests.list_groups import ListGroups
from recombee_api_client.api_requests.list_group_items import ListGroupItems
from recombee_api_client.api_requests.insert_to_group import InsertToGroup
from recombee_api_client.api_requests.remove_from_group import RemoveFromGroup
from recombee_api_client.api_requests.add_user import AddUser
from recombee_api_client.api_requests.delete_user import DeleteUser
from recombee_api_client.api_requests.set_user_values import SetUserValues
Expand Down Expand Up @@ -63,6 +57,7 @@
from recombee_api_client.api_requests.recommend_item_segments_to_user import RecommendItemSegmentsToUser
from recombee_api_client.api_requests.recommend_item_segments_to_item import RecommendItemSegmentsToItem
from recombee_api_client.api_requests.recommend_item_segments_to_item_segment import RecommendItemSegmentsToItemSegment
from recombee_api_client.api_requests.recommend_items_to_item_segment import RecommendItemsToItemSegment
from recombee_api_client.api_requests.search_items import SearchItems
from recombee_api_client.api_requests.search_item_segments import SearchItemSegments
from recombee_api_client.api_requests.add_search_synonym import AddSearchSynonym
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_bookmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AddBookmark(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT, cascade_create: bool = DEFAULT, recomm_id: str = DEFAULT, additional_data: dict = DEFAULT):
super().__init__(path="/bookmarks/", method='post', timeout=1000, ensure_https=False)
super().__init__(path="/bookmarks/", method='post', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_cart_addition.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AddCartAddition(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT, cascade_create: bool = DEFAULT, amount: float = DEFAULT, price: float = DEFAULT, recomm_id: str = DEFAULT, additional_data: dict = DEFAULT):
super().__init__(path="/cartadditions/", method='post', timeout=1000, ensure_https=False)
super().__init__(path="/cartadditions/", method='post', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_detail_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AddDetailView(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT, duration: int = DEFAULT, cascade_create: bool = DEFAULT, recomm_id: str = DEFAULT, additional_data: dict = DEFAULT):
super().__init__(path="/detailviews/", method='post', timeout=1000, ensure_https=False)
super().__init__(path="/detailviews/", method='post', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
33 changes: 0 additions & 33 deletions recombee_api_client/api_requests/add_group.py

This file was deleted.

2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AddItem(Request):
"""

def __init__(self, item_id: str):
super().__init__(path="/items/%s" % (item_id), method='put', timeout=1000, ensure_https=False)
super().__init__(path="/items/%s" % (item_id), method='put', timeout=3000, ensure_https=False)
self.item_id = item_id

def get_body_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_item_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class AddItemProperty(Request):
"""
Adding an item property is somehow equivalent to adding a column to the table of items. The items may be characterized by various properties of different types.
Adding an item property is somewhat equivalent to adding a column to the table of items. The items may be characterized by various properties of different types.
Required parameters:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AddPurchase(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT, cascade_create: bool = DEFAULT, amount: float = DEFAULT, price: float = DEFAULT, profit: float = DEFAULT, recomm_id: str = DEFAULT, additional_data: dict = DEFAULT):
super().__init__(path="/purchases/", method='post', timeout=1000, ensure_https=False)
super().__init__(path="/purchases/", method='post', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_rating.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AddRating(Request):
"""

def __init__(self, user_id: str, item_id: str, rating: float, timestamp: Union[str, int] = DEFAULT, cascade_create: bool = DEFAULT, recomm_id: str = DEFAULT, additional_data: dict = DEFAULT):
super().__init__(path="/ratings/", method='post', timeout=1000, ensure_https=False)
super().__init__(path="/ratings/", method='post', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.rating = rating
Expand Down
12 changes: 10 additions & 2 deletions recombee_api_client/api_requests/add_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,26 @@ class AddSeries(Request):
:param series_id: ID of the series to be created.
Optional parameters:
:param cascade_create: If set to `true`, the item will be created with the same ID as the series. Default is `true`.
"""

def __init__(self, series_id: str):
super().__init__(path="/series/%s" % (series_id), method='put', timeout=1000, ensure_https=False)
def __init__(self, series_id: str, cascade_create: bool = DEFAULT):
super().__init__(path="/series/%s" % (series_id), method='put', timeout=3000, ensure_https=False)
self.series_id = series_id
self.cascade_create = cascade_create

def get_body_parameters(self) -> dict:
"""
Values of body parameters as a dictionary (name of parameter: value of the parameter).
"""
p = dict()
if self.cascade_create is not DEFAULT:
p['cascadeCreate'] = self.cascade_create
return p

def get_query_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AddUser(Request):
"""

def __init__(self, user_id: str):
super().__init__(path="/users/%s" % (user_id), method='put', timeout=1000, ensure_https=False)
super().__init__(path="/users/%s" % (user_id), method='put', timeout=3000, ensure_https=False)
self.user_id = user_id

def get_body_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/add_user_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class AddUserProperty(Request):
"""
Adding a user property is somehow equivalent to adding a column to the table of users. The users may be characterized by various properties of different types.
Adding a user property is somewhat equivalent to adding a column to the table of users. The users may be characterized by various properties of different types.
Required parameters:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_bookmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeleteBookmark(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT):
super().__init__(path="/bookmarks/", method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/bookmarks/", method='delete', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_cart_addition.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeleteCartAddition(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT):
super().__init__(path="/cartadditions/", method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/cartadditions/", method='delete', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_detail_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeleteDetailView(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT):
super().__init__(path="/detailviews/", method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/detailviews/", method='delete', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
36 changes: 0 additions & 36 deletions recombee_api_client/api_requests/delete_group.py

This file was deleted.

2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DeleteItem(Request):
"""

def __init__(self, item_id: str):
super().__init__(path="/items/%s" % (item_id), method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/items/%s" % (item_id), method='delete', timeout=3000, ensure_https=False)
self.item_id = item_id

def get_body_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_more_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DeleteMoreItems(Request):
"""

def __init__(self, filter: str):
super().__init__(path="/more-items/", method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/more-items/", method='delete', timeout=100000, ensure_https=False)
self.filter = filter

def get_body_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeletePurchase(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT):
super().__init__(path="/purchases/", method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/purchases/", method='delete', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_rating.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeleteRating(Request):
"""

def __init__(self, user_id: str, item_id: str, timestamp: Union[str, int] = DEFAULT):
super().__init__(path="/ratings/", method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/ratings/", method='delete', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.timestamp = timestamp
Expand Down
12 changes: 10 additions & 2 deletions recombee_api_client/api_requests/delete_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@ class DeleteSeries(Request):
:param series_id: ID of the series to be deleted.
Optional parameters:
:param cascade_delete: If set to `true`, item with the same ID as seriesId will be also deleted. Default is `false`.
"""

def __init__(self, series_id: str):
super().__init__(path="/series/%s" % (series_id), method='delete', timeout=1000, ensure_https=False)
def __init__(self, series_id: str, cascade_delete: bool = DEFAULT):
super().__init__(path="/series/%s" % (series_id), method='delete', timeout=3000, ensure_https=False)
self.series_id = series_id
self.cascade_delete = cascade_delete

def get_body_parameters(self) -> dict:
"""
Values of body parameters as a dictionary (name of parameter: value of the parameter).
"""
p = dict()
if self.cascade_delete is not DEFAULT:
p['cascadeDelete'] = self.cascade_delete
return p

def get_query_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DeleteUser(Request):
"""

def __init__(self, user_id: str):
super().__init__(path="/users/%s" % (user_id), method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/users/%s" % (user_id), method='delete', timeout=3000, ensure_https=False)
self.user_id = user_id

def get_body_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/delete_view_portion.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DeleteViewPortion(Request):
"""

def __init__(self, user_id: str, item_id: str, session_id: str = DEFAULT):
super().__init__(path="/viewportions/", method='delete', timeout=1000, ensure_https=False)
super().__init__(path="/viewportions/", method='delete', timeout=3000, ensure_https=False)
self.user_id = user_id
self.item_id = item_id
self.session_id = session_id
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/get_item_property_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GetItemPropertyInfo(Request):
"""

def __init__(self, property_name: str):
super().__init__(path="/items/properties/%s" % (property_name), method='get', timeout=1000, ensure_https=False)
super().__init__(path="/items/properties/%s" % (property_name), method='get', timeout=3000, ensure_https=False)
self.property_name = property_name

def get_body_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/get_item_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GetItemValues(Request):
"""

def __init__(self, item_id: str):
super().__init__(path="/items/%s" % (item_id), method='get', timeout=1000, ensure_https=False)
super().__init__(path="/items/%s" % (item_id), method='get', timeout=3000, ensure_https=False)
self.item_id = item_id

def get_body_parameters(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion recombee_api_client/api_requests/get_user_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GetUserValues(Request):
"""

def __init__(self, user_id: str):
super().__init__(path="/users/%s" % (user_id), method='get', timeout=1000, ensure_https=False)
super().__init__(path="/users/%s" % (user_id), method='get', timeout=3000, ensure_https=False)
self.user_id = user_id

def get_body_parameters(self) -> dict:
Expand Down
Loading

0 comments on commit 5b56bae

Please sign in to comment.