1.0.1 • Published 23 days ago

@koibanx/notification-sdk v1.0.1

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
23 days ago

Koibanx Notification SDK

Description

Notification SDK based in module Notifications

SDK Documentation

Feast yourself

Koibanx module dependencies

Installation

npm install @koibanx/notification-sdk

NOTE: you must have the npm token in your .npmrc file


Initialization

Node

Using ES6 import

import NotificationApi from '@koibanx/notification-sdk';

const notificationApi = NotificationApi({
    baseURL: 'http://localhost:3005',
    headers: {
        "Authorization": "JWT some-token",
    }
});

With require

exports.__esModule = true;
const NotificationApi = require('@koibanx/notification-sdk')["default"];

const notificationApi = NotificationApi({
    baseURL: 'http://localhost:3005',
    headers: {
        "Authorization": "JWT some-token",
    }
});

Types

  • Typescript (@koibanx/notification-sdk/dist/index.d.ts)

Examples

Using ES6 import

import NotificationsSdk, { NotificationType } from "@koibanx/notification-sdk";

const notification = NotificationsSdk({
    baseURL: 'http://your-url',
    headers: {
        "Authorization": "JWT some-token",
    },
})

notification.sendNotification({
    type: NotificationType.MAIL,
    url: '',
    body: 'This is a text',
    receiver: 'user@domain.com',
    sender: 'user@domain.com',
    title: 'This is a title'
}).then((res) => {
    console.log('Response: ', res);
}).catch((err: any) => {
    console.log('this details: ', err.details);
    console.log('this shortMessage: ', err.message);
    console.log('this errorCode', err.code)
})

notification.sms.sendSms({
    phone: '1000000000',
    text: 'This is a text'
}).then((res) => {
    console.log('Response: ', res);
}).catch((err) => {
    console.log(err.details);
    console.log(err.code)
    console.log(err.message)
})
1.0.1

23 days ago

1.0.0

23 days ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago