1.0.0 • Published 3 years ago

bloodbath v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

workflow

Bloodbath Node Library

The Bloodbath Node library provides convenient access to the Bloodbath API from applications written in the Javascript language.

Installation

Install the package with:

npm install bloodbath --save
# or
yarn add bloodbath

Usage

Configuration

The library needs to be configured with your account's API key which is available in your Bloodbath Dashboard. Set it to its value:

const bloodbath = require('bloodbath')('NTI6PASMD9BQhYtRh...');

bloodbath.scheduleEvent({
  ...
})
.then(event => console.log(event.id))
.catch(error => console.error(error))

Or using ES modules and async/await:

import Bloodbath from 'bloodbath';
const bloodbath = new Bloodbath('NTI6PASMD9BQhYtRh...');

(async () => {
  const event = await bloodbath.scheduleEvent({
    ...
  });

  console.log(event.id);
})();

Events

// schedule an event
Bloodbath.scheduleEvent({
  scheduledFor: Date.now() + 1000 * 60,
  headers: {},
  method: :post,
  body: "some body content",
  endpoint: 'https://api.acme.com/path'
})

// list events
Bloodbath.listEvents()

// find an event
Bloodbath.findEvent('b7ccff...')

// cancel an event
Bloodbath.cancelEvent('b7ccff...')

For more documentation about how to use Bloodbath, don't hesitate to check Bloodbath Docs.

Development

Run all tests:

  $ npm install
  $ npm test
1.0.0

3 years ago