facturama
Facturama is a Mexican electronic invoicing API.
Usage
import { facturama } from 'netzo/apis/facturama.ts'
const api = facturama({
username: Deno.env.get('FACTURAMA_USERNAME'),
password: Deno.env.get('FACTURAMA_PASSWORD')
})
Configuration
The facturama
factory function expects an object with the following, and returns an object with an API client api
.
Param | Type | Default | Description |
---|---|---|---|
username | string | Deno.env.get('FACTURAMA_USERNAME') | Facturama username |
password | string | Deno.env.get('FACTURAMA_PASSWORD') | Facturama password |
Refer to the API documentation to get the required information.
Examples
The following examples assume you have created an api client instance.
Get product
Get a product by id.
const resultData = await api.Product[PRODUCT_ID].get<Product>()
Add product
Add a new product.
const data: DataAddProduct = {
name: 'New Product',
description: 'Product description',
price: 100,
unit: 'service'
}
const resultData = await api.Product.post<Product>(data)
Update product
Update a product by id.
const data: DataUpdateProduct = { description: 'Updated description' }
await api.Product[PRODUCT_ID].put<void>(data)
Delete product
Delete a product by id.
const resultData = await api.Product[PRODUCT_ID].delete<Product>()