approval

package
v0.2.40 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TopicRequestCreated  = "request.created"
	TopicRequestUpdated  = "request.updated"
	TopicRequestExpired  = "request.expired"
	TopicDecisionCreated = "decision.created"

	LegacyTopicRequestNew  = "request.new"
	LegacyTopicDecisionNew = "decision.new"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Decision

type Decision struct {
	ID        string    `json:"id"`
	Approved  bool      `json:"approved"`
	Reason    string    `json:"reason,omitempty"`
	DecidedAt time.Time `json:"decidedAt"`
}

type Event

type Event struct {
	Topic   string
	Data    interface{}
	Headers map[string]string `json:"headers,omitempty"`
}

type Message

type Message[T any] interface {
	T() *T
	Ack() error
	Nack(error) error
}

type Queue

type Queue[T any] interface {
	Publish(ctx context.Context, t *T) error
	Consume(ctx context.Context) (Message[T], error)
}

type Request

type Request struct {
	ID          string                 `json:"id"`
	ProcessID   string                 `json:"processId"`
	ExecutionID string                 `json:"executionId"`
	Action      string                 `json:"action"`
	Args        json.RawMessage        `json:"args,omitempty"`
	CreatedAt   time.Time              `json:"createdAt"`
	ExpiresAt   *time.Time             `json:"expiresAt,omitempty"`
	Meta        map[string]interface{} `json:"meta,omitempty"`
}

type Service

type Service interface {
	RequestApproval(ctx context.Context, r *Request) error
	ListPending(ctx context.Context) ([]*Request, error)
	Decide(ctx context.Context, id string, approved bool, reason string) (*Decision, error)
	Queue() Queue[Event]
}

Service defines the approval service interface (minimal subset used by agently).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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