Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Realtime-API: Integrate Call Pay API #1162

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/spicy-foxes-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@signalwire/realtime-api': patch
'@signalwire/core': patch
---

Refactor types for the Voice calling APIs
6 changes: 4 additions & 2 deletions packages/core/src/redux/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ export type SessionChannelAction =
| PayloadAction<{ token: string }>
| PayloadAction<SessionAuthStatus>

export type SwEventChannel = MulticastChannel<MapToPubSubShape<SwEventParams>>
type SwEventChannelActions = MapToPubSubShape<SwEventParams>

export type SwEventChannel = MulticastChannel<SwEventChannelActions>
export type SessionChannel = Channel<SessionChannelAction>

export type SDKActions = MapToPubSubShape<SwEventParams> | END
export type SDKActions = SwEventChannelActions | END
21 changes: 17 additions & 4 deletions packages/core/src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ export type PaginationCursor =

export type ClientContextMethod = 'signalwire.receive' | 'signalwire.unreceive'

export interface ClientContextContract {
addContexts(contexts: string[]): Promise<{ message: string; code: number }>
removeContexts(contexts: string[]): Promise<{ message: string; code: number }>
}
/**
* Private common event types
*/
export type CallPlay = 'call.play'
export type CallRecord = 'call.record'

/**
* Public common event types
*/
export type PlaybackStarted = 'playback.started'
export type PlaybackUpdated = 'playback.updated'
export type PlaybackEnded = 'playback.ended'
export type PlaybackFailed = 'playback.failed'
export type RecordingStarted = 'recording.started'
export type RecordingUpdated = 'recording.updated'
export type RecordingEnded = 'recording.ended'
export type RecordingFailed = 'recording.failed'
14 changes: 6 additions & 8 deletions packages/core/src/types/videoPlayback.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type { SwEvent } from '.'
import type {
PlaybackEnded,
PlaybackStarted,
PlaybackUpdated,
SwEvent,
} from '.'
import { MapToPubSubShape } from '..'
import type {
CamelToSnakeCase,
Expand All @@ -7,13 +12,6 @@ import type {
OnlyFunctionProperties,
} from './utils'

/**
* Public event types
*/
export type PlaybackStarted = 'playback.started'
export type PlaybackUpdated = 'playback.updated'
export type PlaybackEnded = 'playback.ended'

/**
* Public listener types
*/
Expand Down
14 changes: 6 additions & 8 deletions packages/core/src/types/videoRecording.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type { SwEvent } from '.'
import type {
RecordingEnded,
RecordingStarted,
RecordingUpdated,
SwEvent,
} from '.'
import { MapToPubSubShape } from '..'
import type {
CamelToSnakeCase,
Expand All @@ -8,13 +13,6 @@ import type {
OnlyFunctionProperties,
} from './utils'

/**
* Public event types
*/
export type RecordingStarted = 'recording.started'
export type RecordingUpdated = 'recording.updated'
export type RecordingEnded = 'recording.ended'

/**
* Public listener types
*/
Expand Down
17 changes: 15 additions & 2 deletions packages/core/src/types/voice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
import { VoiceCallJSONRPCMethod } from './voiceCall'
import { PRODUCT_PREFIX_VOICE_CALL } from '../utils/constants'

export type VoiceNamespace = typeof PRODUCT_PREFIX_VOICE_CALL
export type ToInternalVoiceEvent<T extends string> = `${VoiceNamespace}.${T}`

export interface NestedArray<T> extends Array<T | NestedArray<T>> {}

export * from './voiceCall'
export type VoiceJSONRPCMethod = VoiceCallJSONRPCMethod
export * from './voicePlayback'
export * from './voiceRecording'
export * from './voiceDetect'
export * from './voiceTap'
export * from './voiceCollect'
export * from './voicePrompt'
export * from './voiceSendDigits'
export * from './voiceConnect'
export * from './voicePay'
Loading