handlerutil

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentActor

func CurrentActor(ctx context.Context) common.User

func DefaultOperationSecurity

func DefaultOperationSecurity() []map[string][]string

func MapOneAPIResponse

func MapOneAPIResponse[S any, D any](source S, mappingMessage func(error) string) (base.ApiResponse[D], error)

func Operation

func Operation(operationID, method, path, summary, description string, tags ...string) huma.Operation

func PaginationParams

func PaginationParams(start, limit int, sortCol, sortDir, search string) pagination.QueryParams

PaginationParams converts query parameters to pagination.QueryParams. A limit of -1 means "show all items" (no pagination).

func PaginationResponse

func PaginationResponse(p pagination.Response) base.PaginationResponse

PaginationResponse converts the pagination package's response into the API response shape.

func ParseMultipartJSONPart

func ParseMultipartJSONPart[T any](form multipart.Form, partName string) (T, error)

ParseMultipartJSONPart decodes one required JSON-valued multipart field.

func ProxyRemoteJSON

func ProxyRemoteJSON[T any](
	ctx context.Context,
	proxy RemoteJSONProxy,
	environmentID string,
	method string,
	path string,
	requestBody any,
) (*T, error)

ProxyRemoteJSON marshals a request, invokes an environment proxy, and translates transport errors for Huma.

func ReadWorkspaceUploads

func ReadWorkspaceUploads(form multipart.Form, maxFileSizeBytes int64) (map[int][]byte, error)

ReadWorkspaceUploads reads and validates text files from a workspace multipart request.

func RegisterSecured

func RegisterSecured[I, O any](
	api huma.API,
	op huma.Operation,
	permission string,
	handler func(context.Context, *I) (*O, error),
)

func RequireUser

func RequireUser(ctx context.Context) (*common.User, error)

RequireUser returns the authenticated user from the request context or a 401 error.

func SessionMetaFromContext

func SessionMetaFromContext(ctx context.Context, userAgent string) auth.SessionMeta

SessionMetaFromContext builds the session metadata recorded on login.

func TranslateRemoteProxyError

func TranslateRemoteProxyError(err error) error

TranslateRemoteProxyError converts environment transport failures into Huma errors.

func WorkspaceMultipartRequestBody

func WorkspaceMultipartRequestBody(manifestDescription string) *huma.RequestBody

WorkspaceMultipartRequestBody describes the shared workspace multipart schema.

Types

type ActivityAppContext

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

ActivityAppContext carries the app lifecycle context through handler registration.

func NewActivityAppContext

func NewActivityAppContext(ctx context.Context) ActivityAppContext

NewActivityAppContext wraps the app lifecycle context for handler constructors.

func (ActivityAppContext) Context

func (c ActivityAppContext) Context() context.Context

Context returns the wrapped app lifecycle context.

type RemoteJSONProxy

type RemoteJSONProxy func(context.Context, string, string, string, []byte, any) error

RemoteJSONProxy is the remote environment transport operation used by domain handlers.

Jump to

Keyboard shortcuts

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