1.0.2 • Published 7 years ago

teamcowboy v1.0.2

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

teamcowboy Build Status

Usage

Install the teamcowboy module from npm.

npm install teamcowboy --save

Initialize the teamcowboy module by calling it with your Team Cowboy API credentials, in return you'll get an initialized api module (exported as a JavaScript object) that you can then use to interact with the Team Cowboy API.

const teamcowboyApi = require('teamcowboy')({
    privateKey: 'xxx',
    publicKey: 'xxx',
});

The teamcowboy JavaScript wrapper is divided by module after initialization. Each method accepts a single argument, which should be a JavaScript object with key/values that map directly to the parameters accepted by the Team Cowboy API for the specific method being called. Method calls will return a JavaScript promise.

const {
  auth,
  events,
  message,
  team,
  user,
} = teamcowboyApi;

Method calls will return a JavaScript promise. Here is an example that uses the teamcowboy library to get a user token, which then takes the token and makes another request to get teams for the user.

auth.getUserToken({
  username: 'my@email.com',
  password: 'p@ssw0rd',
}).then(res => {
  user.getTeams({ userToken: res.body.token})
    .then(resp => {console.log(resp)})
    .catch(err => {console.log(err)})
}).catch(err => {
  console.log(err);
});

Team Cowboy method mapping

Authentication Methods

Event Methods

Since event is a reserved word in JavaScript, this module has been named events

Message Methods

Team Methods

User Methods

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago