<commit_before>/**
 * argv[0] Access Key
 * argv[1] Secret Key
 */
const args = require('yargs').argv._;
const usabilla = require('../dist');

const api = new usabilla(args[0], args[1]);

// Get all buttons for this account.
api.websites.buttons.get().then((response) => {
  const buttons = response.items;

  // Use the button id to get feedback for this button id.
  var buttonFeedbackQuery = {
    id: buttons[1].id,
    params: {
      limit: 1
    }
  };
  api.websites.buttons.feedback.get(buttonFeedbackQuery).then((results) => {
    console.log(results);
  });
}).catch((reason) => {
  // If the api call fails, we want to see the error message
  console.error(reason);
});

// Get all campaigns for this account.
api.websites.campaigns.get().then((response) => {
  const campaigns = response.items;

  // Get the results for a campaign with id.
  var campaignQuery = {
    id: campaigns[0].id
  };

  // Get the responses of the first campaign
  api.websites.campaigns.results.get(campaignQuery).then((results) => {
    console.log(results);
  });

  // Get the stats of the first campaign
  api.websites.campaigns.stats.get(campaignQuery).then((results) => {
    console.log(results);
  });
});

// Get all inpage widgets for this account.
api.websites.inpage.get().then((response) => {
  const inPageWidgets = response.items;

  // Get the feedback for a inpage widget with id.
  var inPageQuery = {
    id: inPageWidgets[0].id
  };
  api.websites.inpage.feedback.get(inPageQuery).then((results) => {
    console.log(results.items);
  });
});

// Get all email widgets for this account.
api.email.widgets.get().then((response) => {
  const emailWidgets = response.items;

  // Get the feedback for a email widget with id.
  var emailQuery = {
    id: emailWidgets[0].id
  };
  api.email.widgets.feedback.get(emailQuery).then((results) => {
    console.log(results.items);
  });
});

// Get all apps forms for this account.
api.apps.forms.get().then((response) => {
  const appsForms = response.items;

  // Get the feedback for a apps form with id.
  var appsQuery = {
    id: appsForms[1].id
  };
  api.apps.forms.feedback.get(appsQuery).then((results) => {
    console.log(results.items);
  });
});<commit_msg>update example.js<commit_after>/**
 * argv[0] Access Key
 * argv[1] Secret Key
 */
const args = require('yargs').argv._;
const usabilla = require('../dist');

const api = new usabilla(args[0], args[1]);

// Get all buttons for this account.
api.websites.buttons.get().then((buttons) => {

  // Use the button id to get feedback for this button id.
  var buttonFeedbackQuery = {
    id: buttons[1].id,
    params: {
      limit: 10
    }
  };
  api.websites.buttons.feedback.get(buttonFeedbackQuery).then((feedback) => {
    console.log('# button feedback', feedback.length);

  });
}).catch((reason) => {
  // If the api call fails, we want to see the error message
  console.error(reason);
});


// Get all campaigns for this account.
api.websites.campaigns.get().then((campaigns) => {

  // Get the results for a campaign with id.
  var campaignQuery = {
    id: campaigns[0].id
  };

  // Get the responses of the first campaign
  api.websites.campaigns.results.get(campaignQuery).then((responses) => {
    console.log('# campiagn responses', responses.length);
  });

  // Get the stats of the first campaign
  api.websites.campaigns.stats.get(campaignQuery).then((stats) => {
    console.log('campaign stats', stats);
  });
});

// Get all inpage widgets for this account.
api.websites.inpage.get().then((inPageWidgets) => {

  // Get the feedback for a inpage widget with id.
  var inPageQuery = {
    id: inPageWidgets[0].id
  };

  // Get the feedback of the first inpage widget
  api.websites.inpage.feedback.get(inPageQuery).then((feedback) => {
    console.log('# inpage feedback', feedback.length);
  });
});

// Get all email widgets for this account.
api.email.widgets.get().then((emailWidgets) => {

  // Get the feedback for a email widget with id.
  var emailQuery = {
    id: emailWidgets[0].id
  };

  // Get the feedback of the first email widget
  api.email.widgets.feedback.get(emailQuery).then((feedback) => {
    console.log('# email feedback', feedback.length);
  });
});

// Get all apps forms for this account.
api.apps.forms.get().then((appsForms) => {

  // Get the feedback for a apps form with id.
  var appsQuery = {
    id: appsForms[1].id
  };

  // Get the feedback of the second app form
  api.apps.forms.feedback.get(appsQuery).then((feedback) => {
    console.log('# apps feedback', feedback.length);
  });
});
{'fraction_non_alphanumeric': 0.15598337344126012, 'fraction_numerical': 0.004594180704441042, 'mean_word_length': 3.3091423185673894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, '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': '1955233', 'n_tokens_mistral': 1504, 'n_tokens_neox': 1439, 'n_words': 387}