Skip to content

Commit de9221f

Browse files
committed
update calculated channel archive/unarchive
1 parent 4b1eb2c commit de9221f

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

python/lib/sift_client/resources/calculated_channels.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from datetime import datetime, timezone
3+
from datetime import datetime
44
from typing import TYPE_CHECKING, Any
55

66
from sift_client._internal.low_level_wrappers.calculated_channels import (
@@ -247,12 +247,31 @@ async def update(
247247

248248
return self._apply_client_to_instance(updated_calculated_channel)
249249

250-
async def archive(self, calculated_channel: str | CalculatedChannel) -> None:
251-
"""Archive a Calculated Channel."""
252-
update = CalculatedChannelUpdate(
253-
archived_date=datetime.now(tz=timezone.utc),
254-
)
255-
await self.update(calculated_channel=calculated_channel, update=update)
250+
async def archive(self, calculated_channel: str | CalculatedChannel) -> CalculatedChannel:
251+
"""Archive a calculated channel.
252+
253+
Args:
254+
calculated_channel: The id or CalculatedChannel object of the calculated channel to archive.
255+
256+
Returns:
257+
The archived CalculatedChannel.
258+
"""
259+
return await self.update(calculated_channel=calculated_channel, update=CalculatedChannelUpdate(
260+
is_archived=True
261+
))
262+
263+
async def unarchive(self, calculated_channel: str | CalculatedChannel) -> CalculatedChannel:
264+
"""Unarchive a calculated channel.
265+
266+
Args:
267+
calculated_channel: The id or CalculatedChannel object of the calculated channel to unarchive.
268+
269+
Returns:
270+
The unarchived CalculatedChannel.
271+
"""
272+
return await self.update(calculated_channel=calculated_channel, update=CalculatedChannelUpdate(
273+
is_archived=False
274+
))
256275

257276
async def list_versions(
258277
self,

0 commit comments

Comments
 (0)