Skip to content

API Documentation

Mike Iversen edited this page Apr 26, 2022 · 49 revisions

The "API" of Netman consists of 3 parts. Those parts are

Each of these 3 pieces have their own specification which is laid out below. For more details on how these parts interact, as well as how Netman as whole works, please checkout the Dev Guide

What to expect from this documentation

Each of the above parts will have their "public facing" items documented here. "Private" functions/variables will not be documented in this documentation as they are not meant to be used.

Private functions/variables will usually have a _ leading them (so for example, _my_private_variable or _my_private_function).

Note, the specification for each function below is laid out in the follow example format

function_name(param1, param2, paramX)
  • Version Added:
  • Param1
    • Type: Expected Type
    • Details: (Optional)
  • Param2
    • Type: Expected Type
    • Details: (Optional)
  • ParamX
    • Type: Expected Type
    • Details: (Optional)
  • Returns
    • Type: Expected Return Type
    • Details: (Optional)
  • Throws
    • Details about potential errors that are thrown in this function
  • Notes (Optional)

API

function init(core_providers)
  • Version Added: 0.1
  • core_providers
    • Type: Array
    • Details: core_providers is an optional array that can be provided on API initialization. If not provided, this will default to netman.providers
  • Returns: nil
  • Throws
    • Errors thrown by load_provider will be thrown from this as well
  • Notes
    • Init is called automatically on import of netman.api and has a lock in place to prevent side effects of multiple imports of api.
    • This function does not need to be called when importing netman.api
function dump_info(output_path)
  • Version Added: 0.1
  • output_path
    • Type: String
    • Details: output_path is optional and defaults to $HOME/*random string* where *random string* is a randomly generated 10 character string
  • Returns: nil
  • Throws: nil
  • Notes
    • dump_info can be called via the :Nmlogs vim command and will do the following 2 things
      • Dump session related logs into the file created at output_path (Note: if a file exists in output_path, it will be overwritten with the dump)
      • Open this file in a new NetmanLogs filetype buffer for viewing
function unload(buffer_index)
function load_provider(provider_path)
function load_explorer(explorer_path, force)
function read(buffer_index, path)
function delete(delete_path)
function write(buffer_index, write_path)
version

Clone this wiki locally