swu-logs

1.0.1 • Public • Published

swu-logs

A small library for interacting with the SendWIthUs Logs API, complete with full TypeScript typings and async functions.

Installation

npm install swu-logs --save

If you're using TypeScript, the compiler should automatically pick up the package's typings (assuming you're on version 1.9+).

Usage

The library is exported with ES6's export default syntax. To import it into your script, do the following:

//ES6-style import
import Client from "swu-logs";
 
//Node-style require
const Client = require("swu-logs").default;

Then, initialize the client:

const client = new Client(apiKey)

List logs

const logs = await client.list();
 
// Or use promises 
client.list().then((logs) => {
 
})

Get a single logs

const log = await client.get(logId);
 
// Or use promises
client.get(logId).then((log) => {
 
})

Get events for a log

const events = await client.getEvents(logId);
 
// Or use promises
client.getEvents(logId).then((events) => {
 
})

Resend an email from a log

const result = await client.resend(logId);
 
if (result.success) {
    ...
}
 
// Or use promises
client.resend(logId).then((result) => {
    if (result.success) {
        ...
    }
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    6
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    6
  • 1.0.0
    0

Package Sidebar

Install

npm i swu-logs

Weekly Downloads

6

Version

1.0.1

License

MIT

Last publish

Collaborators

  • nozzlegear