# netvisor-api-client

> Third party Netvisor API client.

Latest version **0.0.17** (published 2021-11-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install netvisor-api-client
pnpm add netvisor-api-client
yarn add netvisor-api-client
bun add netvisor-api-client
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.17 |
| Published | 2021-11-26 |
| First published | 2021-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 88.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | tonitakala, kaisakassila |

## Links

- npm: https://www.npmjs.com/package/netvisor-api-client
- Repository: https://github.com/rantalainen/netvisor-api-client
- Homepage: https://github.com/rantalainen/netvisor-api-client#readme
- Issues: https://github.com/rantalainen/netvisor-api-client/issues
- npm.io page: https://npm.io/package/netvisor-api-client

## Dependencies (8)

- [got](https://npm.io/package/got.md) ^11.8.1
- [crypto](https://npm.io/package/crypto.md) ^1.0.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [moment](https://npm.io/package/moment.md) ^2.29.1
- [xml2js](https://npm.io/package/xml2js.md) ^0.4.23
- [csvtojson](https://npm.io/package/csvtojson.md) ^2.0.10
- [form-data](https://npm.io/package/form-data.md) ^3.0.0
- [js2xmlparser](https://npm.io/package/js2xmlparser.md) ^4.0.1

## Recent versions

- 0.0.17 (latest) — 2021-11-26
- 0.0.16 — 2021-11-16
- 0.0.15 — 2021-11-11
- 0.0.14 — 2021-10-19
- 0.0.13 — 2021-10-12
- 0.0.12 — 2021-10-12
- 0.0.11 — 2021-10-06
- 0.0.10 — 2021-08-20
- 0.0.9 — 2021-08-18
- 0.0.8 — 2021-08-13
- 0.0.7 — 2021-08-09
- 0.0.6 — 2021-07-29
- 0.0.5 — 2021-07-06
- 0.0.4 — 2021-07-06
- 0.0.3 — 2021-07-02
- … 1 more at https://npm.io/package/netvisor-api-client/versions

## README

# netvisor-api-client
Third party Netvisor API client.

:warning: This tool is in early stages and is subject to change. 

## Installation

Install from npm (not available yet):

```
npm install netvisor-api-client
```

## Setup

### Import to NodeJS project

```javascript
const NetvisorApiClient = require('netvisor-api-client').NetvisorApiClient;
```

### Import to TypeScript project

```javascript
import { NetvisorApiClient } from 'netvisor-api-client';
```

### Setup client

* `integrationName` Name for integration that is visible in Netvisor UI (self defined)
* `customerId` consult Netvisor (Header: X-Netvisor-Authentication-CustomerId)
* `customerKey` consult Netvisor
* `partnerId` consult Netvisor (Header: X-Netvisor-Authentication-PartnerId)
* `partnerKey` consult Netvisor
* `organizationId` Oganization id for company

```javascript
const nvApiClient = new NetvisorApiClient({
  integrationName: '',
  customerId: '',
  customerKey: '',
  partnerId: '',
  partnerKey: '',
  organizationId: '1234567-8'
});

```

## Methods (examples)

```javascript
// Each resource type has saveByXmlData() and saveByXmlFilePath() posts (below examples with products):
const data = = `<root>
  <product>
    <productbaseinformation>
      <productcode>CC</productcode>
      <productgroup>Books</productgroup>
      <name>Code Complete 2</name>
      <unitprice type="net">42,5</unitprice>
      <unit>pcs</unit>
      <isactive>1</isactive>
      <issalesproduct>1</issalesproduct>
      <inventoryenabled>1</inventoryenabled>
    </productbaseinformation>
    <productbookkeepingdetails>
      <defaultvatpercentage>24</defaultvatpercentage>
    </productbookkeepingdetails>
  </product>
</root>`
await nvApiClient.product.saveByXmlData(data);

const filepath = 'my\filepath\myfile.xml';
await nvApiClient.product.saveByXmlFilePath(filepath);

// Get vouchers by date
const vouchers = await nvApiClient.accounting.getVouchers('2021-01-01', '2021-01-31');

// Get products by product code
const products = await nvApiClient.product.getProducts('productCode');

// Save budget by json dataset
const data = {
  AccountingBudget: {
    Ratio: { '@': {type: 'account'}, '#': 4010 },
    Sum: -1000,
    Year: 2021,
    Month: 02,
    Version: 'Budjettiversio 1',
    VatClass: 0,
    Combinations: {
      Combination: [
        {
          CombinationSum: -500,
          Dimension: {
            DimensionName: 'Projects',
            DimensionItem: 'Project X'
          }
        }, 
        { 
          CombinationSum: -500,
          Dimension: {
            DimensionName: 'Projects',
            DimensionItem: 'Project Y'
          }
        }
      ]
    }
  }
};
await nvApiClient.budget.saveBudgetByDataSet(data);

// Save budget from xml
await nvApiClient.budget.saveBudgetByXmlFilePath(filePath);

// More methods coming
```

## Changelog

0.0.1 Under development
0.0.3 Added method saveInvoiceByDataSet in salesinvoice
0.0.4 Added methods: inventory in products and purchaseinvoice
0.0.7 Added method getSales in salesinvoice
0.0.8 Improvements to salesinvoice and products
0.0.11 Fix undefined error (getSales) if zero results are found
0.0.12-13 Minor fix in fetching orders
0.0.14 Budgeting improvements + added methods: getBudgetAccountList and getDimensions in accounting
0.0.16 Added customer methods
0.0.17 Added check if no products are found in getProducts

---
_Source: https://npm.io/package/netvisor-api-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
