schedule

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Pattern     string      `json:"pattern"`
	MaxCalls    NullableInt `json:"max_calls,omitempty"`
	Command     string      `json:"command"`
	Enabled     *bool       `json:"enabled,omitempty"`
}

type ListResponse

type ListResponse struct {
	Items []Schedule `json:"items"`
}

type NullableInt

type NullableInt struct {
	Value *int
	Set   bool
}

func (NullableInt) IsZero

func (n NullableInt) IsZero() bool

func (NullableInt) MarshalJSON

func (n NullableInt) MarshalJSON() ([]byte, error)

func (*NullableInt) UnmarshalJSON

func (n *NullableInt) UnmarshalJSON(data []byte) error

type Schedule

type Schedule struct {
	ID           string    `json:"id"`
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	Pattern      string    `json:"pattern"`
	MaxCalls     *int      `json:"max_calls,omitempty"`
	CurrentCalls int       `json:"current_calls"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
	Enabled      bool      `json:"enabled"`
	Command      string    `json:"command"`
	BotID        string    `json:"bot_id"`
}

type Service

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

func NewService

func NewService(log *slog.Logger, queries *sqlc.Queries, triggerer Triggerer, runtimeConfig *boot.RuntimeConfig) *Service

func (*Service) Bootstrap

func (s *Service) Bootstrap(ctx context.Context) error

func (*Service) Create

func (s *Service) Create(ctx context.Context, botID string, req CreateRequest) (Schedule, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (Schedule, error)

func (*Service) List

func (s *Service) List(ctx context.Context, botID string) ([]Schedule, error)

func (*Service) Trigger

func (s *Service) Trigger(ctx context.Context, scheduleID string) error

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, req UpdateRequest) (Schedule, error)

type TriggerPayload

type TriggerPayload struct {
	ID          string
	Name        string
	Description string
	Pattern     string
	MaxCalls    *int
	Command     string
	OwnerUserID string
}

TriggerPayload describes the parameters passed to the chat side when a schedule triggers.

type Triggerer

type Triggerer interface {
	TriggerSchedule(ctx context.Context, botID string, payload TriggerPayload, token string) error
}

Triggerer triggers schedule execution for chat-related jobs.

type UpdateRequest

type UpdateRequest struct {
	Name        *string     `json:"name,omitempty"`
	Description *string     `json:"description,omitempty"`
	Pattern     *string     `json:"pattern,omitempty"`
	MaxCalls    NullableInt `json:"max_calls,omitempty"`
	Command     *string     `json:"command,omitempty"`
	Enabled     *bool       `json:"enabled,omitempty"`
}

Jump to

Keyboard shortcuts

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