0.8.10 ā€¢ Published 6 years ago

@thinksquirrel/chipmunk v0.8.10

Weekly downloads
-
License
MIT
Repository
github
Last release
6 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

6 years ago

0.8.9

6 years ago

0.8.8

6 years ago

0.8.7

6 years ago

0.8.6

6 years ago

0.8.5

6 years ago

0.8.4

6 years ago

0.8.3

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.19

6 years ago

0.2.18

6 years ago

0.2.17

6 years ago

0.2.16

6 years ago

0.2.15

6 years ago

0.2.14

6 years ago

0.2.13

6 years ago

0.2.12

6 years ago

0.2.11

6 years ago

0.2.10

6 years ago

0.2.9

6 years ago

0.2.8

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago