Usage

Place your functions instruction in the README file. It will appear on the function's Usage tab.

Examples

By providing some simple configurations, you can add a "Try it Out!" tab to the Bantam function dashboard page for users to test your function.

In order to generate these examples, all you need to do is add an examples array underneath a bantam key in the package.json file.

When the function is published next, the "Try it Out!" tab will be activated. See here an example of the "Try it Out!" tab.

Example:

inside package.json...

  "bantam": {
    "examples": [
      {
        "name": "Image Resize",
        "description": "Resize the image down to 500px width.",
        "type": "image",
        "arguments": {
          "url": "https://images.pexels.com/photos/1637108/pexels-photo-1637108.jpeg",
          "width": 500
        }
      },
      {
        "name": "Image Contain / Low Quality",
        "description": "Resize the image to be contained within a 500x200px image. Also, reduce the quality of the image.",
        "type": "image",
        "arguments": {
          "url": "https://images.pexels.com/photos/1637108/pexels-photo-1637108.jpeg",
          "width": 500,
          "height": 200,
          "method": "inside",
          "quality": 80
        }
      },
      {
        "name": "Black & White",
        "description": "Make the image black and white, and resize the image down to 500px width.",
        "type": "image",
        "arguments": {
          "url": "https://images.pexels.com/photos/1637108/pexels-photo-1637108.jpeg",
          "width": 500,
          "filter": "greyscale"
        }
      }
    ]
  },

  ...

Publishing the function with the above examples would result in a dropdown on the "Try it Out!" page with three different prefilled examples: "Image Resize", "Image Contain / Low Quality", and "Black and White".

Example Arguments

Each object inside of the examples array has the following arguments: