From f54cc87a1d04fc2bf9afa536bd72872634cf8185 Mon Sep 17 00:00:00 2001 From: Edgard Date: Tue, 28 Mar 2023 22:29:32 -0300 Subject: [PATCH] fix: Renamed all call functions --- src/call/functions/{acceptCall.ts => accept.ts} | 8 ++++---- src/call/functions/{endCall.ts => end.ts} | 8 ++++---- src/call/functions/index.ts | 8 ++++---- src/call/functions/{sendCallOffer.ts => offer.ts} | 6 +++--- src/call/functions/{rejectCall.ts => reject.ts} | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) rename src/call/functions/{acceptCall.ts => accept.ts} (94%) rename src/call/functions/{endCall.ts => end.ts} (94%) rename src/call/functions/{sendCallOffer.ts => offer.ts} (96%) rename src/call/functions/{rejectCall.ts => reject.ts} (93%) diff --git a/src/call/functions/acceptCall.ts b/src/call/functions/accept.ts similarity index 94% rename from src/call/functions/acceptCall.ts rename to src/call/functions/accept.ts index c3746927a2..c4e8f118fc 100644 --- a/src/call/functions/acceptCall.ts +++ b/src/call/functions/accept.ts @@ -24,15 +24,15 @@ 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); * }); * ``` @@ -40,7 +40,7 @@ import { CALL_STATES } from '../../whatsapp/enums'; * @param {string} callId The call ID, empty to accept the first one * @return {[type]} [return description] */ -export async function acceptCall(callId?: string): Promise { +export async function accept(callId?: string): Promise { let call: CallModel | undefined = undefined; if (callId) { diff --git a/src/call/functions/endCall.ts b/src/call/functions/end.ts similarity index 94% rename from src/call/functions/endCall.ts rename to src/call/functions/end.ts index d6a0265d18..43aec48bc7 100644 --- a/src/call/functions/endCall.ts +++ b/src/call/functions/end.ts @@ -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 { +export async function end(callId?: string): Promise { const callOut = [ CALL_STATES.ACTIVE, CALL_STATES.OUTGOING_CALLING, diff --git a/src/call/functions/index.ts b/src/call/functions/index.ts index 428be2da7c..7c6deaffcc 100644 --- a/src/call/functions/index.ts +++ b/src/call/functions/index.ts @@ -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'; diff --git a/src/call/functions/sendCallOffer.ts b/src/call/functions/offer.ts similarity index 96% rename from src/call/functions/sendCallOffer.ts rename to src/call/functions/offer.ts index 913da308d9..f571d7abd8 100644 --- a/src/call/functions/sendCallOffer.ts +++ b/src/call/functions/offer.ts @@ -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 { diff --git a/src/call/functions/rejectCall.ts b/src/call/functions/reject.ts similarity index 93% rename from src/call/functions/rejectCall.ts rename to src/call/functions/reject.ts index ee034d4d9a..310d9631ed 100644 --- a/src/call/functions/rejectCall.ts +++ b/src/call/functions/reject.ts @@ -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 { +export async function reject(callId?: string): Promise { let call: CallModel | undefined = undefined; if (callId) {