# Package.json Documentation

Main Documentation

## Data types

Each field will be defined with a type, when being loaded in Infinity Dashboard if the field does not match the type the module will fail to load.

## Required Fields

The below are the fields that are required to pass validation when the module is loaded.

`name`
  Type: String
  The display name of the module. `Example: Hello World`
`description`
  Type: String
  A brief description of the module functionality. `Example: Displays hello world`
`author`
  Type: String
  The name of the author of the module. `Example: FIPLAB Ltd.`
`bundleID`
  Type: String
  An identifier that uniquely identifies your module. `Example: com.fiplab.helloworld`
`version`
  Type: String
  The version number for your module. `Example: 1.0.0`

## Optional Fields

`website`
  Type: String
  The module creators website. `Example: http://fiplab.com/`
`refreshInterval`
  Type: Integer
  Specifies the default refresh interval (in seconds) for the module. Must be one of the following values: `5, 30, 60, 300, 600, 1800, 3600, 43200, 86400`
`minimumRefreshInterval`
  Type: Integer
  Specifies the minimum available refresh interval to the user. Must be one of the values from above.
`hasNotifications`
  Type: Boolean
  Defines whether or not the module uses the notification system. If this is `true` the module will have access to the `FIPLAB.notify` function as well as enabling the `Notifications` tab in the module configuration.
  If this is set to `false` all notifications from this module will be ignored, and the notifications tab will not appear.
`category`
  Type: String

  The category of the module, this allows the user to filter installed modules by this category. Must be one of the following values:

  - Business
  - Developer Tools
  - Education
  - Entertainment
  - Finance
  - Fitness
  - Lifestyle
  - Medical
  - Music
  - News
  - Productivity
  - Reference
  - Social Networking
  - Sports
  - Travel
  - Utilities
  - Weather

### User Options

`user_options`
  Type: Array
  An array of user option objects that defines the user configurable options for the module. Examples of these are `username/password, a URL, input date, etc`

#### User option object

An Example of a user option object from the Amazon module is:

    {
      "title": "Show As",
      "name": "display",
      "type": "string",
      "options": [
        {
          "title": "Current Price",
          "tooltip": "Example: $55.99",
          "name": "currentPrice"
        },
        {
          "title": "Current Price (Percent Difference since Price Change)",
          "tooltip": "Example: $55.99 (-10%)",
          "name": "currentAndPercent"
        },
        {
          "title": "Current Price (Price Difference since Price Change)",
          "tooltip": "Example: $55.99 (-$9.99)",
          "name": "currentAndPriceDiff"
        },
      ],
      "default": "currentAndPriceDiff",
      "required": true
    }

`title`
  Type: String
  The display name of the option.
`name`
  Type: String
  The name of the variable that’s passed to the module via the `fiplab.arguments`.
`default`
  Type: String, number, boolean, date
  Sets the default value for this option. The type of this value should match the type of the option. IE: If the type of the option is a string, then this must be a string.
  If this type is a date then this must be a date string in the following format `yyyy-MM-dd HH:mm`
  This option is a dropdown and has a number of values, then this must be the `name` field for one of the values.
`type`
  Type: String
  Defines the type of field this is. Must be one of the following values: `string, boolean, number, date`
`tooltip`
  Type: String
  A helpful description of the field. This will be displayed when the user hovers over the config field, or as a placeholder for string fields.
`required`
  Type: Boolean
  Specifies whether this value is required or not. If this is set to true the module will not run unless ALL required fields are filled out.
`options`
  Type: Object or Array
  Defines specific options for the field. The options are limited based on the type of field this is.

  ### Object Options

  When the `options` value is an object the following values are available for each type:

  #### string

  `secure`
    Type: Boolean
    Specifies whether this value is a secure/password type input. If this is true the value of this option will be securely stored in the users Keychain.

  #### date

  `allowsDate`
    Type: Boolean
    Specifies whether the date picker should allow the user to select a date.
  `allowsTime`
    Type: Boolean
    Specifies whether the date picker should allow the user to select a time.

  #### number

  `min`
    Type: Integer
    The minimum value the user can select.
  `max`
    Type: Integer
    The maximum value the user can select.

  #### boolean

  Has no other configurable options. Not much to configure for a simple check box 🤣

  ### Array - Showing a dropdown as a user option

  Setting the `options` value to an array will display a dropdown of options to the user. An example is:

    "options": [
        {
          "title": "Current Price",
          "tooltip": "Example: $55.99",
          "name": "currentPrice"
        },
        null,
        {
          "title": "Current Price (Percent Difference since Price Change)",
          "tooltip": "Example: $55.99 (-10%)",
          "name": "currentAndPercent"
        },
        {
          "title": "Current Price (Price Difference since Price Change)",
          "tooltip": "Example: $55.99 (-$9.99)",
          "name": "currentAndPriceDiff"
        }

    ]

The above example will produce a dropdown with 3 values displayed to the user. a separator item will be displayed between the first and second items in the list.

`null`
  You can add a null item to the options array to display a separator item.
`title`
  Type: String
  The display name of the option.
`name`
  Type: String
  The value that will be passed via the `fiplab.arguments.{parent_option_name}`
`tooltip`
  Type: String
  A helpful description of the field. This will be displayed when the user hovers over the item in the dropdown.