Skip to content

Commit

Permalink
Add dataSetId to subscriptions data classes
Browse files Browse the repository at this point in the history
  • Loading branch information
sighol committed Nov 20, 2023
1 parent 3f91603 commit 397ef36
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cognite/client/data_classes/datapoints_subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ def __init__(
filter: Filter | None = None,
name: str | None = None,
description: str | None = None,
data_set_id: int | None = None,
**_: Any,
) -> None:
self.external_id = external_id
self.partition_count = partition_count
self.filter = filter
self.name = name
self.description = description
self.data_set_id = data_set_id

@classmethod
def _load(
Expand Down Expand Up @@ -90,6 +92,7 @@ class DatapointSubscription(DatapointSubscriptionCore):
filter (Filter | None): If present, the subscription is defined by this filter.
name (str | None): No description.
description (str | None): A summary explanation for the subscription.
data_set_id (int | None): The id of the dataset this subscription belongs to.
**_ (Any): No description.
"""

Expand All @@ -103,9 +106,10 @@ def __init__(
filter: Filter | None = None,
name: str | None = None,
description: str | None = None,
data_set_id: int | None = None,
**_: Any,
) -> None:
super().__init__(external_id, partition_count, filter, name, description)
super().__init__(external_id, partition_count, filter, name, description, data_set_id)
self.time_series_count = time_series_count
self.created_time = created_time
self.last_updated_time = last_updated_time
Expand All @@ -124,6 +128,7 @@ class DataPointSubscriptionCreate(DatapointSubscriptionCore):
filter (Filter | None): A filter DSL (Domain Specific Language) to define advanced filter queries. Not compatible with time_series_ids.
name (str | None): No description.
description (str | None): A summary explanation for the subscription.
data_set_id (int | None): The id of the dataset this subscription belongs to.
"""

def __init__(
Expand All @@ -134,11 +139,12 @@ def __init__(
filter: Filter | None = None,
name: str | None = None,
description: str | None = None,
data_set_id: int | None = None,
) -> None:
if not exactly_one_is_not_none(time_series_ids, filter):
raise ValueError("Exactly one of time_series_ids and filter must be given")
_validate_filter(filter, _DATAPOINT_SUBSCRIPTION_SUPPORTED_FILTERS, "DataPointSubscriptions")
super().__init__(external_id, partition_count, filter, name, description)
super().__init__(external_id, partition_count, filter, name, description, data_set_id)
self.time_series_ids = time_series_ids

@classmethod
Expand Down Expand Up @@ -186,6 +192,10 @@ def remove(self, value: list) -> DataPointSubscriptionUpdate:
def name(self) -> _PrimitiveDataPointSubscriptionUpdate:
return DataPointSubscriptionUpdate._PrimitiveDataPointSubscriptionUpdate(self, "name")

@property
def data_set_id(self) -> _PrimitiveDataPointSubscriptionUpdate:
return DataPointSubscriptionUpdate._PrimitiveDataPointSubscriptionUpdate(self, "dataSetId")

@property
def time_series_ids(self) -> _ListDataPointSubscriptionUpdate:
return DataPointSubscriptionUpdate._ListDataPointSubscriptionUpdate(self, "timeSeriesIds")
Expand Down

0 comments on commit 397ef36

Please sign in to comment.