cttox / rackspace-email-api-wrapper

Rackspace Email API Wrapper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rackspace Email API Wrapper

npm pack age

Version Build Status

Maintainability Test Coverage Greenkeeper badge

Weekly Downloads Monthly Downloads Yearly Downloads

Issues Pull Requests

Dependencies Dev Dependencies

Rackspace Email API Wrapper is a wrapper for making calls to Rackspace's Email API

Rackspace Documentation

Installation

yarn install rackspace-email-api-wrapper

Getting Started

const rackspace = require('rackspace-email-api-wrapper');

rackspace.init(YOUR_USER_KEY, YOUR_SECRET_KEY);

const getCustomer = async () => {
	const response = await rackspace.api('GET', `/customers?startswith=UserName`);

	console.log(response);

	// OR

	rackspace.api('GET', `/customers?startswith=UserName`).then((response) => {
		console.log(repsonse);
	});
};

const createCustomer = async () => {
	const response = await rackspace.api('POST', '/customers', {
		name: 'UserName',
	});

	console.log(response);

	// OR

	rackspace
		.api('POST', '/customers', {
			name: 'UserName',
		})
		.then((response) => {
			console.log(repsonse);
		});
};

API

init - init(key, secret)

The init method sets the key and secret used for authenticating the API calls

api - api(method, url, payload)

The api method creates a signed request and parses the response. It returns a promise that can be awaited if you are using asycn / await

About

Rackspace Email API Wrapper


Languages

Language:JavaScript 100.0%