@securecall/client-api
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

SecureCall Client API Library

This library provides helper functions to make consuming the SecureCall Client API easier from Javascript/Typescript. It provides the following

  • sets up the SSE stream for status updates
  • emits Events on session, authentication and configuration updates
  • has helper functions for each of the APIs

Install

npm install --save @securecall/client-api

Usage

<body>
<script type="module">
    import {SecureCallClientAPI} from "https://unpkg.com/@securecall/client-api";

    let api = new SecureCallClientAPI('https://client.<region>.securecallapi.cloud')

    api.addEventListener('authentication',(evt) => {
        if(evt.success) {
            console.log('Authentication Success message: ', evt)
        } else {
            console.log('Authentication Failure message: ', evt)
        }
    })

    api.addEventListener('session',(evt) => {
        console.log('Session message: ', evt)
    })

    api.addEventListener('configuration',(evt) => {
        console.log('Configuration message: ', evt)
        console.log('  gateways: ', evt.gateways)
    })

    api.authenticate(<email>, <password>, true)
    console.debug('connecting')
</script>

Authentication

There are multiple ways to authenticating to SecureCall using this library. Further details are in the Client API OpenAPI spec found here https://client.au.securecallapi.cloud/v1/

The SecureCallClientAPI class has members for email, password and useCookie. These can be set manually and then connect() called or passed via authenticate() which will set them and then call connect().

🏭 SecureCallClientAPI

Methods

⚙️ authenticate

Method Type
authenticate (email?: string or undefined, password?: string or undefined, useCookie?: boolean or undefined) => Promise<void>

Parameters:

  • email: - email address of the user
  • password: - password of the user. This could be a Webex Org ID, SecureCall API Key or a password
  • useCookie: - true if cookies will be used for all API requests or false to send the email/password each time

⚙️ login

login uses the email/password to log into the Client API. Typically only used when cookies are used.

Method Type
login () => Promise<void>

⚙️ logout

Logs out of the SecureCall Client API and disconnects the event stream

Method Type
logout () => Promise<void>

⚙️ secure

Attempts to secure the call. All updates come through the event stream and will be emitted as Events

Method Type
secure () => Promise<void>

⚙️ reset

Method Type
reset (v?: string or string[] or undefined) => Promise<void>

Parameters:

  • v: - if empty, will attempt to reset all the PCI fields, if a string will attempt to reset just that field or can be an array of field name

⚙️ submit

Method Type
submit (data: IPaymentValues) => Promise<void>

Parameters:

  • data: - submits payment data

⚙️ telephony

Method Type
telephony (data: ITelephony) => Promise<void>

Parameters:

  • data: - update telephony state for Client Telephony

⚙️ connect

connects the event stream using email/password/useCookie

Method Type
connect () => Promise<void>

⚙️ disconnect

disconnects the event stream connection

Method Type
disconnect () => void

Who do I talk to?

Dependents (0)

Package Sidebar

Install

npm i @securecall/client-api

Weekly Downloads

6

Version

0.1.3

License

SEE LICENSE IN LICENSE.txt

Unpacked Size

220 kB

Total Files

11

Last publish

Collaborators

  • securecall-dev