@zenvia/sdk
Version:
This SDK for [Node.js](https://nodejs.org/) was created based on the [Zenvia](https://www.zenvia.com/) [API](https://zenvia.github.io/zenvia-openapi-spec/).
39 lines (38 loc) • 1.49 kB
TypeScript
import { IChannel, IMessage, Channel, IContent, ILoggerInstance, IClientOptions } from '../../types';
import { Logger } from '../../utils/logger';
/**
* Implementation of base channel.
*/
export declare abstract class AbstractChannel implements IChannel {
private options;
private token;
private channel;
protected logger: Logger;
constructor(token: string, channel: Channel, loggerInstance: ILoggerInstance, options: IClientOptions);
/**
* This method sends the message to the channel.
*
* @param from The sender identifier of the message.
* @param to The recipient identifier of the message.
* @param contents An array of [[IContent]] object that will be sent.
* @returns A promise that resolves to an [[IMessage]] object.
*/
sendMessage(from: string, to: string, ...contents: IContent[]): Promise<IMessage>;
/**
* This method creates a message.
*
* @param from The sender identifier of the message.
* @param to The recipient identifier of the message.
* @param contents An array of [[IContent]] object that will be sent.
* @returns An [[IMessageRequest]] object.
*/
private createMessage;
/**
* This method requests to the endpoint.
*
* @param message An [[IMessageRequest]] object.
* @returns A promise that resolves to an [[IMessage]] object.
*/
private request;
protected abstract contentSupportValidation(content: IContent): void | never;
}