# composer-api

> composer API client wrapper

Latest version **1.0.1** (published 2013-05-14) · 0 weekly downloads

## Install

```sh
npm install composer-api
pnpm add composer-api
yarn add composer-api
bun add composer-api
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2013-05-14 |
| First published | 2013-04-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Nodejitsu |
| Maintainers | mmalecki, indexzero, avianflu, bmeck |

## Links

- npm: https://www.npmjs.com/package/composer-api
- Repository: https://github.com/opsmezzo/composer-api
- Homepage: http://github.com/opsmezzo/composer-api
- npm.io page: https://npm.io/package/composer-api

## Dependencies (2)

- [utile](https://npm.io/package/utile.md) ~0.2.0
- [request](https://npm.io/package/request.md) ~2.21.0

## Recent versions

- 1.0.1 (latest) — 2013-05-14
- 1.0.0 — 2013-04-15

## README

# composer-api/node.js

The node.js composer-api library enables access to the RESTful API for [`composer`](https://github.com/nodejitsu/composer).

## Example:

```js
var composer = require('composer-api');

var client = composer.createClient({
  host: 'api.nodejitsu.com',
  port: 80,
  auth: {
    username: 'charlie',
    password: 'foobar',
  }
});

client.groups.list(function (err, result) {
  if (err) {
    console.log(err);
    return;
  }
  
  console.log(JSON.stringify(result, null, 2, true));
});
```

## Usage:

### api.createClient(options)

This method sets up a client for connecting to `composer`. Here's a minimal example for connecting to composer as `charlie`:

``` js
var client = composer.createClient({
  host: 'api.nodejitsu.com',
  port: 80,
  auth: {
    username: 'charlie',
    password: 'foobar',
  }
});
```

The options object contains three required properties:

* `auth.username`: The username for your composer account
* `auth.password`: The password for your composer account
* `host`: The api host (typically http://composer.nodejitsu.com.

### client

Method calls are generally structured as `resource` and `action`.

``` js
client.resource.action("data", function (err, result) {
  if (err) {
    throw err;
  }

  //
  // use the result
  //
});
```

Most actions take a string argument and a callback, though a few actions only take a callback.

The client's methods are reflective of [`composer`](https://github.com/opsmezzo/composer/tree/master/lib/resources) resources. Here's a broad overview:

* **client.config**: Manage your composer accounts. Methods include:
  * `config.create`
  * `config.get`
  * `config.list`
  * `config.update`
  * `config.destroy`
* **client.system**: Manage your composer accounts. Methods include:
  * `system.create`
  * `system.get`
  * `system.list`
  * `system.update`
  * `system.destroy`
  * `system.removeVersion`
  * `system.addVersion`
  * `system.addOwner`
  * `system.removeOwner`
  * `system.upload`
  * `system.download`
* **client.users**: Manage your composer accounts. Methods include:
  * `users.create`
  * `users.get`
  * `users.list`
  * `users.update`
  * `users.destroy`
  * `users.getKey`
  * `users.getKeys`
  * `users.addKey`
  * `users.updateKey`

## Installation

This library may be installed using npm:

``` bash
  $ npm install composer-api
```

## Tests
All tests are included in [`composer`](https://github.com/opsmezzo/composer/tree/master/tests) to facilitate integration tests and to avoid the need for complex mocking.

## License
Proprietary. Copyright (c) 2011 Nodejitsu Inc.

---
_Source: https://npm.io/package/composer-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
