Ejemplo n.º 1
0
// We recently released a Javascript SDK for accessing Sprintly data via our Python-based API.
// Find the code and additional documentation at https://github.com/sprintly/sprintly-data.
// Documentation for the Python API can be found at https://sprintly.uservoice.com/knowledgebase/topics/15784-api


// This example pulls all of the items in your project backlog and logs their count.
// Note: you need a Sprintly account and at least one product with some tasks ('items')
// added to it in order to get started.

// Install the SDK via npm: $ npm install --save sprintly/sprintly-data
var sprintly = require('sprintly-data');

var email = window.prompt('sprintly email:');
var apiKey = window.prompt('sprintly API key:');

// Initialize the sprintly client
// The client returns a products Backbone collection as well as a user Backbone model
var client = sprintly.createClient(email, apiKey);

// Fetch your Sprintly products' data. (note: returns jquery promise)
// Get the product that you'd like to pull items from.
var products = client.products.fetch();
var myProduct = client.products.get(1);

// Pull in all items in your project's backlog. (note: returns jquery promise)
// When all backlog items are fetched, log the collection count to the console.
var backlogCollection = myProduct.getItemsByStatus('backlog');
backlogCollection.done(function() {
  console.log(backlogCollection.length);
});
Ejemplo n.º 2
0
import {createClient} from 'sprintly-data';

if (!window.__token && process.env.NODE_ENV !== 'test') {
  throw new Error('Host environment missing token');
}

export default createClient({ token: window.__token });