Registers a repository app automation trigger, which adds an entry to the automation page that a user can configure and that fires a format function when the app raises a matching RepositoryAppTriggerEvent. Started from ControllerMappingList.automationTrigger(). A trigger has an id, a description shown to the user, a format function that renders the notification text from the event's trigger items, and any number of named options, each backed by a function that supplies the choices for that option on the automation configuration page. Call build() to construct the resulting TriggerTypeMapping and register it, unless an equivalent one is already registered.
Group: Builders
Methods
triggerId(String triggerId)
Returns: TriggerTypeBuilder
Sets the identifier of this trigger, matched against RepositoryAppTriggerEvent.getEventId() when the app raises an event.
| Parameter | Description |
|---|---|
triggerId | the trigger's identifier |
description(String description)
Returns: TriggerTypeBuilder
Sets the human-readable description of this trigger shown to a user configuring it on the automation page.
| Parameter | Description |
|---|---|
description | the trigger's description |
format(Object format)
Returns: TriggerTypeBuilder
Sets the name of the function invoked to render the notification text for this trigger, called with the page and the event's up to five trigger items.
| Parameter | Description |
|---|---|
format | the name of the format function |
addOption(String label, Object func)
Returns: TriggerTypeBuilder
Adds a named configuration option to this trigger, backed by a function that supplies the list of choices offered for that option on the automation configuration page.
| Parameter | Description |
|---|---|
label | the label shown for this option |
func | the name of the function that populates the option's choices |
build()
Returns: TriggerTypeMapping
Finishes this builder, constructing a TriggerTypeMapping from the configured values and registering it if an equivalent mapping is not already present.