envelope

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: GPL-3.0 Imports: 8 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	Success        bool               `json:"success"`
	RequestID      string             `json:"request_id"`
	Time           string             `json:"time"`
	Data           any                `json:"data"`
	Error          string             `json:"error,omitempty"`
	Message        string             `json:"message,omitempty"`
	HTTPStatusCode int                `json:"-"`
	Pagination     *params.Pagination `json:"pagination,omitempty"`
}

func GetEnvelopeAndLogger added in v0.0.12

func GetEnvelopeAndLogger(r *http.Request) (*Envelope, logging.Writer, error)

func New

func New() *Envelope

func ReadEnvelope

func ReadEnvelope(r *http.Request) *Envelope

func (*Envelope) Finish

func (e *Envelope) Finish(w http.ResponseWriter, r *http.Request, logger logging.Writer)

func (*Envelope) Render

func (e *Envelope) Render(w http.ResponseWriter, r *http.Request) error

func (*Envelope) SetError

func (e *Envelope) SetError(err apierror.HTTPError) *Envelope

func (*Envelope) SetPagination added in v0.0.8

func (e *Envelope) SetPagination(p params.Pagination) *Envelope

func (*Envelope) SetResponse

func (e *Envelope) SetResponse(resp any) *Envelope

func (*Envelope) SetSuccess

func (e *Envelope) SetSuccess() *Envelope

Jump to

Keyboard shortcuts

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