0.0.9 • Published 9 months ago

@opengovsg/postmangovsg-client v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

postmangovsg-client

An OpenAPI client and nodemailer transport for postman.gov.sg

Usage

Nodemailer

A custom transport that wraps around the API Client for nodemailer is provided, so that users can send transactional emails using nodemailer's familiar programmatic API

import nodemailer from 'nodemailer'
import { PostmanNodemailerTransport } from '@opengovsg/postmangovsg-client'

const transport = new PostmanNodemailerTransport(process.env.POSTMANGOVSG_API_KEY)
const mailer = nodemailer.createTransport(transport)

const mail = { 
  to: 'team@open.gov.sg', 
  subject: 'Hello World', 
  html: 'Product <b>Launched!</b>',
  // text: 'Product Launched!',
}

mailer.sendMail(mail, (err, info) => {
  if (err) {
    console.error(err, info)
  } else {
    console.log(info)
  }
})

API Client

An OpenAPI client was generated using openapi-generator and the Postman OpenAPI spec. The resulting clients and models are accessible via imports from @opengovsg/postmangovsg-client

0.0.9

9 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago