npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dataclip

v2.0.0

Published

dataclip node client

Downloads

10

Readme

DataClip-node

This is the official node.js API client for Dataclip.

Usage

npm i dataclip

API

Dataclip (apiKey)

Create a DataClip Object.

  • apiKey (String) - found in the web interface of DataClip. Note that apiKey must be the private API key. Your public siteKeys and formkeys will not work!
const Dataclip = require('dataclip')
let dataclip = new Dataclip('api_12345678909876')

Basic usage:

const Dataclip = require('dataclip')
let dataclip = new Dataclip(your_api_key)

// Send an item up to DataClip
dataclip.send({label: 'your_data'}).then((response) => {
  console.log(response) // => 201, [{status: {...}}]
}).then(() => {
  // Fetch all form items 
  return dataclip.fetch()
}).then((response) => {
  console.log(response.status, response.data) // => 200, [{status: {...}}]
})

Dataclip::send([formName], data)

Send data to Dataclip.

  • formName (String; optional; default: 'default') - form to which you want to send data.
  • data (Object or Array) - data you want to send up. When Object it will treat it as a single Item. If Array, it will treat each entry as an Item.
  • Returns a Promise with Object payload.
    • form_name (String) - form name
    • data (Object or Array) - data you want to send up. When Object it will treat it as a single Item. If Array, it will treat each entry as an Item.
    • status (Integer) - HTTP status code
    • message (String) - Any message from server. (if error it will show the error message)
    • error (Boolean) - Will be present if status > 400.
let dataclip, data
dataclip = new Dataclip('api_1234567890987456')

// Send single item
data = {label: 'data'}
dataclip.send(data).then((response) => {
  console.log(
    response.status, // 201
    response.form_name, // 'default'
    response.message, // 'data saved successfully'
    response.error, //false
    response.data, // [data{label: 'data'}]
  )
})

// Send multiple items
data = [{label_1: 'data_1'}, {label_2: 'data_2'}]
dataclip.send(data).then((response) => {
  console.log(
    response.status, // 201
    response.form_name, // 'default'
    response.message, // 'data saved successfully'
    response.error, //false
    response.data, // [Item({label_1: 'data_1'}), Item({label_2: 'data_2'})]
  )
})

// Send one item to a specific named form
data = {contact: '+94 77 84 22728'}
dataclip.send('my_cotact_form', data).then((response) => {
  console.log(
    response.status, // 200
    response.form_name, // 'my_cotact_form'
    response.message, // 'data saved successfully'
    response.error, //false
    response.data, // [data{label: 'data'}]

  )
})

Dataclip::fetch([formName])

Retrieve your data from Dataclip. At this time, it returns all items in the form—there is no pagination.

  • formName (String; optional; default: 'default') - form from which you want to fetch data.
  • Returns a Promise with Object payload
    • status (Integer) - HTTP status code
    • form_name (String) - form name
    • data (Array of Items) - All Items in the form.
    • error (Boolean) - Will be present if status >= 400.
    • message (String) - Any message from server. (if error it will show the error message)
    • last_entry (Time stamp) - Data and time of last data entry
let dataclip
dataclip = new Dataclip('api_1234567890987456')

// Fetch items from the default form
dataclip.fetch().then((response) => {
  console.log(
    response.status, // 200
    response.form_name, // 'default'
    response.data,    // [Item, Item]
    reponse.message, //success
    response.error //false
  )
})

// Fetch items from a named form
dataclip.fetch('my_contact_form').then((response) => {
  console.log(
    response.status, // 200
    response.form_name, // 'my_contact_form'
    response.data,    // [Item,Item]
    reponse.message, //success
    response.error //false
  )
})