api

package
v0.0.0-...-aba2752 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotOK       = errors.New("non-OK response")
	ErrExhausted   = status.New(codes.ResourceExhausted, "resource exhausted").Err()
	ErrUnavailable = status.New(codes.Unavailable, "service unavailable").Err()
)
View Source
var NoDepsInit = act.NoDepsInit

Functions

func AsStatus

func AsStatus(code codes.Code, err error, details ...proto.Message) error

AsStatus creates a gRPC status with the given code and error message. Optionally accepts status details to attach to the error.

func HTMLHandler

func HTMLHandler[I act.Input, O any, D act.Deps](initDeps InitDeps[D], handler HandlerFunc[I, O, D], tmpl *template.Template) http.HandlerFunc

func Handler

func Handler[I act.Input, O any, D act.Deps](initDeps InitDeps[D], handler HandlerFunc[I, O, D]) http.HandlerFunc

func RetryAfter

func RetryAfter(after time.Duration) proto.Message

RetryAfter is a convenience function for creating a detail proto for retry information. NOTE: For HTTP, should be limited to use with Unavailable and ResourceExhausted codes.

func Translate

func Translate[O act.Input](t Translator[O], h http.HandlerFunc) http.HandlerFunc

Translate applies a Translator on the Request to populate the Request.URL params.

Types

type HandlerFunc

type HandlerFunc[I act.Input, O any, D act.Deps] func(context.Context, I, D) (*O, error)

func WithTimeout

func WithTimeout[I act.Input, O any, D act.Deps](timeout time.Duration, handler HandlerFunc[I, O, D]) HandlerFunc[I, O, D]

type InitDeps

type InitDeps[D act.Deps] func(context.Context) (D, error)

type NoDeps

type NoDeps = act.NoDeps

Type aliases for convenience

type StubFunc

type StubFunc[I act.Input, O any] func(context.Context, I) (*O, error)

func Stub

func Stub[I act.Input, O any](client httpx.BasicClient, u *url.URL) StubFunc[I, O]

func StubFromHandler

func StubFromHandler[I act.Input, O any, D act.Deps](client httpx.BasicClient, u *url.URL, handler HandlerFunc[I, O, D]) StubFunc[I, O]

type Translator

type Translator[O act.Input] func(*http.Request) (O, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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