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

fastbill-client

v0.1.1

Published

Promise based Fastbill client in node.js with additional convenience methods

Downloads

5

Readme

fastbill-client

Promise based Fastbill client in node.js with additional convenience methods

RESTful API-Client for Fastbill that covers all existing interfaces by using a descriptor file. Based on the descriptor, the module generates a node-style API by using Q's promise implementation, request module and lodash.

API USAGE

Initializing the client

This client must be initialized by using the

fastbill = require('fastbill-client');
fastbill.bootstrap(username, password);

Accessing fastbill's API

After the client has set authentication details, it can be used by simply calling

fastbill.api.entity.verb

whereas entity reflects fastbill's entity names (e. g. "customer" or "invoice") and verb reflects the method the is to be used (e. g. "get", "create").

Those methods are promised based and require different parameters based on the method.

GET-Methods

All get-methods expect at least a filter object (see fastbill API documentation). You can furthermore add an offset as second parameter and a limit as the third one:

fastbill.api.invoice.get({filter: {"INVOICE_ID": "XXXXX"}, limit, offset})

GET-Convenience Methods

Convenience methods like getById or getByNumber etc. must not be provided with a filter object but instead with the field value that the according filter is meant for:

fastbill.api.invoice.getById("ID", limit, offset)

whereas those methods also accept multiple field values as an array:

fastbill.api.invoice.getById(["ID1", "ID2", "ID3"], limit, offset)

CREATE, UPDATE, DELETE etc.

All other methods besides previously mentioned getters, accept a data object only that must reflect fastbill's API specification.

fastbill.api.invoice.create({"CUSTOMER_ID": "XXXXXX", "ITEMS": [{"ARTICLE_NUMBER": "1", "QUANTITY": "4"}]})

Promised example

fastbill.api.invoice.create({
  "CUSTOMER_ID": "1016354"
  "ITEMS": [
    {
      "ARTICLE_NUMBER": "1",
      "QUANTITY": 3
    }
  ]  
}).then(
  (result) ->
    console.log result
  (err) ->
    console.log err
)

fastbill.api.invoice.getByNumber("3").then(
  (result) ->
    console.log result
  (err) ->
    console.log err
)

API COVERAGE

{ customer:
   { 
     get: [Function],
     update: [Function],
     delete: [Function],
     getByCustomerId: [Function],
     getById: [Function],
     getByCustomerNumber: [Function],
     getByNumber: [Function],
     getByCountryCode: [Function],
     getByCity: [Function],
     getByTerm: [Function]
    },
  estimate:
   { create: [Function],
     delete: [Function],
     sendbyemail: [Function],
     createinvoice: [Function],
     get: [Function],
     getByEstimateId: [Function],
     getById: [Function],
     getByCustomerId: [Function],
     getByEstimateNumber: [Function],
     getByNumber: [Function],
     getByStartEstimateDate: [Function],
     getByStartDate: [Function],
     getByEndEstimateDate: [Function],
     getByEndDate: [Function],
    },
  invoice:
   { create: [Function],
     get: [Function],
     getByInvoiceId: [Function],
     getById: [Function],
     getByInvoiceNumber: [Function],
     getByNumber: [Function],
     getByInvoiceTitle: [Function],
     getByTitle: [Function],
     getByCustomerId: [Function],
     getByMonth: [Function],
     getByYear: [Function],
     getByStartDueDate: [Function],
     getByEndDueDate: [Function],
     getByState: [Function],
     getByType: [Function],
     update: [Function],
     delete: [Function],
     complete: [Function],
     cancel: [Function],
     sign: [Function],
     sendbyemail: [Function],
     sendbypost: [Function],
     setpaid: [Function] 
    },
  item:
   { get: [Function],
     getByInvoiceId: [Function],
     delete: [Function] 
    },
  recurring:
   { create: [Function],
     get: [Function],
     getByInvoiceId: [Function],
     getByInvoiceNumber: [Function],
     getByInvoiceTitle: [Function],
     getByCustomerId: [Function],
     getByMonth: [Function],
     getByYear: [Function],
     getByStartDueDate: [Function],
     getByEndDueDate: [Function],
     getByState: [Function],
     getByType: [Function],
     update: [Function],
     delete: [Function] 
    },
  revenue:
   { create: [Function],
     get: [Function],
     getByInvoiceId: [Function],
     getByInvoiceNumber: [Function],
     getByInvoiceTitle: [Function],
     getByCustomerId: [Function],
     getByMonth: [Function],
     getByYear: [Function],
     getByStartDueDate: [Function],
     getByEndDueDate: [Function],
     getByState: [Function],
     getByType: [Function],
     update: [Function],
     delete: [Function] 
    },
  expense:
   { create: [Function],
     get: [Function],
     getByInvoiceId: [Function],
     getByInvoiceNumber: [Function],
     getByMonth: [Function],
     getByYear: [Function] 
    },
  article:
   { create: [Function],
     get: [Function],
     getByArticleNumber: [Function],
     getByNumber: [Function],
     update: [Function],
     delete: [Function] 
    },
  document: { create: [Function] },
  project:
   { create: [Function],
     get: [Function],
     getByProjectId: [Function],
     getById: [Function],
     getByCustomerId: [Function],
     update: [Function],
     delete: [Function] 
    },
  time:
   { create: [Function],
     get: [Function],
     getByTimeId: [Function],
     getById: [Function],
     getByCustomerId: [Function],
     getByProjectId: [Function],
     getByTaskId: [Function],
     getByStartDate: [Function],
     getByEndDate: [Function],
     getByDate: [Function],
     update: [Function],
     delete: [Function] 
    } 
  }