cognition-sdk
v1.1.46
Published
A simple wrapper for using Cognition APIs in node
Downloads
2
Readme
const Cognition = require('cognition-sdk');
const cognition = new Cognition({ apiKey: 'paste your cognition api key here' });
cognition.workers.list()
.then(_workers => {
console.log(_workers);
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
})
cognition.workers.online()
.then(_workers => {
console.log(_workers);
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
})
cognition.workers.online_team_members()
.then(_workers => {
console.log(_workers);
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
})
cognition.projects.list()
.then(_projects => {
console.log(_projects);
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
})
cognition.instances.details('5d0bed09b084ad9be1470722')
.then(_details => {
console.log(_details);
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
})
cognition.instances.assign_workers('5d0bed09b084ad9be1470722', ['user1', 'user2'])
.then(_results => {
console.log(_results);
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
})
cognition.apps.list()
.then(_apps => {
console.log(_apps);
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
})
cognition.apps
.deploy({
appSlug: "testing-app2",
title: "Test deploy app by workers id",
project: "5cd9aa851d2c91704d5f3f8d",
workers: ["5cc866aaa3589857f1337392", "5cdac356cf65660ac6612a02"]
})
.then(_results => {
console.log(_results);
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
});
cognition.apps
.deploy_by_usernames({
appSlug: "test-app",
title: "Test deploy app by workers usernames",
project: "5cd9aa851d2c91704d5f3f8d",
usernames: ["user1", "user2", 'user3']
})
.then(_results => {
console.log(_results, 'results');
})
.catch(_err => {
console.log(_err.message ? _err.message : _err);
});