New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

termii-nodejs-client

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

termii-nodejs-client - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

dist/services/message/message.spec.d.ts

16

dist/api.d.ts
import { AxiosInstance } from 'axios';
import { IAxiosStruct } from './utils';
/**
* Represents the TermiiCore class, which provides an interface for making HTTP requests using Axios with a specific API key.
*/
export declare class TermiiCore {
apiKey: string;
/**
* The AxiosInstance used to make HTTP requests.
* @type {AxiosInstance}
*/
request: AxiosInstance;
/**
* Constructs a new TermiiCore instance.
* @param {string} apiKey - The API key used for authentication in API requests.
*/
constructor(apiKey: string);
/**
* Makes an HTTP request using Axios based on the provided request structure.
* @param {IAxiosStruct} req - The request structure containing method, URL, and data.
* @returns {Promise} A promise that resolves with the Axios response or rejects with an error.
*/
useRequest(req: IAxiosStruct): Promise<import("axios").AxiosResponse<any, any>>;
}

24

dist/services/message/message.d.ts
import { TermiiCore } from '../../api';
import { ISendMessageResponse, ISendMessage, ISendBulkMessage } from '../../types/message';
import { ISendMessageResponse, ISendMessage, ISendBulkMessage, ISendBulkMessageResponse } from '../../types/message';
/**
* The Message class extends the TermiiCore class and provides methods for sending messages.
* @class Message
* @extends {TermiiCore}
*/
export declare class Message extends TermiiCore {
/**
* Constructs a new Message instance with the provided API key.
* @constructor
* @param {string} apiKey - The API key used for authorization.
*/
constructor(apiKey: string);
/**
* Sends a single message using the Termii API.
* @param {ISendMessage} data - The message data to be sent.
* @returns {Promise<ISendMessageResponse>} A promise that resolves with the API response for the sent message.
*/
sendMessage(data: ISendMessage): Promise<ISendMessageResponse>;
sendBulkMessage(data: ISendBulkMessage): Promise<ISendMessageResponse>;
/**
* Sends messages in bulk using the Termii API.
* @param {ISendBulkMessage} data - The bulk message data to be sent.
* @returns {Promise<ISendBulkMessageResponse>} A promise that resolves with the API response for the sent bulk messages.
*/
sendBulkMessage(data: ISendBulkMessage): Promise<ISendBulkMessageResponse>;
}

@@ -503,6 +503,14 @@ 'use strict';

