Skip to content

Trigger methods: update, delete

The Trigger Verbs update, delete as typed SDK methods, with inputs, result, refusals and an example.

Reference for Trigger, one group of Trigger methods.

Trigger.update

Changes the given properties of a Trigger. Verb page.

TypeScript
interface TriggerVerbs {
  update(input: TriggerUpdateInput, options?: SB.CallOptions): SB.Call<Trigger>
}

Emits Trigger.updated.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Trigger.
eventstringThe Event selector it matches, such as Order.placed.
schedulestringA cadence or cron expression.
wherestringThe predicate an event Trigger matches, such as choice = 'raise'.
thresholdjsonA Metric staying below or above a value, optionally for a while, such as four weeks.
atstringWhen in its cadence a schedule runs, on the namespace’s clock, such as mon 09:00.

Returns

OutputTypeRequiredDescription
triggerTriggerrequiredThe Trigger.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const trigger = await $.Trigger.update({ id: 'trigger_Hg9n0lrBdP', threshold: {} })

Trigger.delete

Deletes a Trigger: a soft delete that keeps its history, undone by Thing.restore. Verb page.

TypeScript
interface TriggerVerbs {
  delete(input: TriggerDeleteInput, options?: SB.CallOptions): SB.Call<Trigger>
}

Emits Trigger.deleted.

Inputs

InputTypeRequiredDescription
idstringrequiredThe id of the Trigger.

Returns

OutputTypeRequiredDescription
triggerTriggerrequiredThe Trigger.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

TypeScript
import { $ } from 'startup-builder'

const trigger = await $.Trigger.delete({ id: 'trigger_Hg9n0lrBdP' })