Skip to content

Commit 9e01362

Browse files
authored
Add support for custom actions triggering (#544)
* Add default value to documentation on fields based on schema * Add alert source APIs * Add support for custom actions triggering
1 parent 11406ad commit 9e01362

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Feature
2+
body: Add `client.InvokeAction` to support triggering actions via the API
3+
time: 2025-05-14T14:51:09.396768-05:00

actions.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,14 @@ func (client *Client) DeleteTriggerDefinition(input string) error {
216216
err := client.Mutate(&m, v, WithName("TriggerDefinitionDelete"))
217217
return HandleErrors(err, m.Payload.Errors)
218218
}
219+
220+
func (client *Client) InvokeAction(input CustomActionsTriggerInvokeInput) error {
221+
var m struct {
222+
Payload BasePayload `graphql:"customActionsTriggerInvoke(input: $input)"`
223+
}
224+
v := PayloadVariables{
225+
"input": input,
226+
}
227+
err := client.Mutate(&m, v, WithName("CustomActionsTriggerInvoke"))
228+
return HandleErrors(err, m.Payload.Errors)
229+
}

input.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,13 @@ type CustomActionsTriggerDefinitionUpdateInput struct {
758758
ResponseTemplate *Nullable[string] `json:"responseTemplate,omitempty" yaml:"responseTemplate,omitempty" example:"example_value"` // The liquid template used to parse the response from the External Action (Optional)
759759
}
760760

761+
// CustomActionsTriggerInvokeInput Inputs that specify the trigger definition to invoke, the user that invoked it, and what object it is invoked on
762+
type CustomActionsTriggerInvokeInput struct {
763+
ManualInputs JSON `json:"manualInputs,omitempty" yaml:"manualInputs,omitempty" example:"{\"name\":\"my-big-query\",\"engine\":\"BigQuery\",\"endpoint\":\"https://google.com\",\"replica\":false}"` // Additional details provided for a specific invocation of this Custom Action (Optional Default: "{}")
764+
TargetObject *IdentifierInput `json:"targetObject,omitempty" yaml:"targetObject,omitempty"` // The identifier of the object to perform the custom action on (Optional)
765+
TriggerDefinition IdentifierInput `json:"triggerDefinition" yaml:"triggerDefinition"` // The trigger definition to invoke (Required)
766+
}
767+
761768
// CustomActionsWebhookActionCreateInput Specifies the input fields used in the `customActionsWebhookActionCreate` mutation
762769
type CustomActionsWebhookActionCreateInput struct {
763770
Async *bool `json:"async,omitempty" yaml:"async,omitempty" example:"false"` // Whether the action expects an additional, asynchronous response upon completion (Required Default: false)

0 commit comments

Comments
 (0)