0.8.10 • Published 7 years ago

@thinksquirrel/chipmunk v0.8.10

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

Chipmunk JavaScript SDK

Important Note

🚧 This SDK is currently in development. While we will try to maintain backwards compatibility, certain features may be added or removed at any time.

A Chipmunk account is required to use this SDK. You can sign up for one free here.

Please note that all API tokens currently have the full permissions of a user. Do not deploy API secrets publicly! Read-only public access via the JavaScript SDK is currently in development.

Installation

NPM:

npm install @thinksqurrel/chipmunk

Yarn:

yarn add @thinksquirrel/chipmunk

Usage

Basic usage

var chipmunk = require("@thinksquirrel/chipmunk").chipmunk;

var apiKey = "XXXXX"; // Your API key, under User Profile > API Keys
var apiSecret = "XXXXX"; // API secret, do not share this value

chipmunk.config({ apiKey, apiSecret });

chipmunk.collections
  .getAll()
  .request()
  .then(function(collectionList) {
    console.log("%s collection(s) total:", collectionList.count);
    collectionList.result.forEach(function(collection) {
      console.log(
        "    - %s: %s",
        collection.title,
        collection.summary || "No description available",
      );
    });
  });

Multiple API instances

var chipmunk = require("@thinksquirrel/chipmunk").chipmunk;

var apiKey = "XXXXX"; // Your API key, under User Profile > API Keys
var apiSecret = "XXXXX"; // API secret, do not share this value

const apiInstance = chipmunk.createInstance({ apiKey, apiSecret });

apiInstance.collections
  .getAll()
  .request()
  .then(function(collectionList) {
    console.log("%s collection(s) total:", collectionList.count);
    collectionList.result.forEach(function(collection) {
      console.log(
        "    - %s: %s",
        collection.title,
        collection.summary || "No description available",
      );
    });
  });

Downloading a revision

var chipmunk = require("@thinksquirrel/chipmunk").chipmunk;

var apiKey = "XXXXX"; // Your API key, under User Profile > API Keys
var apiSecret = "XXXXX"; // API secret, do not share this value
var assetId = "XXXXX"; // IDs for resources can be discovered through the API

// Initialize
chipmunk.config({ apiKey, apiSecret });

// Get asset information
// In the API, assets are named "items"
chipmunk.items
  .get({ id: assetId })
  .request()
  .then(function(myAsset) {
    console.log(
      "Downloading '%s' from '%s'...",
      myAsset.head.fileName,
      myAsset.title,
    );

    // Download an asset's current revision ("head")
    return chipmunk.revisions.get
      .download({
        id: myAsset.head.id,
      })
      .request()
      .then(function(downloadToken) {
        console.log("URL: %s", downloadToken.url); // Temporary URL to the file
      });
  });

See our API for more details.

0.8.10

7 years ago

0.8.9

7 years ago

0.8.8

7 years ago

0.8.7

7 years ago

0.8.6

7 years ago

0.8.5

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.19

7 years ago

0.2.18

7 years ago

0.2.17

7 years ago

0.2.16

7 years ago

0.2.15

7 years ago

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.17

7 years ago

0.1.16

7 years ago

0.1.15

7 years ago

0.1.14

7 years ago

0.1.13

7 years ago

0.1.12

7 years ago

0.1.11

7 years ago

0.1.10

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago