Skip to content

Commit a4d74cb

Browse files
committed
Added support to pass tags to splits.list and splits.find
1 parent 33490b9 commit a4d74cb

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

splitapiclient/microclients/split_microclient.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class SplitMicroClient:
4545
},
4646
'all_items': {
4747
'method': 'GET',
48-
'url_template': 'splits/ws/{workspaceId}?limit=20&offset={offset}',
48+
'url_template': 'splits/ws/{workspaceId}?limit=20&offset={offset}{tags}',
4949
'headers': [{
5050
'name': 'Authorization',
5151
'template': 'Bearer {value}',
@@ -95,7 +95,7 @@ def __init__(self, http_client):
9595
'''
9696
self._http_client = http_client
9797

98-
def list(self, workspace_id):
98+
def list(self, workspace_id, tags):
9999
'''
100100
Returns a list of Split objects.
101101
@@ -104,11 +104,15 @@ def list(self, workspace_id):
104104
'''
105105
offset_val = 0
106106
final_list = []
107+
tags_list = ""
108+
for tag in tags:
109+
tags_list = tags_list + "&tag=" + tag
107110
while True:
108111
response = self._http_client.make_request(
109112
self._endpoint['all_items'],
110113
workspaceId = workspace_id,
111-
offset = offset_val
114+
offset = offset_val,
115+
tags = tags_list
112116
)
113117
for item in response['objects']:
114118
final_list.append(as_dict(item))
@@ -122,14 +126,14 @@ def list(self, workspace_id):
122126
break
123127
return [Split(item, workspace_id, self._http_client) for item in final_list]
124128

125-
def find(self, split_name, workspace_id):
129+
def find(self, split_name, workspace_id, tags):
126130
'''
127131
Find Split in workspace objects.
128132
129133
:returns: Split object
130134
:rtype: Split
131135
'''
132-
for item in self.list(workspace_id):
136+
for item in self.list(workspace_id, tags):
133137
if item.name == split_name:
134138
return item
135139
LOGGER.error("Split Name does not exist")

0 commit comments

Comments
 (0)