<commit_before>/*
 * SendPulse REST API Usage Example
 *
 * Documentation
 * https://sendpulse.com/api
 */

var sendpulse = require("sendpulse-api");

/*
 * https://login.sendpulse.com/settings/#api
 */

var API_USER_ID="USER_ID"
var API_SECRET="USER_SECRET"

var TOKEN_STORAGE="/tmp/"

sendpulse.init(API_USER_ID,API_SECRET,TOKEN_STORAGE);

/**
 * Function to process response data
 *
 * @param data
 */
var answerGetter = function(data) {
    console.log(data);
}

sendpulse.listAddressBooks(answerGetter);
sendpulse.createAddressBook(answerGetter,'My Book');
sendpulse.editAddressBook(answerGetter, 123456, 'My new book');
sendpulse.removeAddressBook(answerGetter, 123456);
sendpulse.getBookInfo(answerGetter,123456);
sendpulse.getEmailsFromBook(answerGetter,123456);
sendpulse.addEmails(answerGetter, 123456, [{email:'<EMAIL>',variables:{}}]);
sendpulse.removeEmails(answerGetter, 123456, ['<EMAIL>']);
sendpulse.getEmailInfo(answerGetter,123456,'<EMAIL>');
sendpulse.campaignCost(answerGetter,123456);
sendpulse.listCampaigns(answerGetter,10,20);
sendpulse.getCampaignInfo(answerGetter,123456);
sendpulse.campaignStatByCountries(answerGetter,123456);
sendpulse.campaignStatByReferrals(answerGetter,123456);
sendpulse.createCampaign(answerGetter,'Alex','<EMAIL>','Example subject','<h1>Example text</h1>',123456);
sendpulse.cancelCampaign(answerGetter,123456);<commit_msg>feat(example): add example listEmailTemplates and getEmailTemplate<commit_after>/*
 * SendPulse REST API Usage Example
 *
 * Documentation
 * https://sendpulse.com/api
 */

var sendpulse = require("sendpulse-api");

/*
 * https://login.sendpulse.com/settings/#api
 */

var API_USER_ID="USER_ID"
var API_SECRET="USER_SECRET"

var TOKEN_STORAGE="/tmp/"

sendpulse.init(API_USER_ID,API_SECRET,TOKEN_STORAGE);

/**
 * Function to process response data
 *
 * @param data
 */
var answerGetter = function(data) {
    console.log(data);
}

sendpulse.listAddressBooks(answerGetter);
sendpulse.createAddressBook(answerGetter,'My Book');
sendpulse.editAddressBook(answerGetter, 123456, 'My new book');
sendpulse.removeAddressBook(answerGetter, 123456);
sendpulse.getBookInfo(answerGetter,123456);
sendpulse.getEmailsFromBook(answerGetter,123456);
sendpulse.addEmails(answerGetter, 123456, [{email:'<EMAIL>',variables:{}}]);
sendpulse.removeEmails(answerGetter, 123456, ['<EMAIL>']);
sendpulse.getEmailInfo(answerGetter,123456,'<EMAIL>');
sendpulse.listEmailTemplates(answerGetter);
sendpulse.getEmailTemplate(answerGetter,123456);
sendpulse.campaignCost(answerGetter,123456);
sendpulse.listCampaigns(answerGetter,10,20);
sendpulse.getCampaignInfo(answerGetter,123456);
sendpulse.campaignStatByCountries(answerGetter,123456);
sendpulse.campaignStatByReferrals(answerGetter,123456);
sendpulse.createCampaign(answerGetter,'Alex','<EMAIL>','Example subject','<h1>Example text</h1>',123456);
sendpulse.cancelCampaign(answerGetter,123456);
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.060041407867494824, 'mean_word_length': 9.428057553956835, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1135769', 'n_tokens_mistral': 1118, 'n_tokens_neox': 985, 'n_words': 122}