unisender-ts
v0.1.0
Published
Typescript Interface for Unisender GO web API
Downloads
49
Readme
unisender-ts
Typescript Interface for Unisender GO web API.
Based on Unisender API documentation.
Features
- Uses the Fetch API
- Tree-shakable
- No dependencies
- Typescript support
- 100% test coverage
Installation
npm install unisender-ts
Usage
Basic usage
import { Unisender } from 'unisender-ts';
const unisender = new Unisender(
"https://go1.unisender.ru/ru/transactional/api/v1",
"<your api key>"
);
await unisender.send({
message: {
recipients: [
{ email: '[email protected]' },
],
subject: "Hello, world!",
body: {
plaintext: "This is a test email",
},
global_language: "en",
from_name: "John Doe",
from_email: "[email protected]",
},
});
Import only the functions you need
To reduce the size of the bundle, you can import only the functions you need:
import { send } from 'unisender-ts';
await send(
"https://go1.unisender.ru/ru/transactional/api/v1",
"<your api key>",
{
message: {
recipients: [
{ email: '[email protected]' },
],
subject: "Hello, world!",
body: {
plaintext: "This is a test email",
},
global_language: "en",
from_name: "John Doe",
from_email: "[email protected]",
},
},
);
Development
This project uses the bun runtime for development tasks. Linting and formatting is done using biome. Building is done using tsc.
# install dependencies:
bun install
# run tests
bun test
# run linter
bun run lint
# run code formatter
bun run format
# build project
bun run build