diff --git a/getstream/models/__init__.py b/getstream/models/__init__.py index 2bf5409..7ecd96f 100644 --- a/getstream/models/__init__.py +++ b/getstream/models/__init__.py @@ -2306,6 +2306,31 @@ class DeleteCallResponse(DataClassJsonMixin): ) +@dataclass +class DeleteCallResult(DataClassJsonMixin): + error: str = dc_field(metadata=dc_config(field_name="error")) + status: str = dc_field(metadata=dc_config(field_name="status")) + + +@dataclass +class DeleteCallsRequest(DataClassJsonMixin): + hard: Optional[bool] = dc_field(default=None, metadata=dc_config(field_name="hard")) + cids: Optional[List[str]] = dc_field( + default=None, metadata=dc_config(field_name="cids") + ) + + +@dataclass +class DeleteCallsResponse(DataClassJsonMixin): + duration: str = dc_field(metadata=dc_config(field_name="duration")) + task_id: Optional[str] = dc_field( + default=None, metadata=dc_config(field_name="task_id") + ) + result: "Optional[Dict[str, Optional[DeleteCallResult]]]" = dc_field( + default=None, metadata=dc_config(field_name="result") + ) + + @dataclass class DeleteChannelResponse(DataClassJsonMixin): duration: str = dc_field(metadata=dc_config(field_name="duration")) diff --git a/getstream/video/rest_client.py b/getstream/video/rest_client.py index b64a1d5..7637030 100644 --- a/getstream/video/rest_client.py +++ b/getstream/video/rest_client.py @@ -584,6 +584,13 @@ def query_calls( return self.post("/api/v2/video/calls", QueryCallsResponse, json=json) + def delete_calls( + self, hard: Optional[bool] = None, cids: Optional[List[str]] = None + ) -> StreamResponse[DeleteCallsResponse]: + json = build_body_dict(hard=hard, cids=cids) + + return self.post("/api/v2/video/calls/delete", DeleteCallsResponse, json=json) + def list_call_types(self) -> StreamResponse[ListCallTypeResponse]: return self.get("/api/v2/video/calltypes", ListCallTypeResponse) diff --git a/tests/test_video_integration.py b/tests/test_video_integration.py index 3267f43..df7b26d 100644 --- a/tests/test_video_integration.py +++ b/tests/test_video_integration.py @@ -386,3 +386,20 @@ def test_hard_delete(self, client: Stream, call: Call): response = wait_for_task(client, task_id) cid = call.call_type + ":" + call.id assert response.data.result[cid]["status"] == "ok" + + def test_delete_calls(self, client: Stream): + call1 = client.video.call("default", str(uuid.uuid4())).get_or_create( + data=CallRequest( + created_by_id="john", + ), + ) + + call2 = client.video.call("default", str(uuid.uuid4())).get_or_create( + data=CallRequest( + created_by_id="john", + ), + ) + cid1 = call1.data.call.cid + cid2 = call2.data.call.cid + response = client.video.delete_calls(hard=False, cids=[cid1, cid2]) + # TODO: check response