Versions in this module Expand all Collapse all v4 v4.0.0 Jul 11, 2026 Changes in this version + var ErrInvalidState = errors.New("invalid operation state") + var ErrInvalidTransition = errors.New("invalid operation transition") + func CanTransition(from, to State) bool + func IsTerminal(state State) bool + func PollHandler[T any](config PollConfig[T]) http.Handler + func ValidateState(state State) error + func WriteAccepted(w http.ResponseWriter, config AcceptedConfig) + func WriteOperation[T any](w http.ResponseWriter, status int, operation Operation[T]) + type Accepted struct + ID string + Location string + State State + type AcceptedConfig struct + ID string + Location string + RetryAfter time.Duration + type Operation struct + ID string + Problem *httpx.Problem + Result *T + State State + func TransitionOperation[T any](operation Operation[T], config TransitionConfig[T]) (Operation[T], error) + type PollConfig struct + ErrorWriter func(http.ResponseWriter, int, httpx.Problem) + OperationID func(*http.Request) string + Store Store[T] + type Repository interface + type State string + const StateCanceled + const StateFailed + const StatePending + const StateRunning + const StateSucceeded + type Store interface + GetOperation func(ctx context.Context, id string) (Operation[T], bool, error) + type StoreFunc func(context.Context, string) (Operation[T], bool, error) + func (f StoreFunc[T]) GetOperation(ctx context.Context, id string) (Operation[T], bool, error) + type TransitionConfig struct + Problem *httpx.Problem + Result *T + To State + type Writer interface + CreateOperation func(ctx context.Context, operation Operation[T]) error + UpdateOperation func(ctx context.Context, operation Operation[T]) error + type WriterFuncs struct + Create func(context.Context, Operation[T]) error + Update func(context.Context, Operation[T]) error + func (f WriterFuncs[T]) CreateOperation(ctx context.Context, operation Operation[T]) error + func (f WriterFuncs[T]) UpdateOperation(ctx context.Context, operation Operation[T]) error Other modules containing this package github.com/aatuh/api-toolkit/v2 github.com/aatuh/api-toolkit/v3