1.1.5 • Published 4 years ago

zevvle-sdk-node v1.1.5

Weekly downloads
18
License
ISC
Repository
github
Last release
4 years ago

zevvle-sdk-node

The unofficial Node library and SDK for the Zevvle API.

npm

Prerequisites

You can grab a SIM card from them and get hacking with the docs available here.

To get an API key, sign in here

Installation

Yarn:

yarn add zevvle-sdk-node

Npm:

npm install zevvle-sdk-node

Usage

As an import

import { Zevvle } from 'zevvle-sdk-node'
const zev = new Zevvle(`${ZEVVLE_KEY}`)

async function listSimCards() => {
  try {
    const simCards = await zev.listSimCards()
    console.log(simCards)
  } catch (err) {
    console.error(err)
  }
}

API

Table of contents

Constructors

Methods

Constructors

constructor

+ new Zevvle(key: string, url?: string): Zevvle

Initialises the SDK.

Parameters:

NameTypeDefault valueDescription
keystring-Your Zevvle API key.
urlstringhttps://api.zevvle.com(optional) The Zevvle API URL.

Returns: Zevvle instance.

Methods

logout

logout(): Promise<ResponseModel>

Logout and destroy your token.

Returns: Response message.


getPricing

getPricing(originIso3?: string, destinationIso3?: string): Promise<PricingModel>

Get pricing for any country, or between 2 countries.

Parameters:

NameTypeDescription
originIso3?string(optional) Origin country. Defaults to GBR.
destinationIso3?string(optional) Destination country. Defaults to originIso3.

Returns: Pricing for a country, or between 2 countries.


getNonGeoPricing

getNonGeoPricing(phoneNumber: string): Promise<NonGeoPricingModel>

Get pricing for Non-Geographic numbers.

Parameters:

NameTypeDescription
phoneNumberstringA non-geographic number.

Returns: Pricing for a non-geographic number.


getAccount

getAccount(accountId: string): Promise<AccountModel>

Looks up Zevvle account.

Parameters:

NameTypeDescription
accountIdstringID of the Zevvle account.

Returns: Zevvle account details.


getCharge

getCharge(chargeId: string): Promise<ChargeModel>

Looks up a charge.

Parameters:

NameTypeDescription
chargeIdstringID of the charge.

Returns: The details of a charge.


listCharges

listCharges(limit?: string, before?: string, after?: string): Promise<ChargeModel[]>

List all charges linked to the Zevvle API key.

Parameters:

NameTypeDescription
limit?string(optional) Limit the number of records; default 10, maximum 100.
before?string(optional) Get records before an RFC 3339-encoded timestamp or record id.
after?string(optional) Get records after an RFC 3339-encoded timestamp or record id.

Returns: A list of charges for your account.


getUser

getUser(userId: string): Promise<UserModel>

Looks up Zevvle user.

Parameters:

NameTypeDescription
userIdstringID of Zevvle user to look up.

Returns: Zevvle user details.


getSim

getSim(simId: string): Promise<SIMCardModel>

Looks up a Zevvle SIM card.

Parameters:

NameTypeDescription
simIdstringID of the Zevvle SIM card to look up.

Returns: Zevvle SIM card details.


listSimCards

listSimCards(): Promise<SIMCardModel[]>

List all SIM cards linked to the Zevvle API key.

Returns: SIM cards for the API key in use.


getCallRecord

getCallRecord(recordId: string): Promise<CallRecordModel>

Looks up Zevvle call record.

Parameters:

NameTypeDescription
recordIdstringID of the Zevvle record to look up.

Returns: Zevvle call record details.


listCallRecords

listCallRecords(simId: string, type?: string, limit?: string, before?: string, after?: string): Promise<CallRecordModel[]>

List call records for a given Zevvle SIM ID, according to filtering.

Parameters:

NameTypeDescription
simIdstringID of the Zevvle SIM card to look up.
type?string(optional) Call record type (data, voice, sms, mms) to filter on.
limit?string(optional) Limit the number of records; default 10, maximum 100.
before?string(optional) Get records before an RFC 3339-encoded timestamp or record id.
after?string(optional) Get records after an RFC 3339-encoded timestamp or record id.

Returns: Call records for the given query.


createWebhook

createWebhook(url: string, simCardId?: string, type?: string): Promise<WebhookResponseModel>

Create a webhook.

Parameters:

NameTypeDescription
urlstringThe URL to send notifications to. Must be HTTPS.
simCardId?string(optional) ID of SIM card to receive notifications for. If empty will default to all SIM cards.
type?string(optional) The matching event type (data.created, voice.created, sms.created, mms.created, charge.created, null)

Returns: A webhook response.


deleteWebhook

deleteWebhook(webhookId: string): Promise<any>

Delete a webhook

Parameters:

NameTypeDescription
webhookIdstringWebhook ID.

Returns: Response message.


listWebhooks

listWebhooks(simCardId?: string): Promise<WebhookResponseModel[]>

List webhooks.

Parameters:

NameTypeDescription
simCardId?string(optional) SIM card to retrieve the webhooks for. Defaults to all your webhooks.

Returns: A list of webhooks.

Contributions

Contributions are welcome : )

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

1.0.1

4 years ago