Documentation
¶
Index ¶
- func DownloadFile(url string) (*grab.Response, error)
- func DynamicInputToType[T any](ctx sdkcontext.BaseContext) *T
- func GetRelativePathWithDepth(relativePath string, depth int) (string, error)
- func InputPropsToType[T any](input sdkcore.JSON) (*T, error)
- func InputToType[T any](ctx sdkcontext.BaseContext) *T
- func InputToTypeSafely[T any](ctx sdkcontext.BaseContext) (*T, error)
- func ReadREADME(content string) (string, error)
- func StringToFile(fileStr string) (*autoform.File, error)
- func WithDynamicFunctionCalling(fn *DynamicOptionsFn) smartform.DynamicFunction
- type Action
- type ActionDefinition
- type ActionError
- type ActionFactory
- type ActionMetadata
- type ActionRegistry
- type Auth
- type AuthConnectionStatus
- type AuthRequest
- type AuthResponse
- type DynamicIntegrationLoader
- type DynamicOptionsFn
- type FieldType
- type Integration
- type IntegrationDefinition
- type IntegrationMetadata
- type IntegrationRegistry
- type IntegrationSchemaModel
- type IntegrationType
- func (IntegrationType) GormDataType() string
- func (i IntegrationType) MarshalJSON() ([]byte, error)
- func (i IntegrationType) MarshalText() ([]byte, error)
- func (i *IntegrationType) Scan(value interface{}) error
- func (i IntegrationType) String() string
- func (i *IntegrationType) UnmarshalJSON(data []byte) error
- func (i *IntegrationType) UnmarshalText(text []byte) error
- func (i IntegrationType) Value() (driver.Value, error)
- func (IntegrationType) Values() []string
- type IntegrationsRegistrar
- type RegistrationMap
- type SchemaConfig
- type Trigger
- type TriggerDefinition
- type TriggerFactory
- type TriggerMetadata
- type TriggerRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶ added in v0.11.0
DownloadFile downloads a file from the specified URL using the grab package. It returns the grab.Response object and an error if any.
func DynamicInputToType ¶ added in v0.11.0
func DynamicInputToType[T any](ctx sdkcontext.BaseContext) *T
DynamicInputToType converts the resolved input of type `sdkcore.DynamicOptionsContext` to the desired type T. It uses JSON marshaling and unmarshalling to perform the conversion. If any error occurs during marshaling or unmarshaling, it returns nil. The function returns a pointer to the converted value of type T.
func GetRelativePathWithDepth ¶ added in v0.11.0
GetRelativePathWithDepth resolves a file path relative to the location of the caller, with adjustable depth.
func InputPropsToType ¶ added in v0.11.0
InputPropsToType returns a pointer to a value of type T by marshaling and unmarshaling the ResolvedInput field of the provided RunContext struct. If there is an error during the marshaling or unmarshaling process, nil is returned. The function signature is as follows:
func InputToType ¶ added in v0.11.0
func InputToType[T any](ctx sdkcontext.BaseContext) *T
InputToType returns a pointer to a value of type T by marshaling and unmarshaling the ResolvedInput field of the provided RunContext struct. If there is an error during the marshaling or unmarshaling process, nil is returned. The function signature is as follows:
func InputToTypeSafely ¶ added in v0.11.0
func InputToTypeSafely[T any](ctx sdkcontext.BaseContext) (*T, error)
InputToTypeSafely returns a pointer to a value of type T by marshaling and unmarshaling the ResolvedInput field of the provided RunContext struct. If there is an error during the marshaling or unmarshaling process, nil is returned. The function signature is as follows:
func ReadREADME ¶ added in v0.11.0
ReadREADME extracts the content of README.md from the current directory.
func StringToFile ¶ added in v0.11.0
StringToFile converts a file string to a *autoform.File object.
The function checks if the file string is a base64-encoded data or a URL. If the file string is base64-encoded data, it decodes the data and assigns it to the `Data` field of the
func WithDynamicFunctionCalling ¶ added in v0.11.0
func WithDynamicFunctionCalling(fn *DynamicOptionsFn) smartform.DynamicFunction
Types ¶
type Action ¶
type Action interface {
// Metadata returns metadata about the action
Metadata() ActionMetadata
// Properties returns the schema for the action's input configuration
Properties() *smartform.FormSchema
// Auth returns the authentication requirements for the action
Auth() *core.AuthMetadata
// Perform executes the action with the given context and input
Perform(ctx context.PerformContext) (core.JSON, error)
}
Action defines the interface for workflow actions.
type ActionDefinition ¶
type ActionDefinition struct {
// Name is the unique identifier for this action within its integration
Name string `json:"id"`
// DisplayName is the human-readable name of the action
DisplayName string `json:"displayName"`
// Description provides details about the action's purpose
Description string `json:"description"`
// HelpText provides additional guidance for configuring the action
HelpText string `json:"helpText,omitempty"`
// Icon is a URL or base64-encoded image for the action icon
Icon string `json:"icon,omitempty"`
// Type specifies the action type (e.g., ACTION, BRANCH, BOOLEAN)
Type core.ActionType `json:"type"`
// Auth represents the authentication configuration required to perform the action, encapsulated in core.AuthMetadata.
Auth *core.AuthMetadata `json:"auth"`
// Documentation provides comprehensive usage instructions
Documentation string `json:"documentation,omitempty"`
// SampleOutput contains an example of the action's output
SampleOutput core.JSON `json:"sampleOutput,omitempty"`
Properties *smartform.FormSchema `json:"properties"`
// Tags are searchable labels for the action
Tags []string `json:"tags,omitempty"`
// Implementation specifies the action implementation logic or function to be executed.
Implementation Action `json:"-"`
// Settings provides a settings for this action
Settings core.ActionSettings `json:"settings"`
}
ActionDefinition contains metadata about an action.
type ActionError ¶
type ActionError struct {
// Code is a machine-readable error code
Code string `json:"code"`
// Message is a human-readable error message
Message string `json:"message"`
// Retryable indicates if the error is temporary and the action can be retried
Retryable bool `json:"retryable"`
// Details contains additional context for the error
Details map[string]interface{} `json:"details,omitempty"`
}
ActionError represents a specific error that can occur during action execution.
type ActionFactory ¶
type ActionFactory interface {
// CreateAction creates an action instance based on type
CreateAction(actionType core.ActionType, config map[string]interface{}) (Action, error)
// RegisterActionCreator registers a function to create a specific action type
RegisterActionCreator(actionType core.ActionType, creator func(config map[string]interface{}) (Action, error)) error
// ListSupportedActionTypes returns all action types supported by this factory
ListSupportedActionTypes() []core.ActionType
}
ActionFactory creates instances of actions.
type ActionMetadata ¶
type ActionMetadata struct {
// ID is the unique identifier for this action within its integration
ID string `json:"id"`
// DisplayName is the human-readable name of the action
DisplayName string `json:"displayName"`
// Description provides details about the action's purpose
Description string `json:"description"`
// HelpText provides additional guidance for configuring the action
HelpText string `json:"helpText,omitempty"`
// Icon is a URL or base64-encoded image for the action icon
Icon string `json:"icon,omitempty"`
// Type specifies the action type (e.g., ACTION, BRANCH, BOOLEAN)
Type core.ActionType `json:"type"`
// Documentation provides comprehensive usage instructions
Documentation string `json:"documentation,omitempty"`
// SampleOutput contains an example of the action's output
SampleOutput core.JSON `json:"sampleOutput,omitempty"`
// Tags are searchable labels for the action
Tags []string `json:"tags,omitempty"`
// Category provides a categorization for this action
Category string `json:"category,omitempty"`
// Settings returns action-specific settings
Settings core.ActionSettings `json:"settings"`
}
ActionMetadata contains metadata about an action.
type ActionRegistry ¶
type ActionRegistry interface {
// RegisterAction adds an action to the registry
RegisterAction(integrationID string, action Action) error
// UnregisterAction removes an action from the registry
UnregisterAction(integrationID string, actionID string) error
// GetAction retrieves an action by integration ID and action ID
GetAction(integrationID string, actionID string) (Action, error)
// ListActions returns all registered actions
ListActions() map[string][]Action
// ListActionsByType returns actions of a specific type
ListActionsByType(actionType core.ActionType) []Action
// ListActionsByIntegration returns all actions for a specific integration
ListActionsByIntegration(integrationID string) []Action
// ListActionsByCategory returns actions in a specific category
ListActionsByCategory(category string) []Action
// SearchActions searches for actions matching criteria
SearchActions(query string, filters map[string]interface{}) []Action
}
ActionRegistry manages action registration and discovery.
type Auth ¶
type Auth interface {
// Initialize starts an authentication flow
Initialize(ctx context.Context, request AuthRequest) (*AuthResponse, error)
// CompleteOAuth finishes an OAuth flow with a code from the OAuth provider
CompleteOAuth(ctx context.Context, connectionID xid.ID, code string, state string) (*AuthResponse, error)
// Refresh renews an authentication token
Refresh(ctx context.Context, connectionID xid.ID) (*AuthResponse, error)
// Revoke explicitly revokes an authentication connection
Revoke(ctx context.Context, connectionID xid.ID) error
// Validate checks if an authentication connection is valid
Validate(ctx context.Context, connectionID xid.ID) (*AuthResponse, error)
// GetConnection retrieves authentication connection details
GetConnection(ctx context.Context, connectionID xid.ID) (*AuthResponse, error)
// ListConnections retrieves all authentication connections for a project
ListConnections(ctx context.Context, projectID xid.ID) ([]AuthResponse, error)
// GetToken retrieves an OAuth token for use in API calls
GetToken(ctx context.Context, connectionID xid.ID) (*oauth2.Token, error)
// GetAuthContext retrieves the auth context for use in integration operations
GetAuthContext(ctx context.Context, connectionID xid.ID) (*wakcontext.AuthContext, error)
// CreateAuthenticatedClient creates an HTTP client with authentication credentials
CreateAuthenticatedClient(ctx context.Context, connectionID xid.ID) (*http.Client, error)
}
Auth defines the interface for authentication operations.
type AuthConnectionStatus ¶
type AuthConnectionStatus string
AuthConnectionStatus represents the status of an authentication connection.
const ( // AuthStatusPending indicates the authentication flow has been initiated but not completed. AuthStatusPending AuthConnectionStatus = "pending" // AuthStatusActive indicates the authentication is active and usable. AuthStatusActive AuthConnectionStatus = "active" // AuthStatusExpired indicates the authentication has expired and needs renewal. AuthStatusExpired AuthConnectionStatus = "expired" // AuthStatusRevoked indicates the authentication has been explicitly revoked. AuthStatusRevoked AuthConnectionStatus = "revoked" // AuthStatusFailed indicates the authentication attempt failed. AuthStatusFailed AuthConnectionStatus = "failed" )
type AuthRequest ¶
type AuthRequest struct {
// IntegrationID is the identifier for the integration requiring authentication
IntegrationID string `json:"integrationId"`
// ProjectID is the identifier for the project this authentication belongs to
ProjectID xid.ID `json:"projectId"`
// UserID is the identifier for the user initiating the authentication
UserID xid.ID `json:"userId,omitempty"`
// Type specifies the authentication method to use
Type core.AuthType `json:"type"`
// ConnectionName is a user-defined name for this connection
ConnectionName string `json:"connectionName"`
// Credentials contains authentication credentials (for non-OAuth flows)
Credentials map[string]interface{} `json:"credentials,omitempty"`
// Metadata contains additional information about this authentication
Metadata map[string]interface{} `json:"metadata,omitempty"`
// RedirectURL is where to redirect after OAuth authentication
RedirectURL string `json:"redirectUrl,omitempty"`
// Scopes contains the OAuth scopes to request
Scopes []string `json:"scopes,omitempty"`
}
AuthRequest represents a request to initialize an authentication flow.
type AuthResponse ¶
type AuthResponse struct {
// ConnectionID is the unique identifier for this authentication connection
ConnectionID xid.ID `json:"connectionId"`
// Status indicates the current status of this connection
Status AuthConnectionStatus `json:"status"`
// Type indicates the authentication method used
Type core.AuthType `json:"type"`
// ExpiresAt indicates when this authentication expires (if applicable)
ExpiresAt *time.Time `json:"expiresAt,omitempty"`
// Message contains additional information about the authentication result
Message string `json:"message,omitempty"`
// AuthorizationURL is the URL to redirect to for OAuth flows
AuthorizationURL string `json:"authorizationUrl,omitempty"`
// ConnectionDetails contains details about the connection (sanitized for display)
ConnectionDetails map[string]interface{} `json:"connectionDetails,omitempty"`
}
AuthResponse represents the result of an authentication flow.
type DynamicIntegrationLoader ¶
type DynamicIntegrationLoader interface {
// LoadIntegration loads an integration from a file or URL
LoadIntegration(ctx context.Context, source string) (*IntegrationDefinition, error)
// ValidateIntegration checks if an integration package is valid
ValidateIntegration(ctx context.Context, source string) (bool, error)
// GetIntegrationDefinition extracts metadata from an integration package
GetIntegrationDefinition(ctx context.Context, source string) (*IntegrationDefinition, error)
// GetIntegrationMetadata extracts metadata from an integration package
GetIntegrationMetadata(ctx context.Context, source string) (*IntegrationMetadata, error)
// ExtractIntegration extracts and validates integration data from the given path and returns its identifier or an error.
ExtractIntegration(ctx context.Context, path string) (string, error)
// RegisterIntegration loads and registers an integration with the registry
RegisterIntegration(ctx context.Context, source string, registry IntegrationRegistry) error
}
DynamicIntegrationLoader loads integrations from external sources.
type DynamicOptionsFn ¶ added in v0.11.0
type DynamicOptionsFn = func(ctx context.DynamicFieldContext) (*core.DynamicOptionsResponse, error)
type FieldType ¶ added in v0.11.0
type FieldType string
const ( FieldTypeCondition FieldType = "condition" FieldTypeEnhancedCondition FieldType = "enhanced_condition" FieldTypeMap FieldType = "map" FieldTypeKeyValue FieldType = "keyvalue" FieldTypeKeyCode FieldType = "code" FieldTypeKeyIDECode FieldType = "ide_code" FieldTypeBranch FieldType = "branch" FieldTypeRouter FieldType = "router" )
type Integration ¶
type Integration interface {
// Metadata returns metadata about the integration
Metadata() IntegrationMetadata
// Auth returns the authentication requirements for the integration
Auth() *core.AuthMetadata
// Triggers returns all triggers provided by this integration
Triggers() []Trigger
// Actions returns all actions provided by this integration
Actions() []Action
}
Integration defines the interface for integration plugins.
func Register ¶ added in v0.11.0
func Register(integration Integration) Integration
type IntegrationDefinition ¶
type IntegrationDefinition struct {
IntegrationMetadata
ID string `json:"id"`
DisplayName string `json:"displayName"`
Actions map[string]*ActionDefinition `json:"actions"`
Triggers map[string]*TriggerDefinition `json:"triggers"`
Auth *core.AuthMetadata `json:"auth"`
Metadata IntegrationMetadata `json:"metadata"`
BuildMetadata core.IntegrationBuildMetadata `json:"buildMetadata"`
License *string `json:"license"`
Copyright *string `json:"copyright"`
LicenseURL *string `json:"licenseUrl"`
CopyrightURL *string `json:"copyrightUrl"`
Source *string `json:"source"`
Implementation Integration `json:"-"`
}
IntegrationDefinition represents the definition of an integration
type IntegrationMetadata ¶
type IntegrationMetadata struct {
// Name is the human-readable name of the integration
Name string `json:"name" toml:"name" yaml:"name" validate:"required"`
// Description provides details about the integration's purpose
Description string `json:"description" toml:"description" yaml:"description" validate:"required"`
// Type categorizes the integration functionality
Type IntegrationType `json:"type"`
FlowType core.FlowComponentType
// Version is the semantic version of the integration
Version string `json:"version" toml:"version" yaml:"version" validate:"required"`
// Icon is a URL or base64-encoded image for the integration icon
Icon string `json:"icon" toml:"icon" yaml:"icon" validate:"required"`
// Publisher identifies who created the integration
Authors []string `json:"authors" toml:"authors" yaml:"authors" validate:"required"`
// Website is the URL to the integration's documentation or website
Website string `json:"website" toml:"website" yaml:"website"`
// Category provides a more specific categorization
Categories []string `json:"categories" toml:"categories" yaml:"categories" validate:"required"`
// Tags are searchable labels for the integration
Tags []string `json:"tags,omitempty" toml:"tags,omitempty" yaml:"tags,omitempty"`
// ReleaseNotes documents changes in this version
ReleaseNotes string `json:"releaseNotes,omitempty"`
// Documentation provides comprehensive usage instructions
Documentation string `json:"documentation,omitempty"`
}
IntegrationMetadata contains metadata about an integration.
func LoadMetadataFromFlo ¶ added in v0.11.0
func LoadMetadataFromFlo(flo string, readme string) IntegrationMetadata
func ReadFloFile ¶ added in v0.11.0
func ReadFloFile(content string) (*IntegrationMetadata, error)
func (*IntegrationMetadata) LoadFromFlo ¶ added in v0.11.0
func (i *IntegrationMetadata) LoadFromFlo(flo string, readme string)
type IntegrationRegistry ¶
type IntegrationRegistry interface {
// RegisterIntegration adds an integration to the registry
RegisterIntegration(integration Integration) error
// RegisterIntegrationDefinition adds an integration to the registry
RegisterIntegrationDefinition(integration IntegrationDefinition) error
// UnregisterIntegration removes an integration from the registry
UnregisterIntegration(name string, version string) error
// GetIntegration retrieves a specific version of an integration by its name and version from the registry.
GetIntegration(ctx context.Context, name string, version string) (Integration, error)
// GetIntegrationDefinition retrieves a specific version of an integration by its name and version from the registry.
GetIntegrationDefinition(ctx context.Context, name string, version string) (*IntegrationDefinition, error)
// GetLatestIntegration retrieves the latest version of an integration
GetLatestIntegration(ctx context.Context, name string) (*IntegrationDefinition, error)
// ListIntegrations returns all registered integrations
ListIntegrations() []*IntegrationDefinition
// ListIntegrationsByType returns integrations of a specific type
ListIntegrationsByType(integrationType IntegrationType) []*IntegrationDefinition
// ListIntegrationVersions returns all versions of an integration
ListIntegrationVersions(ctx context.Context, name string) ([]*IntegrationDefinition, error)
// GetIntegrationMetadata retrieves metadata for a specific integration given its name and version. It returns the metadata or an error.
GetIntegrationMetadata(ctx context.Context, name string, version string) (*IntegrationMetadata, error)
RegisterActionDefinition(
ctx context.Context,
integrationName string,
version string,
actionID string,
action ActionDefinition,
) error
RegisterTriggerDefinition(
ctx context.Context,
integrationName string,
version string,
triggerID string,
trigger TriggerDefinition,
) error
RegisterAction(
ctx context.Context,
integrationName string,
version string,
actionID string,
action Action,
) error
RegisterTrigger(
ctx context.Context,
integrationName string,
version string,
triggerID string,
trigger Trigger,
) error
// GetAction retrieves an action by integration ID and action ID
GetAction(integrationID, version, actionID string) (*ActionDefinition, error)
LoadIntegrationsFromRegistrar(ctx context.Context, reg IntegrationsRegistrar) error
// GetTrigger retrieves a trigger by integration ID and trigger ID
GetTrigger(integrationID, version, actionID string) (*TriggerDefinition, error)
// ListActions returns all actions for an integration version
ListActions(
ctx context.Context,
integrationName string,
version string,
) (map[string]*ActionDefinition, error)
// ListTriggers returns all triggers for an integration version
ListTriggers(
ctx context.Context,
integrationName string,
version string,
) (map[string]*TriggerDefinition, error)
// ListAllActions returns all registered actions across all integrations
ListAllActions(ctx context.Context) map[string]map[string]map[string]*ActionDefinition
// ListAllTriggers returns all registered triggers across all integrations
ListAllTriggers(ctx context.Context) map[string]map[string]map[string]*TriggerDefinition
// Initialize initializes all registered integrations
Initialize(ctx context.Context) error
// Shutdown performs cleanup for all registered integrations
Shutdown(ctx context.Context) error
}
IntegrationRegistry manages available integrations.
type IntegrationSchemaModel ¶ added in v0.11.0
type IntegrationSchemaModel struct {
Name string `json:"name" toml:"name" yaml:"name" validate:"required"`
Description string `json:"description" toml:"description" yaml:"description" validate:"required"`
Version string `json:"version" toml:"version" yaml:"version" validate:"required"`
Authors []string `json:"authors" toml:"authors" yaml:"authors" validate:"required"`
Website *string `json:"website" toml:"website" yaml:"website"`
Categories []string `json:"categories" toml:"categories" yaml:"categories" validate:"required"`
Icon string `json:"icon" toml:"icon" yaml:"icon" validate:"required"`
}
type IntegrationType ¶
type IntegrationType string
IntegrationType defines the type of integration
const ( // IntegrationTypeStandard represents a standard integration IntegrationTypeStandard IntegrationType = "STANDARD" // IntegrationTypeFlow represents a flow control integration IntegrationTypeFlow IntegrationType = "FLOW" // IntegrationTypeInternal represents an internal system integration IntegrationTypeInternal IntegrationType = "INTERNAL" // IntegrationTypeCustom represents a custom user-defined integration IntegrationTypeCustom IntegrationType = "CUSTOM" )
func (IntegrationType) GormDataType ¶ added in v0.11.0
func (IntegrationType) GormDataType() string
GormDataType defines the data type for GORM.
func (IntegrationType) MarshalJSON ¶ added in v0.11.0
func (i IntegrationType) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface.
func (IntegrationType) MarshalText ¶ added in v0.11.0
func (i IntegrationType) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface
func (*IntegrationType) Scan ¶ added in v0.11.0
func (i *IntegrationType) Scan(value interface{}) error
Scan implements the sql.Scanner interface
func (IntegrationType) String ¶ added in v0.11.0
func (i IntegrationType) String() string
String returns the string representation of IntegrationType
func (*IntegrationType) UnmarshalJSON ¶ added in v0.11.0
func (i *IntegrationType) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler interface.
func (*IntegrationType) UnmarshalText ¶ added in v0.11.0
func (i *IntegrationType) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface
func (IntegrationType) Value ¶ added in v0.11.0
func (i IntegrationType) Value() (driver.Value, error)
Value implements the driver.Valuer interface
func (IntegrationType) Values ¶ added in v0.11.0
func (IntegrationType) Values() []string
Values provides list valid values for Enum
type IntegrationsRegistrar ¶ added in v0.11.0
type IntegrationsRegistrar = map[string]RegistrationMap
type RegistrationMap ¶ added in v0.11.0
type RegistrationMap struct {
Versions map[string]Integration
}
type SchemaConfig ¶ added in v0.11.0
type SchemaConfig struct {
Integration IntegrationMetadata `json:"integration" toml:"integration" yaml:"integration" validate:"required"`
}
type Trigger ¶
type Trigger interface {
// Metadata returns metadata about the trigger
Metadata() TriggerMetadata
// Props returns the schema for the trigger's input configuration
Props() *smartform.FormSchema
// Auth returns the authentication requirements for the trigger
Auth() *core.AuthMetadata
// Start prepares and activates the trigger (e.g., start polling, event listening, cron schedules)
Start(ctx context.LifecycleContext) error
// Stop gracefully stops or disables the trigger
Stop(ctx context.LifecycleContext) error
// Execute handles the trigger's action when manually invoked with an input schema
Execute(ctx context.ExecuteContext) (core.JSON, error)
}
Trigger defines the interface for workflow triggers.
type TriggerDefinition ¶
type TriggerDefinition struct {
// ID is the unique identifier for this trigger within its integration
Name string `json:"name"`
// DisplayName is the human-readable name of the trigger
DisplayName string `json:"displayName"`
// Description provides details about the trigger's purpose
Description string `json:"description"`
// HelpText provides additional guidance for configuring the trigger
HelpText string `json:"helpText,omitempty"`
// Icon is a URL or base64-encoded image for the trigger icon
Icon string `json:"icon,omitempty"`
// Type specifies the trigger type (e.g., POLLING, WEBHOOK)
Type core.TriggerType `json:"type"`
// Auth represents the authentication configuration required to perform the action, encapsulated in core.AuthMetadata.
Auth *core.AuthMetadata `json:"auth"`
// Documentation provides comprehensive usage instructions
Documentation string `json:"documentation,omitempty"`
// SampleOutput contains an example of the trigger's output
SampleOutput core.JSON `json:"sampleOutput,omitempty"`
// Properties defines the schema for additional configuration required for the trigger in the form of a smartform.
Properties *smartform.FormSchema `json:"properties"`
// Implementation specifies the action implementation logic or function to be executed.
Implementation Trigger `json:"-"`
}
TriggerDefinition contains metadata about a trigger.
type TriggerFactory ¶
type TriggerFactory interface {
// CreateTrigger creates a trigger instance based on type
CreateTrigger(triggerType core.TriggerType, config map[string]interface{}) (Trigger, error)
// RegisterTriggerCreator registers a function to create a specific trigger type
RegisterTriggerCreator(triggerType core.TriggerType, creator func(config map[string]interface{}) (Trigger, error)) error
// ListSupportedTriggerTypes returns all trigger types supported by this factory
ListSupportedTriggerTypes() []core.TriggerType
}
TriggerFactory creates instances of triggers.
type TriggerMetadata ¶
type TriggerMetadata struct {
// ID is the unique identifier for this trigger within its integration
ID string `json:"id"`
// DisplayName is the human-readable name of the trigger
DisplayName string `json:"displayName"`
// Description provides details about the trigger's purpose
Description string `json:"description"`
// HelpText provides additional guidance for configuring the trigger
HelpText string `json:"helpText,omitempty"`
// Icon is a URL or base64-encoded image for the trigger icon
Icon string `json:"icon,omitempty"`
// Type specifies the trigger type (e.g., POLLING, WEBHOOK)
Type core.TriggerType `json:"type"`
// Documentation provides comprehensive usage instructions
Documentation string `json:"documentation,omitempty"`
// SampleOutput contains an example of the trigger's output
SampleOutput core.JSON `json:"sampleOutput,omitempty"`
// Criteria returns additional trigger criteria configuration
Criteria *core.TriggerSettings `json:"criteria"`
}
TriggerMetadata contains metadata about a trigger.
type TriggerRegistry ¶
type TriggerRegistry interface {
// RegisterTrigger adds a trigger to the registry
RegisterTrigger(integrationID string, trigger Trigger) error
// UnregisterTrigger removes a trigger from the registry
UnregisterTrigger(integrationID string, triggerID string) error
// GetTrigger retrieves a trigger by integration ID and trigger ID
GetTrigger(integrationID string, triggerID string) (Trigger, error)
// ListTriggers returns all registered triggers
ListTriggers() map[string][]Trigger
// ListTriggersByType returns triggers of a specific type
ListTriggersByType(triggerType core.TriggerType) []Trigger
// ListTriggersByIntegration returns all triggers for a specific integration
ListTriggersByIntegration(integrationID string) []Trigger
}
TriggerRegistry manages trigger registration and discovery.