Skip to content

Commit

Permalink
fix: Renamed all call functions
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Mar 29, 2023
1 parent 764a45d commit f54cc87
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
Expand Up @@ -24,23 +24,23 @@ import { CALL_STATES } from '../../whatsapp/enums';
* @example
* ```javascript
* // Accept any incoming call
* WPP.call.acceptCall();
* WPP.call.accept();
*
* // Accept specific call id
* WPP.call.acceptCall(callId);
* WPP.call.accept(callId);
*
* // Accept any incoming call
* WPP.on('call.incoming_call', (call) => {
* setTimeout(() => {
* WPP.call.acceptCall(call.id);
* WPP.call.accept(call.id);
* }, 1000);
* });
* ```
*
* @param {string} callId The call ID, empty to accept the first one
* @return {[type]} [return description]
*/
export async function acceptCall(callId?: string): Promise<boolean> {
export async function accept(callId?: string): Promise<boolean> {
let call: CallModel | undefined = undefined;

if (callId) {
Expand Down
8 changes: 4 additions & 4 deletions src/call/functions/endCall.ts → src/call/functions/end.ts
Expand Up @@ -24,21 +24,21 @@ import { CALL_STATES } from '../../whatsapp/enums';
* @example
* ```javascript
* // End any outcoming call
* WPP.call.endCall();
* WPP.call.end();
*
* // End specific call id
* WPP.call.endCall(callId);
* WPP.call.end(callId);
*
* // End any outcoming call
* WPP.on('call.outcoming_call', (call) => {
* WPP.call.endCall(call.id);
* WPP.call.end(call.id);
* });
* ```
*
* @param {string} callId The call ID, empty to end the first one
* @return {[type]} [return description]
*/
export async function endCall(callId?: string): Promise<boolean> {
export async function end(callId?: string): Promise<boolean> {
const callOut = [
CALL_STATES.ACTIVE,
CALL_STATES.OUTGOING_CALLING,
Expand Down
8 changes: 4 additions & 4 deletions src/call/functions/index.ts
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

export { acceptCall } from './acceptCall';
export { endCall } from './endCall';
export { rejectCall } from './rejectCall';
export { sendCallOffer } from './sendCallOffer';
export { accept } from './accept';
export { end } from './end';
export { offer } from './offer';
export { reject, reject as rejectCall } from './reject';
Expand Up @@ -41,12 +41,12 @@ export interface CallOfferOptions {
* @example
* ```javascript
* // Send a call offer
* WPP.call.sendCallOffer('[number]@c.us');
* WPP.call.offer('[number]@c.us');
* // Send a video call offer
* WPP.call.sendCallOffer('[number]@c.us', {isVideo: true});
* WPP.call.offer('[number]@c.us', {isVideo: true});
* ```
*/
export async function sendCallOffer(
export async function offer(
to: string | Wid,
options: CallOfferOptions = {}
): Promise<any> {
Expand Down
Expand Up @@ -24,21 +24,21 @@ import { CALL_STATES } from '../../whatsapp/enums';
* @example
* ```javascript
* // Reject any incoming call
* WPP.call.rejectCall();
* WPP.call.reject();
*
* // Reject specific call id
* WPP.call.rejectCall(callId);
* WPP.call.reject(callId);
*
* // Reject any incoming call
* WPP.on('call.incoming_call', (call) => {
* WPP.call.rejectCall(call.id);
* WPP.call.reject(call.id);
* });
* ```
*
* @param {string} callId The call ID, empty to reject the first one
* @return {[type]} [return description]
*/
export async function rejectCall(callId?: string): Promise<boolean> {
export async function reject(callId?: string): Promise<boolean> {
let call: CallModel | undefined = undefined;

if (callId) {
Expand Down

0 comments on commit f54cc87

Please sign in to comment.