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
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
| Parameter | Type | Description |
|---|---|---|
options | { alias: string; name: string; query: HTTPQL; } | Options for the filter. |
options.alias | string | The 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.name | string | The name of the filter. Should be unique. |
options.query | HTTPQL | The HTTPQL query of the filter. |
Returns
Promise<Filter>
The created filter.
delete()
delete: (
id:ID) =>Promise<void>
Deletes a filter.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | ID | The ID of the filter to delete. |
Returns
Promise<void>
getAll()
getAll: () =>
Filter[]
Gets all filters.
Returns
Filter[]
The filters.
update()
Updates a filter.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | ID | The ID of the filter to update. |
options | { alias: string; name: string; query: HTTPQL; } | Options for the filter. |
options.alias | string | The alias of the filter. |
options.name | string | The name of the filter. |
options.query | HTTPQL | The HTTPQL query of the filter. |
Returns
Promise<Filter>
The updated filter.
FilterSlot
constFilterSlot:object
The slots in the Filters UI.
Type Declaration
CreateHeader
readonlyCreateHeader:"create-header"
The header area of the preset form create component.
UpdateHeader
readonlyUpdateHeader:"update-header"
The header area of the preset form update component.
