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

@rayan-waapi/vos_factures

v0.0.26

Published

API to have better experiences with vosFactures

Downloads

10

Readme

VOS FACTURES

Package to help with the API from "vosFactures"

Authentication

To start you'll need to give to the API your credentials from vosFactures.

import vosFacturesAPI from "@rayan-waapi/vos_factures";

if (await vosFacturesAPI.authenticate(API_TOKEN)) {
    // The package is initialized
} else {
    // We've got an error
}

Client

To create a client

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const client = new vosFacturesAPI.Clients.Client();
client.name = "John Smith";
// Equal to
const client = new vosFacturesAPI.Clients.Client({ name: "John Smith" });

// Then save it
await client.save();
console.log(client.id);

To update a client

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const client = new vosFacturesAPI.Clients.Client({ name: "John Smith" });

// Then save it
await client.save();
client.name = "John Doe";
await client.update();

To delete a client

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const client = new vosFacturesAPI.Clients.Client({ name: "John Smith" });

// Then save it
await client.save();
await client.remove();

To retrieve a client

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const client = await vosFacturesAPI.Clients.Client.findById(clientId);

To retrieve many clients

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const clients = await vosFacturesAPI.Clients.Client.findBy({name: "John"}); // array of Client

To retrieve all clients

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const clients = await vosFacturesAPI.Clients.Client.findAll(); // array of Client

To retrieve invoices from a client

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const client = await vosFacturesAPI.Clients.Client.findById(clientId);
await client.getInvoices();

Products

Create a product

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const product = new vosFacturesAPI.Products.Product({
    name: "MY_CAKE",
    code: "CAKEISLIE",
    priceGross: "200.00",
    currency: "EUR",
    tax: "20"
});
await product.save()

To update a product

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const product = new vosFacturesAPI.Products.Product({
    name: "MY_CAKE",
    code: "CAKEISLIE",
    priceGross: "200.00",
    currency: "EUR",
    tax: "20"
});

// Then save it
await product.save();
product.name = "OUR_CAKE";
await product.update();

To delete a product

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const product = new vosFacturesAPI.Products.Product({
    name: "MY_CAKE",
    code: "CAKEISLIE",
    priceGross: "200.00",
    currency: "EUR",
    tax: "20"
});

// Then save it
await product.save();
await product.remove();

To retrieve a product

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const product = await vosFacturesAPI.Products.Product.findById(productId);

To retrieve many products

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const products = await vosFacturesAPI.Products.Product.findBy({currency: "EUR"}); // array of Product

To retrieve all products

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const products = await vosFacturesAPI.Products.Product.findAll(); // array of Product

Invoices

Create a invoice

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const invoice = new vosFacturesAPI.Invoices.Invoice({
    clientId,
    kind: "estimate"
});
invoice.addProduct(product)
await invoice.save()

To update a invoice

import vosFacturesAPI from "@rayan-waapi/vos_factures";

//....

await invoice.update();

To delete a invoice

import vosFacturesAPI from "@rayan-waapi/vos_factures";

//....

await invoice.remove();

To retrieve a invoice

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const invoice = await vosFacturesAPI.Invoices.Invoice.findById(invoiceId);

To retrieve the client object from an invoice

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const invoice = await vosFacturesAPI.Invoices.Invoice.findById(invoiceId);
await invoice.getClient(); // will return a Client

To retrieve many invoices

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const invoices = await vosFacturesAPI.Invoices.Invoice.findBy({clientId: clientId}); // array of Invoice

To retrieve all invoices

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const invoices = await vosFacturesAPI.Invoices.Invoice.findAll(); // array of Invoice

To create an invoice from an other invoice

import vosFacturesAPI from "@rayan-waapi/vos_factures";

// vosFacturesAPI is initialized
const invoice = await vosFacturesAPI.Invoices.Invoice.findById(invoiceId);
const newInvoice = invoice.duplicateAs("vat")
await newInvoice.save();

TESTS

You can run test thanks to npm test inside the package folder, before that you have to complete the .env file