2.0.9 • Published 10 years ago

crp-job-client v2.0.9

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

CrowdProcess Job Client

Basic CRUD for CrowdProcess Jobs

Getting it

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

// initiallize it with a username and password
var jobs = Client({
  email: 'my@email.com',
  password: 'a safe password'
});

// Or with a token
var jobs = Client({
  token: 'bb74a721-1728-45fe-8394-2d3ef4e0ac82'
});

You can get your authentication tokens with the account client.

Create a Job

var job = {
  program: "function Run (d) { return 3*d; }"
};

var jobId; // we'll use this on the next code block
jobs.create(job, function (err, res) {
  if (err)
    return console.log('not found :(');

  jobId = res.id;
});

View the job

// remember jobId from the last code block ?
jobs(jobId).show(function (err, job) {
  if (err)
    return console.log('not found :(');

  console.log(job);
});

List all the jobs

jobs.list(function (err, jobList) {
  if (err)
    return console.log('Something went terribly wrong');

  console.log(jobList); // it's an array of objects just like the one you got on jobs(jobId).show()
});

Delete a job

jobs(jobId).destroy(function (err) {
  if (err)
    console.log('cannot find the job');
});

Delete all your jobs

jobs.purge(function (err) {
  if (err)
    console.log('something went terribly wrong');
});
2.0.9

10 years ago

2.0.8

10 years ago

2.0.7

10 years ago

2.0.6

10 years ago

2.0.5

10 years ago

2.0.4

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

0.0.1

11 years ago