/**
* Represents the TermiiCore class, which provides an interface for making HTTP requests using Axios with a specific API key.
*/
var TermiiCore = /*#__PURE__*/function () {
/**
* Constructs a new TermiiCore instance.
* @param {string} apiKey - The API key used for authentication in API requests.
*/
function TermiiCore(apiKey) {
this.apiKey = apiKey;
this.apiKey = apiKey;
// Create an Axios instance with a base URL and common headers.
this.request = axios.create({

@@ -516,4 +524,11 @@ baseURL: BASE_URL,

}
/**
* Makes an HTTP request using Axios based on the provided request structure.
* @param {IAxiosStruct} req - The request structure containing method, URL, and data.
* @returns {Promise} A promise that resolves with the Axios response or rejects with an error.
*/
var _proto = TermiiCore.prototype;
_proto.useRequest = /*#__PURE__*/function () {
_proto.useRequest =
/*#__PURE__*/
function () {
var _useRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {

@@ -576,9 +591,26 @@ var method, url, data;

/**
* The Message class extends the TermiiCore class and provides methods for sending messages.
* @class Message
* @extends {TermiiCore}
*/
var Message = /*#__PURE__*/function (_TermiiCore) {
_inheritsLoose(Message, _TermiiCore);
/**
* Constructs a new Message instance with the provided API key.
* @constructor
* @param {string} apiKey - The API key used for authorization.
*/
function Message(apiKey) {
return _TermiiCore.call(this, apiKey) || this;
}
/**
* Sends a single message using the Termii API.
* @param {ISendMessage} data - The message data to be sent.
* @returns {Promise<ISendMessageResponse>} A promise that resolves with the API response for the sent message.
*/
var _proto = Message.prototype;
_proto.sendMessage = /*#__PURE__*/function () {
_proto.sendMessage =
/*#__PURE__*/
function () {
var _sendMessage = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {

@@ -610,4 +642,12 @@ var requestObj, response;

return sendMessage;
}();
_proto.sendBulkMessage = /*#__PURE__*/function () {
}()
/**
* Sends messages in bulk using the Termii API.
* @param {ISendBulkMessage} data - The bulk message data to be sent.
* @returns {Promise<ISendBulkMessageResponse>} A promise that resolves with the API response for the sent bulk messages.
*/
;
_proto.sendBulkMessage =
/*#__PURE__*/
function () {
var _sendBulkMessage = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {

@@ -643,6 +683,6 @@ var requestObj, response;

/**
* The Termii class is the main class that is used to access the other classes
* The Termii class is the main class used to access the other classes in the Termii library.
* @class Termii
* @param {string} apiKey - The api key to authorize usage
* @returns The Termii class
* @param {string} apiKey - The API key used for authorization.
* @returns An instance of the Termii class.
* @example

@@ -654,4 +694,14 @@ * const termii = new Termii('pk_NjI3ZmVmYmU1YTY1ZWM5OWJhOWFmMGJlOjoxMjE2NzA);

this.apiKey = apiKey;
// Initialize the Message instance with the API key.
this.messageInstance = new Message(apiKey);
}
/**
* Provides access to methods related to sending messages.
* @type {Object}
* @property {Function} sendMessage - Sends a single message.
* @property {Function} sendBulkMessage - Sends messages in bulk.
* @example
* const termii = new Termii('pk_NjI3ZmVmYmU1YTY1ZWM5OWJhOWFmMGJlOjoxMjE2NzA');
* termii.switch.sendMessage(<!-- message data -->);
*/
_createClass(Termii, [{

@@ -658,0 +708,0 @@ key: "switch",

@@ -497,6 +497,14 @@ import axios from 'axios';

/**
* Represents the TermiiCore class, which provides an interface for making HTTP requests using Axios with a specific API key.
*/
var TermiiCore = /*#__PURE__*/function () {
/**
* Constructs a new TermiiCore instance.
* @param {string} apiKey - The API key used for authentication in API requests.
*/
function TermiiCore(apiKey) {
this.apiKey = apiKey;
this.apiKey = apiKey;
// Create an Axios instance with a base URL and common headers.
this.request = axios.create({

@@ -510,4 +518,11 @@ baseURL: BASE_URL,

}
/**
* Makes an HTTP request using Axios based on the provided request structure.
* @param {IAxiosStruct} req - The request structure containing method, URL, and data.
* @returns {Promise} A promise that resolves with the Axios response or rejects with an error.
*/
var _proto = TermiiCore.prototype;
_proto.useRequest = /*#__PURE__*/function () {
_proto.useRequest =
/*#__PURE__*/
function () {
var _useRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {

@@ -570,9 +585,26 @@ var method, url, data;

/**
* The Message class extends the TermiiCore class and provides methods for sending messages.
* @class Message
* @extends {TermiiCore}
*/
var Message = /*#__PURE__*/function (_TermiiCore) {
_inheritsLoose(Message, _TermiiCore);
/**
* Constructs a new Message instance with the provided API key.
* @constructor
* @param {string} apiKey - The API key used for authorization.
*/
function Message(apiKey) {
return _TermiiCore.call(this, apiKey) || this;
}
/**
* Sends a single message using the Termii API.
* @param {ISendMessage} data - The message data to be sent.
* @returns {Promise<ISendMessageResponse>} A promise that resolves with the API response for the sent message.
*/
var _proto = Message.prototype;
_proto.sendMessage = /*#__PURE__*/function () {
_proto.sendMessage =
/*#__PURE__*/
function () {
var _sendMessage = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {

@@ -604,4 +636,12 @@ var requestObj, response;

return sendMessage;
}();
_proto.sendBulkMessage = /*#__PURE__*/function () {
}()
/**
* Sends messages in bulk using the Termii API.
* @param {ISendBulkMessage} data - The bulk message data to be sent.
* @returns {Promise<ISendBulkMessageResponse>} A promise that resolves with the API response for the sent bulk messages.
*/
;
_proto.sendBulkMessage =
/*#__PURE__*/
function () {
var _sendBulkMessage = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {

@@ -637,6 +677,6 @@ var requestObj, response;

/**
* The Termii class is the main class that is used to access the other classes
* The Termii class is the main class used to access the other classes in the Termii library.
* @class Termii
* @param {string} apiKey - The api key to authorize usage
* @returns The Termii class
* @param {string} apiKey - The API key used for authorization.
* @returns An instance of the Termii class.
* @example

@@ -648,4 +688,14 @@ * const termii = new Termii('pk_NjI3ZmVmYmU1YTY1ZWM5OWJhOWFmMGJlOjoxMjE2NzA);

this.apiKey = apiKey;
// Initialize the Message instance with the API key.
this.messageInstance = new Message(apiKey);
}
/**
* Provides access to methods related to sending messages.
* @type {Object}
* @property {Function} sendMessage - Sends a single message.
* @property {Function} sendBulkMessage - Sends messages in bulk.
* @example
* const termii = new Termii('pk_NjI3ZmVmYmU1YTY1ZWM5OWJhOWFmMGJlOjoxMjE2NzA');
* termii.switch.sendMessage(<!-- message data -->);
*/
_createClass(Termii, [{

@@ -652,0 +702,0 @@ key: "switch",

/**
* The Termii class is the main class that is used to access the other classes
* The Termii class is the main class used to access the other classes in the Termii library.
* @class Termii
* @param {string} apiKey - The api key to authorize usage
* @returns The Termii class
* @param {string} apiKey - The API key used for authorization.
* @returns An instance of the Termii class.
* @example

@@ -11,8 +11,22 @@ * const termii = new Termii('pk_NjI3ZmVmYmU1YTY1ZWM5OWJhOWFmMGJlOjoxMjE2NzA);

apiKey: string;
/**
* An instance of the Message class for sending messages.
* @private
* @type {Message}
*/
private messageInstance;
constructor(apiKey: string);
/**
* Provides access to methods related to sending messages.
* @type {Object}
* @property {Function} sendMessage - Sends a single message.
* @property {Function} sendBulkMessage - Sends messages in bulk.
* @example
* const termii = new Termii('pk_NjI3ZmVmYmU1YTY1ZWM5OWJhOWFmMGJlOjoxMjE2NzA');
* termii.switch.sendMessage(<!-- message data -->);
*/
get switch(): {
sendMessage: (data: import("./types").ISendMessage) => Promise<import("./types").ISendMessageResponse>;
sendBulkMessage: (data: import("./types").ISendBulkMessage) => Promise<import("./types").ISendMessageResponse>;
sendBulkMessage: (data: import("./types").ISendBulkMessage) => Promise<import("./types").ISendBulkMessageResponse>;
};
}

3

dist/utils/interfaces/axios.d.ts

@@ -1,6 +0,5 @@

import { ISendBulkMessage, ISendMessage } from '../../types';
export interface IAxiosStruct {
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
url: string;
data?: ISendMessage | ISendBulkMessage;
data?: any;
}
{
"name": "termii-nodejs-client",
"version": "0.1.1",
"version": "0.1.2",
"description": "Nodejs SDK wrapper for Termii API written with Typescript support",

@@ -50,2 +50,3 @@ "author": "Emmanuel Raymond",

"class-validator": "^0.14.0",
"dotenv": "^16.3.1",
"jest": "^29.6.2",

@@ -52,0 +53,0 @@ "ts-jest": "^29.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc