Skip to content

Commit 58479c9

Browse files
author
Jihan Yin
committed
added append support to slice class
1 parent ecda3c9 commit 58479c9

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

nucleus/slice.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def info(self, id_type: str = DATASET_ITEM_ID_KEY) -> dict:
1515
This endpoint provides information about specified slice.
1616
1717
:param
18-
slice_id: id of the slice
1918
id_type: the type of IDs you want in response (either "reference_id" or "dataset_item_id")
2019
to identify the DatasetItems
2120
@@ -27,3 +26,26 @@ def info(self, id_type: str = DATASET_ITEM_ID_KEY) -> dict:
2726
}
2827
"""
2928
return self._client.slice_info(self.slice_id, id_type)
29+
30+
def append(self, payload: dict) -> dict:
31+
"""
32+
Appends to a slice from items already present in a dataset.
33+
The caller must exclusively use either datasetItemIds or reference_ids
34+
as a means of identifying items in the dataset.
35+
36+
:param
37+
payload:
38+
{
39+
"dataset_item_ids": List[str],
40+
"reference_ids": List[str],
41+
}
42+
43+
:return:
44+
{
45+
"slice_id": str,
46+
}
47+
"""
48+
response = self.client._make_request(
49+
payload, f"slice/{self.slice_id}/append"
50+
)
51+
return response

0 commit comments

Comments
 (0)