diff --git a/aw_client/client.py b/aw_client/client.py index 66d47d4..bbc1996 100644 --- a/aw_client/client.py +++ b/aw_client/client.py @@ -177,15 +177,17 @@ def get_events( events = self._get(endpoint, params=params).json() return [Event(**event) for event in events] - def insert_event(self, bucket_id: str, event: Event) -> None: + def insert_event(self, bucket_id: str, event: Event) -> Event: endpoint = f"buckets/{bucket_id}/events" data = [event.to_json_dict()] - self._post(endpoint, data) + events = self._post(endpoint, data).json() + return Event(**events[0]) - def insert_events(self, bucket_id: str, events: List[Event]) -> None: + def insert_events(self, bucket_id: str, events: List[Event]) -> List[Event]: endpoint = f"buckets/{bucket_id}/events" data = [event.to_json_dict() for event in events] - self._post(endpoint, data) + events = self._post(endpoint, data).json() + return [Event(**event) for event in events] def delete_event(self, bucket_id: str, event_id: int) -> None: endpoint = f"buckets/{bucket_id}/events/{event_id}"