-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f0829d
commit c7ab39b
Showing
112 changed files
with
1,967 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
recombee_api_client/api_requests/add_manual_reql_segment.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from recombee_api_client.api_requests.request import Request | ||
from typing import Union, List | ||
import uuid | ||
|
||
DEFAULT = uuid.uuid4() | ||
|
||
class AddManualReqlSegment(Request): | ||
""" | ||
Adds a new Segment into a Manual ReQL Segmentation. | ||
The new Segment is defined by a [ReQL](https://docs.recombee.com/reql.html) filter that returns `true` for an item in case that this item belongs to the segment. | ||
Required parameters: | ||
:param segmentation_id: ID of the Segmentation to which the new Segment should be added | ||
:param segment_id: ID of the newly created Segment | ||
:param filter: ReQL filter that returns `true` for items that belong to this Segment. Otherwise returns `false`. | ||
Optional parameters: | ||
:param title: Human-readable name of the Segment that is shown in the Recombee Admin UI. | ||
""" | ||
|
||
def __init__(self, segmentation_id: str, segment_id: str, filter: str, title: str = DEFAULT): | ||
super().__init__(path="/segmentations/manual-reql/%s/segments/%s" % (segmentation_id,segment_id), method='put', timeout=10000, ensure_https=False) | ||
self.segmentation_id = segmentation_id | ||
self.segment_id = segment_id | ||
self.filter = filter | ||
self.title = title | ||
|
||
def get_body_parameters(self) -> dict: | ||
""" | ||
Values of body parameters as a dictionary (name of parameter: value of the parameter). | ||
""" | ||
p = dict() | ||
p['filter'] = self.filter | ||
if self.title is not DEFAULT: | ||
p['title'] = self.title | ||
return p | ||
|
||
def get_query_parameters(self) -> dict: | ||
""" | ||
Values of query parameters as a dictionary (name of parameter: value of the parameter). | ||
""" | ||
params = dict() | ||
return params |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
recombee_api_client/api_requests/create_auto_reql_segmentation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from recombee_api_client.api_requests.request import Request | ||
from typing import Union, List | ||
import uuid | ||
|
||
DEFAULT = uuid.uuid4() | ||
|
||
class CreateAutoReqlSegmentation(Request): | ||
""" | ||
Segment the items using a [ReQL](https://docs.recombee.com/reql.html) expression. | ||
For each item, the expression should return a set that contains IDs of segments to which the item belongs to. | ||
Required parameters: | ||
:param segmentation_id: ID of the newly created Segmentation | ||
:param source_type: What type of data should be segmented. Currently only `items` are supported. | ||
:param expression: ReQL expression that returns for each item a set with IDs of segments to which the item belongs | ||
Optional parameters: | ||
:param title: Human-readable name that is shown in the Recombee Admin UI. | ||
:param description: Description that is shown in the Recombee Admin UI. | ||
""" | ||
|
||
def __init__(self, segmentation_id: str, source_type: str, expression: str, title: str = DEFAULT, description: str = DEFAULT): | ||
super().__init__(path="/segmentations/auto-reql/%s" % (segmentation_id), method='put', timeout=10000, ensure_https=False) | ||
self.segmentation_id = segmentation_id | ||
self.source_type = source_type | ||
self.expression = expression | ||
self.title = title | ||
self.description = description | ||
|
||
def get_body_parameters(self) -> dict: | ||
""" | ||
Values of body parameters as a dictionary (name of parameter: value of the parameter). | ||
""" | ||
p = dict() | ||
p['sourceType'] = self.source_type | ||
p['expression'] = self.expression | ||
if self.title is not DEFAULT: | ||
p['title'] = self.title | ||
if self.description is not DEFAULT: | ||
p['description'] = self.description | ||
return p | ||
|
||
def get_query_parameters(self) -> dict: | ||
""" | ||
Values of query parameters as a dictionary (name of parameter: value of the parameter). | ||
""" | ||
params = dict() | ||
return params |
56 changes: 56 additions & 0 deletions
56
recombee_api_client/api_requests/create_manual_reql_segmentation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from recombee_api_client.api_requests.request import Request | ||
from typing import Union, List | ||
import uuid | ||
|
||
DEFAULT = uuid.uuid4() | ||
|
||
class CreateManualReqlSegmentation(Request): | ||
""" | ||
Segment the items using multiple [ReQL](https://docs.recombee.com/reql.html) filters. | ||
Use the Add Manual ReQL Items Segment endpoint to create the individual segments. | ||
Required parameters: | ||
:param segmentation_id: ID of the newly created Segmentation | ||
:param source_type: What type of data should be segmented. Currently only `items` are supported. | ||
Optional parameters: | ||
:param title: Human-readable name that is shown in the Recombee Admin UI. | ||
:param description: Description that is shown in the Recombee Admin UI. | ||
""" | ||
|
||
def __init__(self, segmentation_id: str, source_type: str, title: str = DEFAULT, description: str = DEFAULT): | ||
super().__init__(path="/segmentations/manual-reql/%s" % (segmentation_id), method='put', timeout=10000, ensure_https=False) | ||
self.segmentation_id = segmentation_id | ||
self.source_type = source_type | ||
self.title = title | ||
self.description = description | ||
|
||
def get_body_parameters(self) -> dict: | ||
""" | ||
Values of body parameters as a dictionary (name of parameter: value of the parameter). | ||
""" | ||
p = dict() | ||
p['sourceType'] = self.source_type | ||
if self.title is not DEFAULT: | ||
p['title'] = self.title | ||
if self.description is not DEFAULT: | ||
p['description'] = self.description | ||
return p | ||
|
||
def get_query_parameters(self) -> dict: | ||
""" | ||
Values of query parameters as a dictionary (name of parameter: value of the parameter). | ||
""" | ||
params = dict() | ||
return params |
Oops, something went wrong.