Skip to content

Commit 443d09d

Browse files
Marenzllucax
authored andcommitted
Add streaming.Event bindings
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 2308a4d commit 443d09d

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22

33
## Summary
44

5-
<!-- Here goes a general summary of what this release is about -->
6-
7-
## Upgrading
8-
9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
10-
115
## New Features
126

13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
14-
15-
## Bug Fixes
16-
17-
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
7+
- Mapping for the new `Event` message has been added.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# License: MIT
2+
# Copyright © 2025 Frequenz Energy-as-a-Service GmbH
3+
4+
"""Type wrappers for the generated protobuf messages."""
5+
6+
7+
from enum import Enum
8+
9+
# pylint: disable-next=no-name-in-module
10+
from frequenz.api.common.v1alpha8.streaming import event_pb2 as PBEvent
11+
12+
13+
class Event(Enum):
14+
"""Enum representing the type of streaming event."""
15+
16+
EVENT_UNSPECIFIED = PBEvent.EVENT_UNSPECIFIED
17+
"""Unspecified event type."""
18+
19+
EVENT_CREATED = PBEvent.EVENT_CREATED
20+
"""Event when a new resource is created."""
21+
22+
EVENT_UPDATED = PBEvent.EVENT_UPDATED
23+
"""Event when an existing resource is updated."""
24+
25+
EVENT_DELETED = PBEvent.EVENT_DELETED
26+
"""Event when a resource is deleted."""

tests/test_streaming.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# License: MIT
2+
# Copyright © 2025 Frequenz Energy-as-a-Service GmbH
3+
4+
"""Tests for the frequenz.client.common.v1alpha8.streaming package."""
5+
6+
from frequenz.client.common.enum_proto import enum_from_proto
7+
from frequenz.client.common.streaming import Event
8+
9+
10+
def test_event_enum() -> None:
11+
"""Test the Event enum."""
12+
for event in Event:
13+
assert enum_from_proto(event.value, Event) == event

0 commit comments

Comments
 (0)