0.4.11 • Published 6 years ago

clara v0.4.11

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

Clara.io api bindings for node.js

Installation

npm install clara

Quick start

$ npm install clara
$ clara set apiToken <api-token>
$ clara set username <username>
$ clara scenes:get <uuid>

API Overview

Create a clara instance with your api token and username:

// Visit https://clara.io/settings/api for your api token
var clara = require('clara')({apiToken: 'your-api-token', username: 'your-username'});

Every resource method returns a promise, or accepts an optional callback.

clara.scenes.list().then(function(scenes) {
}).catch(function(err) {
});

With callbacks:

clara.scenes.list({}, function(err, scenes) {
});

The parameters for each resource method are:

  • queryOptions: {Object} Any query parameters required for the call.
  • params: {Object|String} (Optional) The data for the method. If this is a string, the library will expect a filename to a json file that will be parsed and sent.
  • callback: {Function}
clara.scenes.update({sceneId: 'scene-id'}, './scene.json', function(err, result) {});
clara.scenes.create({}, function(err, newScene) {});

Command line overview

All commands are available from the command line runner as well.

$ clara --help
$ clara scenes:get --help
$ clara --apiToken <apiToken> --username <username> scenes:get <sceneId>

Available resources and methods

  • scenes:library options List public scenes
  • scenes:list options List your scenes
  • scenes:create options Create a new scene
  • scenes:update options Update a scene
  • scenes:get Get scene data
  • scenes:delete Delete a scene
  • scenes:clone Clone a scene
  • scenes:import options Import a file into the scene
  • scenes:export Export a scene
  • scenes:render options Render an image
  • scenes:command options Run a command
  • jobs:list options List your jobs
  • jobs:get Get job data
  • user:get Get User Profile
  • user:update options Update user profile
  • webhooks:list options List webhooks
  • webhooks:create options Create a webhook
  • webhooks:update options Update a webhook
  • set Set a configuration value to $HOME/.clara.json
  • get Return the current configuration for

Configuration

There are several ways to set up the configuration data, from highest to lowest priority:

  1. Pass directly (through function call, or command line).
clara --apiToken <apiToken> --username <username> scenes:get <sceneId>

Or with api:

var clara = require('clara')({apiToken: '...', username: '...'});
  1. Environment variables.

Any parameter can be passed through an environment variable, prefixed with clara_:

clara_apiToken=api-token-here clara_username=username clara scenes:get <uuid>
  1. Configuration file in current working directory

A json file named .clara.json can hold configuration data:

{
  "apiToken": "api-token-here",
  "username": "your-username"
}
  1. Configuration file in $HOME

If the configuration file .clara.json exists in $HOME, it will be used.

clara set, clara get

You can use the clara command line to quickly set/get your configuration data. It will write to $HOME/.clara.json:

$ clara set apiToken your-api-token
$ clara set username your-username
$ clara scenes:get scene-uuid

Development

Run the tests using npm:

$ npm install
$ npm tests
0.4.11

6 years ago

0.4.10

6 years ago

0.4.9

7 years ago

0.4.8

7 years ago

0.4.7

7 years ago

0.4.6

7 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago