npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cloudagents

v2.0.1

Published

A node.js client for the Securibox Cloud Agents API

Downloads

26

Readme

cloudagents-node

NPM Version

A node.js client library for the Securibox Cloud Agents API

Install

$ npm install cloudagents

Getting started

The module supports all Cloud Agents API endpoints. For complete information about the API, head to the online documentation.

Endpoints

All endpoints require a valid authentication strategy provided by the Securibox team to access (basic or bearer/JWT).

var CloudAgents = require('cloudagents');

var client = new CloudAgents.Client(cloudagents_env);
var authStrategy = new CloudAgents.BasicStrategy(api_username, api_password);
//or authStrategy = new CloudAgents.BearerStrategy("[token]");
client.use(authStrategy);

Once an instance of the client has been created you use the following methods:

var CloudAgents = require('cloudagents');

// Initialize client
var client = new CloudAgents.Client(cloudagents_env);

// Initialize authentication strategy
var authStrategy = new CloudAgents.BasicStrategy(api_username, api_password);

// Bind authentication strategy to client
client.use(authStrategy);

//list all categories
client.getCategories(callback);

//list all agents
client.getAgents(callback);
//list agents by category
client.getAgentsByCategory(category_id, callback);
//search agents
client.searchAgents(options, callback);

//list all accounts
client.getAllAccounts(options, callback);
//list accounts by agent
client.getAllAccounts(options, agent_id, callback);
//create account
client.createAccount(account, callback);
//modify account
client.modifyAccount(account_id, account, callback);
//delete account
client.deleteAccount(account_id, callback);
//synchronize account
client.synchronizeAccount(account_id, user_id, callback);
//search account
client.searchAccounts(options, callback);

//search synchronizations
client.searchSynchronizations(options, callback)
//get all syncrhonization for an account
client.getSynchronizationsByAccount(options, account_id, callback);
//get all syncrhonization for an account
client.getLastSynchronizationByAccount(account_id, callback);
//acknowledge synchronization by account
client.acknowledgeSynchronizationForAccount(account_id, acknowledgement, callback);


//search documents by account, user, pending with or without content
client.searchDocuments(options, callback);
//get a specific downloaded document
client.getDocument(document_id, callback);
//acknowledge the reception of a specific document
client.acknowledgeDocumentDelivery(document_id, callback);
//get documents by account id
client.getDocumentsByAccount(options, account_id, callback);

All parameters except options are required. If the options parameter is omitted, the last argument to the function will be interpreted as the callback.

Callbacks

All callbacks are in the form:

function callback(err, response) {
  // err can be a network error or a Securibox API error.
}

Examples

Collect invoices from DropBox:

var CloudAgents = require('cloudagents');

var environment = "https://sca-multitenant-prod.securibox.eu/api/v1/";

// Initialize client
var client = new CloudAgents.Client(environment);
var basicAuthentication = new CloudAgents.BasicStrategy('api_username', 'api_password');
client.use(basicAuthentication);

//Account to create
var account = {
          customerAccountId: 'randomDropboxAccountID',
          customerUserId: 'UserABCD',
          name: 'John DropBox account',
          agentId: '5194a49d6d064d708ed004bc12709241', //Dropbox ID that you can get by listing all available agents
          credentials: [
              {
                  position: 0,
                  value: "[email protected]",
                  alg: null

              },
              {
                  position: 1,
                  value: "mydropboxpassword",
                  alg: null
              }
          ]  
        }

//Create account and launch synchronization
client.createAccount(account, function(err, res) {
    if (err != null) {
        console.error(err);
    } else {
        console.log(res);
    }
});

// Pool synchronization status to until we get a final status
var interval = setInterval(function(){
    client.getLastSynchronizationByAccount(account.customerAccountId, function(err, res){            
        eq(err, null);
			if(res.synchronizationState == CloudAgents.Constants.synchronizationState.PendingAcknowledgement ||
				res.synchronizationState == CloudAgents.Constants.synchronizationState.Completed ||
				res.synchronizationState == CloudAgents.Constants.synchronizationState.ReportFailed){
                clearInterval(interval);
            }
    })
}, 10000);

Tests

$ make test

License

GNU GPL