# esa-nodejs

> [![npm version](https://badge.fury.io/js/esa-nodejs.svg)](http://badge.fury.io/js/esa-nodejs) [![Build Status](https://travis-ci.org/bells17/esa-nodejs.svg?branch=master)](https://travis-ci.org/bells17/esa-nodejs)

Latest version **0.0.7** (published 2015-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install esa-nodejs
pnpm add esa-nodejs
yarn add esa-nodejs
bun add esa-nodejs
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2015-12-15 |
| First published | 2015-05-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 10 |
| Author | bells17 |
| Maintainers | bells17 |

## Links

- npm: https://www.npmjs.com/package/esa-nodejs
- Repository: https://github.com/bells17/esa-nodejs
- Homepage: https://github.com/bells17/esa-nodejs#readme
- Issues: https://github.com/bells17/esa-nodejs/issues
- npm.io page: https://npm.io/package/esa-nodejs

## Dependencies (2)

- [superagent](https://npm.io/package/superagent.md) ^1.2.0
- [superagent-no-cache](https://npm.io/package/superagent-no-cache.md) ^0.1.0

## Recent versions

- 0.0.7 (latest) — 2015-12-15
- 0.0.6 — 2015-10-18
- 0.0.5 — 2015-10-17
- 0.0.4 — 2015-06-22
- 0.0.3 — 2015-05-30
- 0.0.2 — 2015-05-30
- 0.0.1 — 2015-05-29
- 0.0.0 — 2015-05-29

## README

# esa-nodejs

[![npm version](https://badge.fury.io/js/esa-nodejs.svg)](http://badge.fury.io/js/esa-nodejs) [![Build Status](https://travis-ci.org/bells17/esa-nodejs.svg?branch=master)](https://travis-ci.org/bells17/esa-nodejs)

esa API v1 client library, written in Node.js

https://docs.esa.io/posts/109

https://docs.esa.io/posts/102


## Installation

```
npm install esa-nodejs
```


## Usage

```javascript
var esa = require('esa-nodejs');
client = esa({
  team: 'teamname',
  accessToken: 'api access token'
});

client.team
//=> 'teamname'

client.accessToken
//=> 'api access token'

// GET /v1/teams
client.api.teams(function(err, res) {
  console.log(err);
  console.log(res.body);
});

// GET /v1/teams/:team_name
client.api.team(function(err, res) {
  console.log(err);
  console.log(res.body);
});

// GET /api/v1/teams/:team_name/stats
client.api.stats(function(err, res) {
  console.log(err);
  console.log(res.body);
});

// GET /api/v1/teams/:team_name/stats
client.api.stats(function(err, res) {
  console.log(err);
  console.log(res.body);
});

// GET /v1/teams/:team_name/posts
client.api.posts(function(err, res) {
  console.log(err);
  console.log(res.body);
});

// POST /v1/teams/:team_name/posts
client.api.createPost({name: 'foo'}, function(err, res) {
  console.log(err);
  console.log(res.body);
});

// PATCH /v1/teams/:team_name/posts/:number
client.api.updatePost(postNumber, {name: 'foo update'}, function(err, res) {
  console.log(err);
  console.log(res.body);
});

// DELETE /v1/teams/:team_name/posts/:number
client.api.deletePost(postNumber, function(err, res) {
  console.log(err);
  console.log(res.body);
});

// GET /api/v1/teams/:team_name/posts/:post_number/comments
client.api.comments(postNumber, function(err, res) {
  console.log(err);
  console.log(res.body.comments);
});

// GET /api/v1/teams/:team_name/comments/:comment_id
client.api.comment(commentId, function(err, res) {
  console.log(err);
  return console.log(res.body);
});

// POST /api/v1/teams/:team_name/posts/:post_number/comments
client.api.createComment(postNumber, {comment: { body_md: 'api create comment' } }, function(err, res) {
  console.log(err);
  return console.log(res.body);
});

// PATCH /api/v1/teams/:team_name/comments/:comment_id
client.api.updateComment(commentId, {comment: { body_md: 'api create comment' } }, function(err, res) {
  console.log(err);
  return console.log(res.body);
});

// DELETE /api/v1/teams/:team_name/comments/:comment_id
client.api.deleteComment(commentId, function(err, res) {
  console.log(err);
  return console.log(res.body);
});

```

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