/faux-api-client

NodeJS/Typescript Client for PFSense Faux-API

Primary LanguageTypeScriptGNU Lesser General Public License v3.0LGPL-3.0

faux-api-client

NodeJS/Typescript Client for PFSense Faux-API

Pre-requisite

How to use

First npm install --save faux-api-client

Then, in your project:

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

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>;