1.0.9 • Published 2 years ago

streambird v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Streambird Node.js Library

The official Node.js library for integrating with the Streambird API.

Documentation can be found at https://developers.streambird.io/

This library is only for use on the backend, as it uses Streambird API tokens which must be kept secret.

This version uses Streambird API v1.0.

Installation

For npm:

npm install streambird

For Yarn:

yarn add streambird

Getting started

Require the package:

const { Streambird } = require("streambird");

For TypeScript users, types are available as well:

import { Streambird, User, StreambirdApiError } from "streambird";

Configure with your API token and region:

const streambird = new Streambird({
  apiKey: process.env.STREAMBIRD_API_TOKEN,
});

Using with async/await (in an async function):

try {
  const user = await streambird.users.create({
    firstName: "Wayne",
    middleName: "Payne",
    lastName: "Schmein",
    email: "wayneps@streambird.io",
    phoneNumber: "+15555551000",
    requiresVerification: true,
  });

  return user;
} catch (error) {
  if (error instanceof StreambirdApiError) {
    console.log(error.message);
    console.log(error.type);
    console.log(error.isClientError());
  } else {
    console.log(error.message);
  }
}

Using with promises:

streambird.users
  .create({
    firstName: "Wayne",
    middleName: "Payne",
    lastName: "Schmein",
    email: "wayneps@streambird.io",
    phoneNumber: "+15555551000",
    requiresVerification: true,
  })
  .then(user =>
    // Handle successfully created user.
  )
  .catch(error => {
    // Handle error.
  });

Response format

Most responses will be normal JavaScript objects. Property names will be in camelCase rather than snake_case, including property names in nested objects.

const user = await streambird.users.create({
  firstName: "Wayne",
  middleName: "Payne",
  lastName: "Schmein",
  email: "wayneps@streambird.io",
  phoneNumber: "+15555551000",
  requiresVerification: true,
});

console.log(user);
{
  userId: "user_27omXGknF0uVnO4fpVLbP6cVM8v",
  appId: "0a6aa9d3-2786-461c-950e-c4b9e00c826e",
  firstName: "Wayne",
  middleName: "Payne",
  lastName: "Schmein",
  status: "pending",
  active: false,
  updatedAt: 1649994850,
  createdAt: 1649994850,
  emails: null,
  phoneNumbers: null,
  wallets: null,
  emailId: "email_27omXJMY3TqFKQrlZLNFDoifWwV",
  phoneNumberId: "pn_27omXFBBiC5JC0UFNmA2X5JtGg3",
  requiresVerification: true,
  email: "wayneps@streambird.io",
  phoneNumber: "+15555551000"
}

More documentation

More documentation and code examples can be found at https://developers.streambird.io/

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.1

2 years ago

1.0.3

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago

7.5.0

2 years ago

7.3.0

2 years ago

7.1.0

2 years ago