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

kite-node

v1.0.21

Published

The Kite JavaScript library provides convenient access to the [Kite REST API](https://www.kite.ly/docs/) from applications written in Node. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API response

Downloads

10

Readme

Kite Node.js SDK

The Kite JavaScript library provides convenient access to the Kite REST API from applications written in Node. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses.

Documentation

See the JavaScript API docs.

Suggested Installation Approach

via NPM

npm install kite-node

Suggested Usage / Approach

After installing the library from NPM you will need to require the library in your project.

const Kite = require('kite-node');

The library needs to be configured with your account's public key which is available in your Kite Dashboard. You may also want to set the optional secret key at this point.

Kite.setPublicKey('replaceWithYourPublicKey');

/* Optional */
Kite.setSecretKey('replaceWithSecretKey');

SDK Features

Address Search / Lookup

Search for an address in a certain country.

If a single matching address is found this is returned, otherwise an array of multiple addresses is returned.

Either search_term or address_id is required.

Kite.address.search({
		country_code: "GBR",
		search_term: "10 Downing Street" // Optional,
		address_id: 'GBR|PR|23747771|0|0|0||Retrieve' // Optional
	}, 
	function(uniqueAddress) {...}, 
	function(multipleAddresses) {...}, 
	function(err) {...} // If no address is found
);

/*
	If multiple addresses are found, another call needs to be made
	to get further details. This can be called directly on the returned
	address object
*/
multipleAddresses[0].getDetail(
	function(success) {...}, 
	function(err) {...}
);

/* or via the Kite.address.getDetail function */
Kite.address.getDetail(
	multipleAddresses[0],
	function(address) {...},
	function(err) {...}
);

Product Retrieval

/* 
	Returns a list of products associated with the current Kite account
 */
Kite.product.list({
		limit: 50,
		offset: 0
	},
	function(productsResponse) {...}, 
	function(err) {...} // E.g incorrect parametres
);

/* Retrieve a single product by it's template_id */
Kite.product.get(
	'i6_case',
	function(product) {...},
	function(err) {...} // If no product is found
);

Order Retrieval

/* 
 * Returns a list of orders associated with the Kite account.
 */
Kite.order.list({
		limit: 100
	},
	function(ordersResponse) {...},
	function(err) {...} // E.g incorrect parametres
);

/* Retrieve single order by id */
Kite.order.get(
	'PS123-12341234',
	function(order) {...}, 
	function(err) {...} // If no order is found
);

Placing Product Orders

/* 
 * Create and submit an order for printing
 * 1. Create any print jobs that will be part of the order
 */  
var phonecaseJob = Kite.job.create({
	template_id:"i6_case",
	asset:"http://.../image.jpg",
	options:{
		case_style:"matte"
	}
});
							    
var tshirtJob = Kite.job.create({
	template_id:"aa_mens_tshirt", 
	assets:{
		center_chest:"http://.../image.jpg",
		center_back:"http://.../image.jpg"
	},
	options:{
		garment_size:"M",
		garment_color:"white"
	}
});

/* 2. Create the order to which the jobs will be added */							    
var order = Kite.order.create();
order.jobs.push(phonecaseJob);
order.jobs.push(tshirtJob);
order.shipping_address = ... ; // set it to an Address object
order.promo_code = "XYZ";  // optional

/* optionally view the cost of the order */
var cost = order.calculateCost(function(cost) {...}, function(err) {...});

/* 3. submit the print order to kite for fulfillment */

/*
	Either the proof of payment needs to be set or if using
	the SDK through NodeJS the secret key can be set instead.
*/
order.proof_of_payment = "..."; // Stripe charge token
order.submit(function(orderId) {...}, function(err) {...});