0.0.9 • Published 2 years ago

@opengovsg/postmangovsg-client v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago