routeros-api
Version:
Mikrotik Routerboard RouterOS API for NodeJS
208 lines (207 loc) • 7.25 kB
TypeScript
import { RouterOSAPI } from "./RouterOSAPI";
import { RouterOSAPICrud } from "./RosApiCrud";
import * as Types from "./Types";
import { RStream } from "./RStream";
export declare class RosApiCommands extends RouterOSAPICrud {
/**
* Creates a set of operations to do over a menu
*
* @param rosApi The raw API
* @param path The menu path we are doing actions on
* @param snakeCase If we should use snake_case
*/
constructor(rosApi: RouterOSAPI, path: string, snakeCase: boolean);
/**
* Limits the returned fields when printing
*
* @param fields Fields to return
*/
select(fields: string | string[]): RosApiCommands;
/**
* Moves a rule ABOVE the destination
*
* @param from the rule you want to move
* @param to the destination where you want to move
*/
move(from: Types.Id, to?: string | number): Types.SocPromise;
/**
* Alias for select()
* @param fields Fields to return
*/
only(fields: string | string[]): RosApiCommands;
/**
* Add an option to the command. As an example: count-only or detail
*
* @param opts an option or array of options
* @param args multiple strings of parameters of options
*/
options(opts: string | string[], ...args: string[]): RosApiCommands;
/**
* Alias for select()
* @param fields
*/
proplist(fields: string | string[]): RosApiCommands;
/**
* Filters the content when printing or define which item
* will do actions to when not printing
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
* @param addQuestionMark if will start the sentence with a question mark (?), else, starts with equal (=)
*/
where(key: object | string, value?: string, addQuestionMark?: boolean): RosApiCommands;
/**
* Alias to where, but without adding question marks
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
query(key: object | string, value?: string): RosApiCommands;
/**
* Alias to where, but without adding question marks
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
filter(key: object | string, value?: string): RosApiCommands;
/**
* Raw API syntax to be added to the stack
*
* @param search array of sentences to send over the api
*/
whereRaw(search: string[]): RosApiCommands;
/**
* Adds an OR operator when filtering content
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
orWhere(key: object | string, value?: string): RosApiCommands;
/**
* Adds a NOT and then OR operator when filtering content
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
orWhereNot(key: object | string, value?: string): RosApiCommands;
/**
* Adds an AND operator when filtering content
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
andWhere(key: object | string, value?: string): RosApiCommands;
/**
* Adds a NOT and then an AND operator when filtering content
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
andWhereNot(key: object | string, value?: string): RosApiCommands;
/**
* Adds an NOT operator when filtering content
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
whereNot(key: object | string, value?: string): RosApiCommands;
/**
* Adds a HIGHER THAN (>) operator when filtering content
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
whereHigher(key: object | string, value?: string): RosApiCommands;
/**
* Adds a LOWER THAN (<) operator when filtering content
*
* @param key a key to a value or an object with keys and values to filter
* @param value the value if a string key is passed
*/
whereLower(key: object | string, value?: string): RosApiCommands;
/**
* Checks if the parameter or key exists by having a value when filtering
*
* @param key the parameter to check
*/
whereExists(key: string): RosApiCommands;
/**
* Alias to whereExists
*
* @param key the parameter to check
*/
whereNotEmpty(key: string): RosApiCommands;
/**
* Check if the parameter or key doesn't exist or has no value when filtering
*
* @param key the parameter to check
*/
whereEmpty(key: string): RosApiCommands;
/**
* Alias of whereEmpty
*
* @param key the parameter to check
*/
whereNotExists(key: string): RosApiCommands;
/**
* Prints the data of the menu
*
* @param data optional filtering, like what you get when using the where function
*/
get(data?: object): Types.SocPromise;
/**
* Alias of get
*
* @param data optional filtering, like what you get when using the where function
*/
getAll(data?: object): Types.SocPromise;
/**
* Alias of get, but in the process creates a model
* of each item returned
*
* @param data optional filtering, like what you get when using the where function
*/
getModel(data?: object): Types.SocPromise;
/**
* Alias of get
*
* @param data optional filtering, like what you get when using the where function
*/
print(data?: object): Types.SocPromise;
/**
* Alias of find
*
* @param data optional filtering, like what you get when using the where function
*/
first(data?: object): Promise<object>;
/**
* Returns the first item if found, else return null
*
* @param data optional filtering, like what you get when using the where function
*/
find(data?: object): Promise<object>;
/**
* Alias of find
*
* @param data optional filtering, like what you get when using the where function
*/
getOne(data?: object): Promise<object>;
/**
* Alias of find
*
* @param data optional filtering, like what you get when using the where function
*/
getOnly(data?: object): Promise<object>;
/**
* Remove all entries of the current menu
*/
purge(): Promise<object>;
/**
* Start a streaming of content and returns a Stream object
* so it can be paused, resumed or stopped
*
* @param action optional action to add when streaming, like "listen" for example
* @param callback
*/
stream(action: any, callback?: (err: Error, packet?: any, stream?: RStream) => void): RStream;
}