Skip to content

Filters

Filter

Filter = object

Represents a filter.

Properties

alias

alias: string

The alias of the filter. This alias is used when referencing the filter in an HTTPQL query (e.g. preset:my-alias).

id

id: ID

The ID of the filter.

name

name: string

The name of the filter.

query

query: HTTPQL

The HTTPQL expression of the filter.


FiltersSDK

FiltersSDK = object

SDK for interacting with the Filters page.

Properties

addToSlot

addToSlot: DefineAddToSlotFn<FilterSlotContent>

Add a component to a slot.

Param

The slot to add the component to.

Param

The content to add to the slot.

Example
ts
sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
  type: "Button",
  label: "My Button",
  icon: "my-icon",
  onClick: () => {
    console.log("Button clicked");
  },
});

sdk.filters.addToSlot(FilterSlot.CreateHeader, {
  type: "Custom",
  definition: MyComponent,
});

sdk.filters.addToSlot(FilterSlot.UpdateHeader, {
  type: "Command",
  commandId: "my-command",
  icon: "my-icon",
});
create()

create: (options: object) => Promise<Filter>

Creates a filter.

Parameters
ParameterTypeDescription
options{ alias: string; name: string; query: HTTPQL; }Options for the filter.
options.aliasstringThe alias of the filter. Used when referencing the filter in an HTTPQL query (e.g. preset:my-alias). Should be unique and follow the format [a-zA-Z0-9_-]+.
options.namestringThe name of the filter. Should be unique.
options.queryHTTPQLThe HTTPQL query of the filter.
Returns

Promise<Filter>

The created filter.

delete()

delete: (id: ID) => Promise<void>

Deletes a filter.

Parameters
ParameterTypeDescription
idIDThe ID of the filter to delete.
Returns

Promise<void>

getAll()

getAll: () => Filter[]

Gets all filters.

Returns

Filter[]

The filters.

update()

update: (id: ID, options: object) => Promise<Filter>

Updates a filter.

Parameters
ParameterTypeDescription
idIDThe ID of the filter to update.
options{ alias: string; name: string; query: HTTPQL; }Options for the filter.
options.aliasstringThe alias of the filter.
options.namestringThe name of the filter.
options.queryHTTPQLThe HTTPQL query of the filter.
Returns

Promise<Filter>

The updated filter.


FilterSlot

const FilterSlot: object

The slots in the Filters UI.

Type Declaration

CreateHeader

readonly CreateHeader: "create-header"

The header area of the preset form create component.

UpdateHeader

readonly UpdateHeader: "update-header"

The header area of the preset form update component.