Skip to main content

@elfsquad/custom-scripting

Api

The Api class allows you to interact with the Elfsquad API.


fetch(url, init)

Send an API request to the Elfsquad API. The url parameter is always prefixed with the base URL of the Elfsquad API.

Method parameters


url required (string)

The URL to send the request to.

init required (unknown)

The request options. This will be directly passed on to the native fetch function.

Returns (Promise<FetchResponse>)


import { api } from '@elfsquad/custom-scripting';
const { status, body } = await api.fetch('/api/2/features');

Ui

The Ui class allows you to interact with the Elfsquad UI.


openDialog(parameters)

Open a dialog with a specific title and source URL.

Method parameters


parameters required (OpenDialogParameters)

The parameters to open the dialog with.

Returns (Promise<OpenDialogResponse>)


import { ui } from '@elfsquad/custom-scripting';
ui.openDialog({
title: 'My dialog',
src: 'https://your-website.com/dialog.html'
});

reload()

Reload the data in the current view.

import { ui } from '@elfsquad/custom-scripting';
ui.reload();

Dialog

The Dialog class allows you to interact your dialog


close()

Close the current dialog.

import { dialog } from '@elfsquad/custom-scripting';
dialog.close();