import { RouterOSAPI } from "node-routeros" ; import { RosApiCommands } from "./RosApiCommands" ; import { RosApiModel } from "./RosApiModel" ; export class RosApiMenu { /**
     * The raw API
     */ private rosApi : RouterOSAPI ; /**
     * Toggles snake_case mode, defaults to camelCase
     */ private snakeCase : boolean = false ; param rosApi constructor ( rosApi ) { this . rosApi = rosApi ; } param path public menu ( path ) { return new RosApiCommands ( this . rosApi , path , this . snakeCase ) ; } /**
     * Instead of transforming the routeros properties
     * to camelCase, transforms to snake_case
     */ public useSnakeCase ( ) { this . snakeCase = true ; } param item public model ( item ) { if ( Array . isArray ( item ) ) { const items = [ ] ; for ( const i of item ) { items . push ( new RosApiModel ( this . rosApi , i , this . snakeCase ) ) ; } return items ; } return new RosApiModel ( this . rosApi , item , this . snakeCase ) ; } }