Skip to content

Commit

Permalink
feat: Update with new API spec (#1098)
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Guerinoni <[email protected]>

---------

Signed-off-by: Federico Guerinoni <[email protected]>
Co-authored-by: Oliver Lazoroski <[email protected]>
  • Loading branch information
guerinoni and oliverlaz authored Sep 19, 2023
1 parent de6c89e commit ced372c
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 35 deletions.
1 change: 1 addition & 0 deletions packages/client/src/__tests__/server-side/call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ describe('call API', () => {
response = await call.update({
settings_override: {
recording: {
mode: RecordSettingsRequestModeEnum.AVAILABLE,
audio_only: false,
quality: RecordSettingsRequestQualityEnum._1080P,
},
Expand Down
90 changes: 59 additions & 31 deletions packages/client/src/gen/coordinator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ export interface CallReactionEvent {
type: string;
}
/**
*
* CallRecording represents a recording of a call.
* @export
* @interface CallRecording
*/
Expand Down Expand Up @@ -844,6 +844,62 @@ export interface CallRecording {
*/
url: string;
}
/**
* This event is sent when call recording has failed
* @export
* @interface CallRecordingFailedEvent
*/
export interface CallRecordingFailedEvent {
/**
*
* @type {string}
* @memberof CallRecordingFailedEvent
*/
call_cid: string;
/**
*
* @type {string}
* @memberof CallRecordingFailedEvent
*/
created_at: string;
/**
* The type of event: "call.recording_failed" in this case
* @type {string}
* @memberof CallRecordingFailedEvent
*/
type: string;
}
/**
* This event is sent when call recording is ready
* @export
* @interface CallRecordingReadyEvent
*/
export interface CallRecordingReadyEvent {
/**
*
* @type {string}
* @memberof CallRecordingReadyEvent
*/
call_cid: string;
/**
*
* @type {CallRecording}
* @memberof CallRecordingReadyEvent
*/
call_recording: CallRecording;
/**
*
* @type {string}
* @memberof CallRecordingReadyEvent
*/
created_at: string;
/**
* The type of event: "call.recording_ready" in this case
* @type {string}
* @memberof CallRecordingReadyEvent
*/
type: string;
}
/**
* This event is sent when call recording has started
* @export
Expand Down Expand Up @@ -1487,12 +1543,6 @@ export interface CallSettingsResponse {
* @interface CallStateResponseFields
*/
export interface CallStateResponseFields {
/**
*
* @type {Array<UserResponse>}
* @memberof CallStateResponseFields
*/
blocked_users: Array<UserResponse>;
/**
*
* @type {CallResponse}
Expand Down Expand Up @@ -2227,12 +2277,6 @@ export interface GeofenceSettingsRequest {
* @interface GetCallResponse
*/
export interface GetCallResponse {
/**
*
* @type {Array<UserResponse>}
* @memberof GetCallResponse
*/
blocked_users: Array<UserResponse>;
/**
*
* @type {CallResponse}
Expand Down Expand Up @@ -2369,12 +2413,6 @@ export interface GetOrCreateCallRequest {
* @interface GetOrCreateCallResponse
*/
export interface GetOrCreateCallResponse {
/**
*
* @type {Array<UserResponse>}
* @memberof GetOrCreateCallResponse
*/
blocked_users: Array<UserResponse>;
/**
*
* @type {CallResponse}
Expand Down Expand Up @@ -2611,12 +2649,6 @@ export interface JoinCallRequest {
* @interface JoinCallResponse
*/
export interface JoinCallResponse {
/**
*
* @type {Array<UserResponse>}
* @memberof JoinCallResponse
*/
blocked_users: Array<UserResponse>;
/**
*
* @type {CallResponse}
Expand Down Expand Up @@ -4001,12 +4033,6 @@ export interface UpdateCallRequest {
* @interface UpdateCallResponse
*/
export interface UpdateCallResponse {
/**
*
* @type {Array<UserResponse>}
* @memberof UpdateCallResponse
*/
blocked_users: Array<UserResponse>;
/**
*
* @type {CallResponse}
Expand Down Expand Up @@ -4314,6 +4340,8 @@ export type VideoEvent =
| ({ type: 'call.permission_request' } & PermissionRequestEvent)
| ({ type: 'call.permissions_updated' } & UpdatedCallPermissionsEvent)
| ({ type: 'call.reaction_new' } & CallReactionEvent)
| ({ type: 'call.recording_failed' } & CallRecordingFailedEvent)
| ({ type: 'call.recording_ready' } & CallRecordingReadyEvent)
| ({ type: 'call.recording_started' } & CallRecordingStartedEvent)
| ({ type: 'call.recording_stopped' } & CallRecordingStoppedEvent)
| ({ type: 'call.rejected' } & CallRejectedEvent)
Expand Down
2 changes: 2 additions & 0 deletions packages/client/src/store/CallState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ export class CallState {
'connection.error': undefined,
'connection.ok': undefined,
'health.check': undefined,
'call.recording_failed': undefined,
'call.recording_ready': undefined,
custom: undefined,

// events that update call state:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ export const CallRecordings = () => {
setLoadingCallRecordings(true),
);

// @ts-expect-error
const unsubscribeRecordingReady = call.on('call.recording_ready', (e) => {
// FIXME OL this event isn't yet available in the OpenAPI schema
if (e.type !== 'call.recording_ready') return;
const { call_recording: recording } = e;
setCallRecordings((prev) => [...prev, recording]);
setLoadingCallRecordings(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ export const Recordings = () => {
},
);

// @ts-expect-error
const unsubscribeRecordingReady = call.on('call.recording_ready', (e) => {
if (e.type !== 'call.recording_ready') return;
try {
// FIXME OL this event isn't yet available in the OpenAPI schema
const { call_recording: recording } = e;
setCallRecordings((prev) => [...prev, recording]);
} catch (error) {
Expand Down

0 comments on commit ced372c

Please sign in to comment.