diff --git a/.husky/pre-commit b/.husky/pre-commit index 2665d0376..a481e02de 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -4,4 +4,4 @@ echo "\nRunning GIT hooks..." yarn cleanbuild yarn nx affected --target=lint -yarn nx affected --target=test \ No newline at end of file +yarn nx affected --target=test diff --git a/packages/examples/sdk-frontend/package.json b/packages/examples/sdk-frontend/package.json index 3b7a393f1..1532153f8 100644 --- a/packages/examples/sdk-frontend/package.json +++ b/packages/examples/sdk-frontend/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "@pushprotocol/restapi": "^1.4.38", + "@pushprotocol/restapi": "^1.4.39", "@pushprotocol/socket": "^0.5.1", "@pushprotocol/uiweb": "^1.1.8", "@rainbow-me/rainbowkit": "0.12.14", diff --git a/packages/restapi/README.md b/packages/restapi/README.md index 793fd4af5..b6629ee12 100644 --- a/packages/restapi/README.md +++ b/packages/restapi/README.md @@ -5598,7 +5598,7 @@ export type VideoCallData = { video: boolean | null; // local video status address: string; // local address }; - incoming: [PeerData]; + incoming: PeerData[]; }; private data: VideoCallData; @@ -5647,14 +5647,14 @@ constructor({ }) {} ``` -Allowed Options (params with _ are mandatory) +Allowed Options (params with * are optional) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| signer_ | SignerType | - | signer object for a user | -| chainId* | number | - | chainId for the video call - Eth Mainnet: 1, Polygon Mainnet: 137 | -| pgpPrivatekey* | string | - | PGP private key of the user, used while sending video call notifications | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -| setData\* | `(fn: (data: VideoCallData) => VideoCallData) => void` | - | Function to update video call data | +| signer | SignerType | - | signer object for a user | +| chainId | number | - | chainId for the video call - Eth Mainnet: 1, Polygon Mainnet: 137 | +| pgpPrivatekey | string | - | PGP private key of the user, used while sending video call notifications | +| env* | string | 'prod' | API env - 'prod', 'staging', 'dev'| +| setData | `(fn: (data: VideoCallData) => VideoCallData) => void` | - | Function to update video call data | --- @@ -5667,16 +5667,18 @@ Allowed Options (params with _ are mandatory) export type VideoCreateInputOptions = { video?: boolean; audio?: boolean; + stream?: MediaStream; // for backend use }; async create(options: VideoCreateInputOptions): Promise {} ``` -Allowed Options (params with \* are mandatory) +Allowed Options (params with * are optional) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| video | boolean | true | video status for the local stream | -| audio | boolean | true | audio status for the local stream | +| video* | boolean | true | video status for the local stream | +| audio* | boolean | true | audio status for the local stream | +| stream* | MediaStream | null | local stream, for backend use | Note - If audio, video aren't enabled in create() then they wont be available during the call respectively. @@ -5690,7 +5692,7 @@ Note - If audio, video aren't enabled in create() then they wont be available du ```typescript export type VideoRequestInputOptions = { senderAddress: string; - recipientAddress: string; + recipientAddress: string | string[]; chatId: string; onReceiveMessage?: (message: string) => void; retry?: boolean; @@ -5699,14 +5701,14 @@ export type VideoRequestInputOptions = { async request(options: VideoRequestInputOptions): Promise {} ``` -Allowed Options (params with _ are mandatory) +Allowed Options (params with * are optional) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| senderAddress_ | string | - | Local peer address | -| recipientAddress* | string | - | Incoming/remote peer address | -| chatId* | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation | -| onReceiveMessage | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel | -| retry | boolean | false | If we are retrying the call, only for internal use | +| senderAddress | string | - | Wallet address of the local user | +| recipientAddress | string, string[] | - | Wallet addresses of users you want to call, single address for wallet to wallet call and array of addresses for group call | +| chatId | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation | +| onReceiveMessage* | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel | +| retry* | boolean | false | If we are retrying the call, only for internal use | --- @@ -5728,15 +5730,15 @@ export type VideoAcceptRequestInputOptions = { async acceptRequest(options: VideoAcceptRequestInputOptions): Promise {} ``` -Allowed Options (params with _ are mandatory) +Allowed Options (params with * are optional) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| signalData_ | any | - | Signal data received from the initiator peer via psuh notification upon call request | -| senderAddress* | string | - | Local peer address | -| recipientAddress* | string | - | Incoming/remote peer address | -| chatId\* | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation | -| onReceiveMessage | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel | -| retry | boolean | false | If we are retrying the call, only for internal use | +| signalData | any | - | Signal data received from the initiator peer via psuh notification upon call request | +| senderAddress | string | - | Local peer address | +| recipientAddress | string | - | Incoming/remote peer address | +| chatId | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation | +| onReceiveMessage* | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel | +| retry* | boolean | false | If we are retrying the call, only for internal use | --- @@ -5754,11 +5756,11 @@ export type VideoConnectInputOptions = { connect(options: VideoConnectInputOptions): void {} ``` -Allowed Options (params with _ are mandatory) +Allowed Options (params with * are optional) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| signalData_ | any | - | Signal data received from the receiver peer via push notification upon call acceptRequest | -| peerAddress | string | data.incoming[0].address | Address of the receiver peer, received via push notification upon call acceptRequest | +| signalData | any | - | Signal data received from the receiver peer via push notification upon call acceptRequest | +| peerAddress* | string | data.incoming[0].address | Address of the receiver peer, received via push notification upon call acceptRequest | --- @@ -5770,15 +5772,15 @@ Allowed Options (params with _ are mandatory) ```typescript export type VideoDisconnectOptions = { peerAddress: string; -} | null; +}; -disconnect(options: VideoDisconnectOptions): void {} +disconnect(options?: VideoDisconnectOptions): void {} ``` -Allowed Options (params with \* are mandatory) +Allowed Options (params with * are optional) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| peerAddress | string | data.incoming[0].address | Address of the peer to be disconnected from | +| peerAddress* | string | data.incoming[0].address | Address of the peer to be disconnected from | --- @@ -5789,14 +5791,14 @@ Allowed Options (params with \* are mandatory) - **Note -** If video was not enabled during `create()` then it will always remain off. ```typescript - export type EnableVideoInputOptions = { +export type EnableVideoInputOptions = { state: boolean; } enableVideo(options: EnableVideoInputOptions): void ``` -Allowed Options (params with \* are mandatory) +Allowed Options (params with * are optional) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| | state | boolean | - | true for enable and false for disable | @@ -5817,7 +5819,7 @@ export type EnableAudioInputOptions = { enableAudio(options: EnableAudioInputOptions): void ``` -Allowed Options (params with \* are mandatory) +Allowed Options (params with * are optional) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| | state | boolean | - | true for enable and false for disable | diff --git a/packages/restapi/src/lib/video/Video.ts b/packages/restapi/src/lib/video/Video.ts index ad9262d60..32138b7d5 100644 --- a/packages/restapi/src/lib/video/Video.ts +++ b/packages/restapi/src/lib/video/Video.ts @@ -801,7 +801,7 @@ export class Video { } } - disconnect(options: VideoDisconnectOptions): void { + disconnect(options?: VideoDisconnectOptions): void { const { peerAddress, details } = options || {}; try {