Skip to content

Commit 935dd64

Browse files
committed
wip commit
1 parent bd08baa commit 935dd64

3 files changed

Lines changed: 12 additions & 54 deletions

File tree

python/lib/sift_client/_internal/CONTRIBUTING.md

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ Resource classes should implement consistent patterns for common operations. Use
104104

105105
**Important:** Arguments that represent another Sift Type should always accept both the object instance and its ID string. This provides flexibility for users who may have either form.
106106

107+
108+
**Note**: If the proto API does not support filters for a resource, the API should be updated to make the resource filterable in a consistent way with other resources.
109+
107110
Examples:
108111
```python
109112
# Accept either Asset object or asset ID string
@@ -145,59 +148,6 @@ async def update(self, asset: Asset | str, ...) -> Asset:
145148

146149
The `ResourceBase` class provides helper methods to build consistent CEL filter expressions:
147150

148-
```python
149-
def list_(
150-
self,
151-
*,
152-
asset_ids: list[str] | None = None,
153-
name: str | None = None,
154-
name_contains: str | None = None,
155-
name_regex: str | re.Pattern | None = None,
156-
created_after: datetime | None = None,
157-
created_before: datetime | None = None,
158-
modified_after: datetime | None = None,
159-
modified_before: datetime | None = None,
160-
created_by: str | None = None,
161-
modified_by: str | None = None,
162-
description_contains: str | None = None,
163-
tags: list[str] | None = None,
164-
metadata: list[Any] | None = None,
165-
include_archived: bool = False,
166-
filter_query: str | None = None,
167-
page_size: int | None = None,
168-
page_token: str | None = None,
169-
) -> list[Asset]:
170-
filter_parts = [
171-
*self._build_name_cel_filters(
172-
name=name,
173-
name_contains=name_contains,
174-
name_regex=name_regex,
175-
),
176-
*self._build_time_cel_filters(
177-
created_after=created_after,
178-
created_before=created_before,
179-
modified_after=modified_after,
180-
modified_before=modified_before,
181-
created_by=created_by,
182-
modified_by=modified_by,
183-
),
184-
*self._build_tags_metadata_cel_filters(tags=tags, metadata=metadata),
185-
*self._build_common_cel_filters(
186-
description_contains=description_contains,
187-
include_archived=include_archived,
188-
filter_query=filter_query,
189-
),
190-
]
191-
if asset_ids:
192-
filter_parts.append(cel.in_("asset_id", asset_ids))
193-
194-
# Build filter and call low-level client
195-
filter_expr = cel.and_(*filter_parts) if filter_parts else None
196-
# ... rest of implementation
197-
```
198-
199-
##### Available Helper Methods
200-
201151
- `_build_name_cel_filters()`: Handles `name`, `name_contains`, `name_regex`
202152
- `_build_time_cel_filters()`: Handles time-based filters and user filters
203153
- `_build_tags_metadata_cel_filters()`: Handles `tags` and `metadata` filters

python/lib/sift_client/resources/calculated_channels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async def list_(
100100
order_by: str | None = None,
101101
limit: int | None = None,
102102
) -> list[CalculatedChannel]:
103-
"""List calculated channels with optional filtering.
103+
"""List calculated channels with optional filtering. This will return the latest version. To find all versions, use `list_versions`.
104104
105105
Args:
106106
name: Exact name of the calculated channel.

python/lib/sift_client/sift_types/calculated_channel.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ class CalculatedChannel(BaseType[CalculatedChannelProto, "CalculatedChannel"]):
5050
created_by_user_id: str | None
5151
modified_by_user_id: str | None
5252

53+
@property
54+
def latest_version(self):
55+
...
56+
57+
@property
58+
def is_latest_version(self):
59+
...
60+
5361
@property
5462
def is_archived(self):
5563
"""Whether the calculated channel is archived."""

0 commit comments

Comments
 (0)