automation

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service handles contract automation

func NewService

func NewService(
	cfg *config.Config,
	log *logger.Logger,
	triggerRepository models.TriggerRepository,
	functionService *functions.Service,
	blockchainClient *blockchain.Client,
) *Service

NewService creates a new automation service

func (*Service) CreateTrigger

func (s *Service) CreateTrigger(
	userID int,
	functionID int,
	name, description string,
	triggerType models.TriggerType,
	triggerConfig json.RawMessage,
) (*models.Trigger, error)

CreateTrigger creates a new trigger

func (*Service) DeleteTrigger

func (s *Service) DeleteTrigger(id, userID int) error

DeleteTrigger deletes a trigger

func (*Service) ExecuteTrigger

func (s *Service) ExecuteTrigger(ctx context.Context, id, userID int) (*models.TriggerEvent, error)

ExecuteTrigger manually executes a trigger

func (*Service) GetTrigger

func (s *Service) GetTrigger(id, userID int) (*models.Trigger, error)

GetTrigger gets a trigger by ID

func (*Service) GetTriggerHistory

func (s *Service) GetTriggerHistory(triggerID, userID int, page, limit int) ([]*models.TriggerEvent, error)

GetTriggerHistory gets the execution history for a trigger

func (*Service) ListTriggers

func (s *Service) ListTriggers(userID int, page, limit int) ([]*models.Trigger, error)

ListTriggers lists triggers for a user

func (*Service) Start

func (s *Service) Start() error

Start starts the automation service

func (*Service) Stop

func (s *Service) Stop()

Stop stops the automation service

func (*Service) UpdateTrigger

func (s *Service) UpdateTrigger(
	id, userID int,
	functionID int,
	name, description string,
	triggerType models.TriggerType,
	triggerConfig json.RawMessage,
) (*models.Trigger, error)

UpdateTrigger updates an existing trigger

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL