dymo-api
Version:
Flow system for Dymo API.
59 lines (58 loc) • 3.47 kB
TypeScript
import * as Interfaces from "../lib/interfaces";
/**
* Validates the provided data using a secure verification endpoint.
*
* @param token - A string or null representing the authentication token. Must not be null.
* @param data - An object adhering to the Validator interface, containing at least one of the following fields:
* url, email, phone, domain, creditCard, ip, wallet or user agent.
*
* @returns A promise that resolves to the response data from the verification endpoint.
*
* @throws Will throw an error if the token is null, if none of the required fields are present in the data,
* or if an error occurs during the verification request.
*/
export declare const isValidData: (token: string | null, data: Interfaces.Validator) => Promise<any>;
/**
* Sends an email using a secure sending endpoint.
*
* @param token - A string or null representing the authentication token. Must not be null.
* @param data - An object adhering to the SendEmail interface, containing the following fields:
* 'from', 'to', 'subject', 'html' or 'react', and optionally 'attachments', 'options', 'priority', 'waitToResponse', and 'composeTailwindClasses'.
*
* @returns A promise that resolves to the response data from the sending endpoint.
*
* @throws Will throw an error if the token is null, if any of the required fields are missing,
* if the 'react' field is not a valid React element, if the 'attachments' field exceeds the maximum allowed size of 40 MB,
* or if an error occurs during the sending request.
*/
export declare const sendEmail: (token: string | null, data: Interfaces.SendEmail & {
serverEmailConfig: Interfaces.ServerEmailConfig | undefined;
}) => Promise<any>;
/**
* Retrieves a random number within a specified range using a secure endpoint.
*
* @param token - A string or null representing the authentication token. Must not be null.
* @param data - An object adhering to the SRNG interface, containing 'min' and 'max' fields,
* which define the inclusive range within which the random number should be generated.
*
* @returns A promise that resolves to the response data containing the random number.
*
* @throws Will throw an error if the token is null, if 'min' or 'max' are not defined,
* if 'min' is not less than 'max', if 'min' or 'max' are out of the allowed range,
* or if an error occurs during the request to the random number generator endpoint.
*/
export declare const getRandom: (token: string | null, data: Interfaces.SRNG) => Promise<any>;
/**
* Extracts structured data from a given string using a secure endpoint.
*
* @param token - A string or null representing the authentication token. Must not be null.
* @param data - An object adhering to the ExtractWithTextly interface, containing 'data' and 'format' fields.
* The 'data' field is the string from which structured data should be extracted.
* The 'format' field is an object defining the structure of the data to be extracted.
*
* @returns A promise that resolves to the response data containing the extracted structured data.
*
* @throws Will throw an error if the token is null, if 'data' or 'format' are not defined,
* or if an error occurs during the request to the extraction endpoint.
*/
export declare const extractWithTextly: (token: string | null, data: Interfaces.ExtractWithTextly) => Promise<any>;