npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vonage/server-client

v1.16.1

Published

The Vonage Server Client provides core functionalities for interacting with Vonage APIs, ensuring a standardized response regardless of the underlying HTTP adapter.

Downloads

221,659

Readme

Vonage Server Client SDK for Node.js

GitHub Workflow Status Codecov Latest Release Contributor Covenant License

This is the Vonage Server Client SDK for Node.js used to wrap the authentication headers/signatures for use with Vonage APIs. To use it you will need a Vonage account. Sign up for free at vonage.com.

For full API documentation refer to developer.vonage.com.

Installation

With NPM

npm install @vonage/server-client

With Yarn

yarn add @vonage/server-client

Usage

To create a client, you will need to pass in a @vonage/auth object.

const { Auth } = require('@vonage/auth');
const { Client } = require('@vonage/server-client');

const vonageClient = new Client (new Auth({
        apiKey: API_KEY,
        apiSecret: API_SECRET,
        applicationId: APP_ID,
        privateKey: PRIVATE_KEY_PATH,
    }),
    options,
);

You will now be able to send requests using the client:

const response = await vonageClient.sendGetRequest('https://rest.nexmo.com/account/numbers')

Options

The constructor for the client takes in two parameters credentials and options. credentials is either an Auth or an object containing the settings from AuthInterface.

options allows adjusting api endpoints and the request timeout.

  • restHost: string (optional) - Allows overwriting the default https://rest.nexmo.com.
  • apiHost: string (optional) - Allows overwriting the default https://api.nexmo.com.
  • videoHost: string (optional) - Allows overwriting the default https://video.api.vonage.com.
  • timeout: int (optional) - Set a custom timeout for requests to Vonage in milliseconds. Defaults to the standard for Node http requests, which is 120,000 ms.
  • appendUserAgent: string (optional) - Set a custom string to be added to the user-agent header for the request

File Downloads

When downloading files, the request needs to be built with proper security headers set. Inside this package is the FileClient which will handle the request. You can download a file using the File Id or the FQURL.

const { Auth } = require('@vonage/auth');
const { FileClient } = require('@vonage/server-client');

const fileClient = new FileClient(new Auth({
    apiKey: API_KEY,
    apiSecret: API_SECRET,
    applicationId: APP_ID,
    privateKey: PRIVATE_KEY_PATH,
  }),
  options,
);

await fileClient.downloadFile('the-file-id-or-url', '/paht/to/save');

Testing

Run:

npm run test