Skip to content

Commit

Permalink
Merge pull request #35 from GetStream/gen-sources
Browse files Browse the repository at this point in the history
Add delete transcription endpoint
  • Loading branch information
yaziine authored May 14, 2024
2 parents db63e99 + dde84bd commit cc1471e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions getstream/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2268,6 +2268,11 @@ class DeleteRecordingResponse(DataClassJsonMixin):
duration: str = dc_field(metadata=dc_config(field_name="duration"))


@dataclass
class DeleteTranscriptionResponse(DataClassJsonMixin):
duration: str = dc_field(metadata=dc_config(field_name="duration"))


@dataclass
class DeleteUsersRequest(DataClassJsonMixin):
user_ids: List[str] = dc_field(metadata=dc_config(field_name="user_ids"))
Expand Down
9 changes: 9 additions & 0 deletions getstream/video/call.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,13 @@ def delete_recording(
self._sync_from_response(response.data)
return response

def delete_transcription(
self, session: str, filename: str
) -> StreamResponse[DeleteTranscriptionResponse]:
response = self.client.delete_transcription(
type=self.call_type, id=self.id, session=session, filename=filename
)
self._sync_from_response(response.data)
return response

create = get_or_create
18 changes: 17 additions & 1 deletion getstream/video/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,27 @@ def delete_recording(
}

return self.delete(
"/api/v2/video/call/{type}/{id}/{session}/{filename}",
"/api/v2/video/call/{type}/{id}/{session}/recordings/{filename}",
DeleteRecordingResponse,
path_params=path_params,
)

def delete_transcription(
self, type: str, id: str, session: str, filename: str
) -> StreamResponse[DeleteTranscriptionResponse]:
path_params = {
"type": type,
"id": id,
"session": session,
"filename": filename,
}

return self.delete(
"/api/v2/video/call/{type}/{id}/{session}/transcriptions/{filename}",
DeleteTranscriptionResponse,
path_params=path_params,
)

def query_calls(
self,
limit: Optional[int] = None,
Expand Down
4 changes: 4 additions & 0 deletions tests/test_video_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,7 @@ def test_enable_backstage_mode(self):
def test_delete_not_existing_recording(self):
with pytest.raises(StreamAPIException):
self.call.delete_recording("random_session", "random_filename")

def test_delete_not_existing_transcription(self):
with pytest.raises(StreamAPIException):
self.call.delete_transcription("random_session", "random_filename")

0 comments on commit cc1471e

Please sign in to comment.