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

intacct-api

v0.3.0

Published

Intacct API Access Library

Downloads

190

Readme

intacct-api

CircleCI Codecov

IntacctApi(options)

options

  • auth
    • senderId
    • senderPassword
    • [sessionId] - required if missing userId
    • [userId] - cannot be used with sessionId
    • [companyId] - required if userId given
    • [password] - required if userId given
  • [controlId] - defaults to v1 uuid
  • [uniqueId] - boolean
  • [dtdVersion] - defaults to '3.0'

.request(...controlFunctions)

Make a request to Intacct's API to fulfill the given control functions. You can provide arrays of control functions via many arguments and/or single array. See the following examples:

const api = new IntacctApi({ ... });

const cid1 = api.inspect({ object: 'PROJECT' });
const cid2 = api.inspect({ object: 'VENDOR' });

// With a single array
const singleArray = await api.request([cid1, cid2]);

// With arguments
const withArgs = await api.request(cid1, cid2);

// Mixed arguments
const mixedArgs = await api.request(cid1, [cid2]);

Request Result

There are a couple ways to retrieve the results from the control functions: 1) from the return of the request function call or 2) from the reference of the control function you passed into the request call.

Invocation Return
  • functions - object hash of control functions keyed by control Function's control id
  • payload - converted payload from xml
  • rawPayload - raw payload string

ControlFunction Class

It's exported from the module as ControlFunction.

constructor(name, params = {}, controlId = null, parse = true)

Sets up a control function. It is recommended that you use one of the static factory methods.

.get([path])

If path is given, hoek.reach is used to retrieve the desired property. If path isn't given, the entire this.data variable is returned.

// EXAMPLE using ARINVOICE
const cid1 = IntacctApi.readByQuery({ object: 'ARINVOICE', pagesize: 1 });
const result1 = await obj.request(cid1);
let invoices = cid1.get('arinvoice');

.isSuccessful()

Returns a boolean of the contextual control function's resulting success.

.assignControlId(controlId = null)

Assigns or generates a control id. Caution to not duplicate control ids, duplicate id's will result in a thrown error.

Static Functions

All static functions return an instance of the ControlFunction class with the name defined by the static function's name. All static functions have the same signature: (params, controlId = null, parse = true)

Refer to Intacct's API Documentation for how to understand the parameters needed to make these functions work.

  • .consolidate(...)
  • .create(...)
  • .delete(...)
  • .getAPISession(...)
  • .getUserPermissions(...)
  • .inspect(...)
  • .installApp(...)
  • .read(...)
  • .readByName(...)
  • .readByQuery(...)
  • .readMore(...)
  • .readRelated(...)
  • .readReport(...)
  • .readView(...)
  • .update(...)

Static Function: readMore

This static function is special in that, instead of passing a parameters object to it, you can pass it a successful ControlFunction. This is important because to paginate using Intacct's API, you have to pass it a cursor they understand. Passing the successful ControlFunction allows this function to properly construct a readMore control function for you to then request. See this example:

const cid1 = IntacctApi.readByQuery({ object: 'PROJECT', pagesize: 1 });

const result1 = await obj.request(cid1);

const cid2 = IntacctApi.readMore(cid1);

const result2 = await obj.request(cid2);