SDK Reference

Xomlo.io SDK contains functions specified below. All are accessible via functions object which you can import with the following code:

import { functions } from "@xomlo/xomlo-sdk";

MAIN

This function is called every time the connector is started. It has only one argument required, a void function with the payload as an argument and all of your logic in the body.

Arguments:

NameTypeDescription

fn

async function

Async function with the connector's payload as an argument. All code should be inside this function.

Returns:

void

LOGGER

Everything in the application should be logged via our custom logger instead of using console.log(). This is because all logs are stored while the connector is run in the Xomlo.io runtime. For more information, please follow the Winston logger documentation. Usage example:

functions.logger.info();
functions.logger.error();
functions.logger.dev();
functions.logger.warning();

STORAGE

You should use our .saveOutput() function every time you work with the filesystem. It creates your file in the ./output folder. When you run your connector in the Xomlo.io runtime every file inside the ./output folder will be uploaded to the Xomlo.io storage bucket.

await functions.storage.saveOutput('test.txt', 'test');

Arguments:

NameTypeDescription

fileName

string

Name of the created file (you can also contain the subfolder)

data

string

Content of the created file

Returns:

void

HTTP

You should use our HTTP bundle every time you work with HTTP requests. Check the GOT documentation for more information.

await functions.http.post(...);

Last updated