Skip to content

Commit beb89ac

Browse files
authored
feat: delete recording and transcription methods (#30)
1 parent cc0d00d commit beb89ac

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

__tests__/call.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ describe('call API', () => {
189189
);
190190
});
191191

192+
it('delete recording', async () => {
193+
// somewhat dummy test, we should do a proper test in the future
194+
await expect(() =>
195+
call.deleteRecording({ session: 'test', filename: 'test' }),
196+
).rejects.toThrowError(
197+
`Stream error code 16: DeleteRecording failed with error: "recording doesn't exist"`,
198+
);
199+
});
200+
192201
it('query recordings', async () => {
193202
// somewhat dummy test, we should do a proper test in the future
194203
const response = await call.listRecordings();
@@ -221,5 +230,30 @@ describe('call API', () => {
221230
expect(response.call.backstage).toBe(true);
222231
});
223232
});
233+
234+
describe('transcriptions', () => {
235+
it('start transcribing', async () => {
236+
// somewhat dummy test, we should do a proper test in the future where we join a call and start recording
237+
await expect(() => call.startTranscription()).rejects.toThrowError(
238+
'Stream error code 4: StartTranscription failed with error: "cannot transcribe inactive call"',
239+
);
240+
});
241+
242+
it('stop transcribing', async () => {
243+
// somewhat dummy test, we should do a proper test in the future
244+
await expect(() => call.stopTranscription()).rejects.toThrowError(
245+
'Stream error code 4: StopTranscription failed with error: "call is not being transcribed"',
246+
);
247+
});
248+
249+
it('delete transcription', async () => {
250+
// somewhat dummy test, we should do a proper test in the future
251+
await expect(() =>
252+
call.deleteTranscription({ session: 'test', filename: 'test' }),
253+
).rejects.toThrowError(
254+
`Stream error code 16: DeleteTranscription failed with error: "transcription doesn't exist"`,
255+
);
256+
});
257+
});
224258
});
225259
});

src/StreamCall.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { StreamClient } from './StreamClient';
22
import {
3+
DeleteRecordingRequest,
4+
DeleteTranscriptionRequest,
35
GetCallRequest,
46
ProductvideoApi,
57
VideoBlockUserRequest,
@@ -71,6 +73,10 @@ export class StreamCall {
7173
});
7274
};
7375

76+
deleteRecording = (request: OmitTypeId<DeleteRecordingRequest>) => {
77+
return this.apiClient.deleteRecording({ ...this.baseRequest, ...request });
78+
};
79+
7480
listTranscriptions = () => {
7581
return this.apiClient.listTranscriptions({
7682
...this.baseRequest,
@@ -117,6 +123,13 @@ export class StreamCall {
117123
});
118124
};
119125

126+
deleteTranscription = (request: OmitTypeId<DeleteTranscriptionRequest>) => {
127+
return this.apiClient.deleteTranscription({
128+
...this.baseRequest,
129+
...request,
130+
});
131+
};
132+
120133
stopHLSBroadcasting = () => {
121134
return this.apiClient.stopHLSBroadcasting({ ...this.baseRequest });
122135
};

0 commit comments

Comments
 (0)