sift_client.resources.calculated_channels
¶
| CLASS | DESCRIPTION |
|---|---|
CalculatedChannelsAPIAsync |
High-level API for interacting with calculated channels. |
CalculatedChannelsAPIAsync
¶
CalculatedChannelsAPIAsync(sift_client: SiftClient)
Bases: ResourceBase
High-level API for interacting with calculated channels.
This class provides a Pythonic, notebook-friendly interface for interacting with the CalculatedChannelsAPI. It handles automatic handling of gRPC services, seamless type conversion, and clear error handling.
All methods in this class use the CalculatedChannel class from the low-level wrapper, which is a user-friendly representation of a calculated channel using standard Python data structures and types.
Initialize the CalculatedChannelsAPI.
| PARAMETER | DESCRIPTION |
|---|---|
sift_client
|
The Sift client to use.
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
archive |
Archive a Calculated Channel. |
create |
Create a calculated channel. |
find |
Find a single calculated channel matching the given query. Takes the same arguments as |
get |
Get a Calculated Channel. |
list_ |
List calculated channels with optional filtering. |
list_versions |
List versions of a calculated channel. |
update |
Update a Calculated Channel. |
archive
async
¶
archive(
*, calculated_channel: str | CalculatedChannel
) -> None
Archive a Calculated Channel.
create
async
¶
create(
*,
name: str,
expression: str,
channel_references: list[ChannelReference],
description: str = "",
units: str | None = None,
client_key: str | None = None,
asset_ids: list[str] | None = None,
tag_ids: list[str] | None = None,
all_assets: bool = False,
user_notes: str = "",
) -> CalculatedChannel
Create a calculated channel.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
The name of the calculated channel.
TYPE:
|
expression
|
The expression to calculate the value of the calculated channel.
TYPE:
|
channel_references
|
A list of channel references that are used in the expression.
TYPE:
|
description
|
The description of the calculated channel.
TYPE:
|
units
|
The units of the calculated channel.
TYPE:
|
client_key
|
A user-defined unique identifier for the calculated channel.
TYPE:
|
asset_ids
|
A list of asset IDs to make the calculation available for. |
tag_ids
|
A list of tag IDs to make the calculation available for. |
all_assets
|
A flag that, when set to True, associates the calculated channel with all assets.
TYPE:
|
user_notes
|
User notes for the calculated channel.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CalculatedChannel
|
The created CalculatedChannel. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If asset configuration is invalid. |
find
async
¶
find(**kwargs) -> CalculatedChannel | None
Find a single calculated channel matching the given query. Takes the same arguments as list but handles checking for multiple matches.
Will raise an error if multiple calculated channels are found.
| PARAMETER | DESCRIPTION |
|---|---|
**kwargs
|
Keyword arguments to pass to
DEFAULT:
|
| RETURNS | DESCRIPTION |
|---|---|
CalculatedChannel | None
|
The CalculatedChannel found or None. |
get
async
¶
get(
*,
calculated_channel_id: str | None = None,
client_key: str | None = None,
organization_id: str | None = None,
) -> CalculatedChannel
Get a Calculated Channel.
| PARAMETER | DESCRIPTION |
|---|---|
calculated_channel_id
|
The ID of the calculated channel.
TYPE:
|
client_key
|
The client key of the calculated channel.
TYPE:
|
organization_id
|
The organization ID (required if using client_key and user belongs to multiple organizations).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CalculatedChannel
|
The CalculatedChannel. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If neither calculated_channel_id nor client_key is provided. |
list_
async
¶
list_(
*,
name: str | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
created_after: datetime | None = None,
created_before: datetime | None = None,
modified_after: datetime | None = None,
modified_before: datetime | None = None,
created_by: Any | None = None,
modified_by: Any | None = None,
client_key: str | None = None,
asset_id: str | None = None,
asset_name: str | None = None,
tag_id: str | None = None,
tag_name: str | None = None,
version: int | None = None,
include_archived: bool = False,
filter_query: str | None = None,
order_by: str | None = None,
limit: int | None = None,
organization_id: str | None = None,
) -> list[CalculatedChannel]
List calculated channels with optional filtering.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Exact name of the calculated channel.
TYPE:
|
name_contains
|
Partial name of the calculated channel.
TYPE:
|
name_regex
|
Regular expression string to filter calculated channels by name. |
created_after
|
Created after this date.
TYPE:
|
created_before
|
Created before this date.
TYPE:
|
modified_after
|
Modified after this date.
TYPE:
|
modified_before
|
Modified before this date.
TYPE:
|
created_by
|
Calculated channels created by this user.
TYPE:
|
modified_by
|
Calculated channels last modified by this user.
TYPE:
|
client_key
|
The client key of the calculated channel.
TYPE:
|
asset_id
|
The asset ID associated with the calculated channel.
TYPE:
|
asset_name
|
The asset name associated with the calculated channel.
TYPE:
|
tag_id
|
The tag ID associated with the calculated channel.
TYPE:
|
tag_name
|
The tag name associated with the calculated channel.
TYPE:
|
version
|
The version of the calculated channel.
TYPE:
|
include_archived
|
Include archived calculated channels.
TYPE:
|
filter_query
|
Explicit CEL query to filter calculated channels.
TYPE:
|
order_by
|
How to order the retrieved calculated channels.
TYPE:
|
limit
|
How many calculated channels to retrieve. If None, retrieves all matches.
TYPE:
|
organization_id
|
The organization ID (required if user belongs to multiple organizations).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[CalculatedChannel]
|
A list of CalculatedChannels that matches the filter. |
list_versions
async
¶
list_versions(
*,
calculated_channel_id: str | None = None,
client_key: str | None = None,
organization_id: str | None = None,
name: str | None = None,
name_contains: str | None = None,
name_regex: str | Pattern | None = None,
asset_id: str | None = None,
asset_name: str | None = None,
tag_id: str | None = None,
tag_name: str | None = None,
version: int | None = None,
include_archived: bool = False,
order_by: str | None = None,
limit: int | None = None,
) -> list[CalculatedChannel]
List versions of a calculated channel.
| PARAMETER | DESCRIPTION |
|---|---|
calculated_channel_id
|
The ID of the calculated channel.
TYPE:
|
client_key
|
The client key of the calculated channel.
TYPE:
|
name
|
The name of the calculated channel.
TYPE:
|
name_contains
|
The name of the calculated channel.
TYPE:
|
name_regex
|
The name of the calculated channel. |
asset_id
|
The asset ID of the calculated channel.
TYPE:
|
asset_name
|
The asset name of the calculated channel.
TYPE:
|
tag_id
|
The tag ID of the calculated channel.
TYPE:
|
tag_name
|
The tag name of the calculated channel.
TYPE:
|
version
|
The version of the calculated channel.
TYPE:
|
include_archived
|
Whether to include archived calculated channels.
TYPE:
|
organization_id
|
The organization ID. Required if your user belongs to multiple organizations.
TYPE:
|
order_by
|
The field to order by.
TYPE:
|
limit
|
How many versions to retrieve. If None, retrieves all matches.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[CalculatedChannel]
|
A list of CalculatedChannel versions. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If neither calculated_channel_id nor client_key is provided. |
update
async
¶
update(
*,
calculated_channel: str | CalculatedChannel,
update: CalculatedChannelUpdate | dict,
user_notes: str | None = None,
) -> CalculatedChannel
Update a Calculated Channel.
| PARAMETER | DESCRIPTION |
|---|---|
calculated_channel
|
The CalculatedChannel or id of the CalculatedChannel to update.
TYPE:
|
update
|
Updates to apply to the CalculatedChannel.
TYPE:
|
user_notes
|
User notes for the update.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
CalculatedChannel
|
The updated CalculatedChannel. |