# faux-api-client

> NodeJS/Typescript PFSense fauxApi Client

Latest version **1.0.9** (published 2019-04-10) · LGPL-3.0-or-later license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2019-04-10 |
| First published | 2018-12-04 |
| Weekly downloads | 0 |
| License | LGPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 36.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jean-François Cloutier |
| Maintainers | pseudorandom |
| Keywords | fauxApi, PFSense, Firewall |

## Links

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

## Dependencies (2)

- [request-promise-native](https://npm.io/package/request-promise-native.md) ^1.0.5
- [@types/request-promise-native](https://npm.io/package/@types/request-promise-native.md) ^1.0.15

## Recent versions

- 1.0.9 (latest) — 2019-04-10
- 1.0.8 — 2019-04-10
- 1.0.7 — 2019-04-04
- 1.0.6 — 2018-12-07
- 1.0.5 — 2018-12-07
- 1.0.4 — 2018-12-04
- 1.0.3 — 2018-12-04
- 1.0.2 — 2018-12-04
- 1.0.1 — 2018-12-04
- 1.0.0 — 2018-12-04

## README

# faux-api-client
NodeJS/Typescript Client for PFSense Faux-API

# Pre-requisite
- An host with PF Sense installed
- FauxApi installed (see https://github.com/ndejong/pfsense_fauxapi/blob/master/README.md)
- FauxApi credentials (in /etc/fauxapi/credentials.ini... see https://github.com/ndejong/pfsense_fauxapi/blob/master/README.md)
- Allowed methods (in /etc/fauxapi/pfsense_function_calls.txt... see https://github.com/ndejong/pfsense_fauxapi/blob/master/README.md)

# How to use
First `npm install --save faux-api-client`

Then, in your project:
```javascript
import {FauxApiClient, IFauxApiResponse} from 'faux-api-client';

const fauxApiClient = new FauxApiClient(
    '<PFSense Server IP Address>',
    '<PF Sense Key>',
    '<PF Sense Secret>'
);

fauxApiClient.getConfiguration()
    .then((success: IFauxApiResponse) => {
        console.log('#################################################');
        console.log('#                SUCCESS                        #');
        console.log('#################################################');
        console.log(JSON.stringify(success));
    })
    .catch((error: Error) => {
        console.log('#################################################');
        console.log('#                 ERROR                         #');
        console.log('#################################################');
        console.log(JSON.stringify(error));
    });
```

# Available commands
```javascript
public async aliasUpdateUrlTables(): Promise<IFauxApiResponse>;
public async callFunction(functionName: string, ...args: any[]): Promise<IFauxApiResponse>;
public async gatewayStatus(): Promise<IFauxApiResponse>;
public async getBackupConfiguration(): Promise<IFauxApiResponse>;
public async getBackupConfigurationList(): Promise<IFauxApiResponse>;
public async getConfiguration(): Promise<IFauxApiResponse>;
public async getRule(ruleNumber: number): Promise<IFauxApiResponse>;
public async interfaceStatistics(interfaceName: string): Promise<IFauxApiResponse>;
public async patchConfiguration(configuration: any): Promise<IFauxApiResponse>;
public async rebootSystem(): Promise<IFauxApiResponse>;
public async reloadConfiguration(): Promise<IFauxApiResponse>;
public async restoreConfiguration(configurationFilePath: string): Promise<IFauxApiResponse>;
public async sendEvent(event: any): Promise<IFauxApiResponse>;
public async setConfiguration(configuration: any): Promise<IFauxApiResponse>;
public async systemStatistics(): Promise<IFauxApiResponse>;
```

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