1.0.12 • Published 10 years ago

crp-account-client v1.0.12

Weekly downloads
39
License
-
Repository
github
Last release
10 years ago

CrowdProcess Account Client

Basically about account CRUD and obtaining tokens. You know, user account stuff.

Getting it

$ # install it with
$ npm install --save crp-account-client
// require it
var Client = require('crp-account-client');

// initiallize the client with a username and a password
var client = Client({
  username: myUsername,
  password: myPassword
});

// or with a token
var client = Client({
  token: myToken
});

// or with nothing at all, if you pretend to create an account
var client = Client();

Obtaining a Token

Of course you have to create an account first.

client.login({
  email: 'myemail@address.com',
  password: 'a secure password'
}, function (err, token) {
  if (!err)
    console.log('now I can use my token:', token);
});

Account CRUD

Create

For this you should use the website.

View

client.account({
  email: 'myemail@address.com',
  password: 'a secure password'
}).view(function (err, account) {
  if (!err)
    console.log('here\'s my account:', account);
});

Update

client.account({
  email: 'myemail@address.com',
  password: 'a secure password'
}).update({
  name: 'My New Name',
  newPassword: 'safer password ?'
}, function (err) {
  if (!err)
    console.log('boom.. hope I remember my new password..');
});

Delete

client.account({
  email: 'myemail@address.com',
  password: 'a secure password'
}).destroy(function (err) {
  if (!err)
    console.log('no more account :(');
})
1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago