rest

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 5 Imported by: 1

README

flam-envelope

flam-envelope is a flam-in-go extension to provide data envelope structures

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope struct {
	Status     EnvelopeStatus `json:"status,omitempty"`
	Data       any            `json:"data,omitempty"`
	Pagination any            `json:"pagination,omitempty"`
}

func NewEnvelope

func NewEnvelope(
	data ...any,
) Envelope

func (Envelope) WithEndpointId

func (envelope Envelope) WithEndpointId(
	val int,
) Envelope

func (Envelope) WithError

func (envelope Envelope) WithError(
	e EnvelopeError,
) Envelope

func (Envelope) WithNewEnvelopePagination

func (envelope Envelope) WithNewEnvelopePagination(
	search string,
	start,
	count,
	total int64,
) Envelope

func (Envelope) WithNewError

func (envelope Envelope) WithNewError(
	status int,
	e error,
	ctx ...flam.Bag,
) Envelope

func (Envelope) WithPagination

func (envelope Envelope) WithPagination(
	pagination any,
) Envelope

func (Envelope) WithServiceId

func (envelope Envelope) WithServiceId(
	val int,
) Envelope

type EnvelopeError

type EnvelopeError struct {
	Status  int      `json:"status"`
	Id      string   `json:"id"`
	Context flam.Bag `json:"context"`
	// contains filtered or unexported fields
}

func NewEnvelopeError

func NewEnvelopeError(
	status int,
	e error,
	ctx ...flam.Bag,
) EnvelopeError

func (EnvelopeError) WithContext

func (envelopeError EnvelopeError) WithContext(
	key string,
	value any,
) EnvelopeError

func (EnvelopeError) WithEndpointId

func (envelopeError EnvelopeError) WithEndpointId(
	val int,
) EnvelopeError

func (EnvelopeError) WithErrorId

func (envelopeError EnvelopeError) WithErrorId(
	id any,
) EnvelopeError

func (EnvelopeError) WithParamId

func (envelopeError EnvelopeError) WithParamId(
	param int,
) EnvelopeError

func (EnvelopeError) WithServiceId

func (envelopeError EnvelopeError) WithServiceId(
	val int,
) EnvelopeError

func (EnvelopeError) WithStatus

func (envelopeError EnvelopeError) WithStatus(
	val int,
) EnvelopeError

type EnvelopePagination

type EnvelopePagination struct {
	Search string `json:"search,omitempty"`
	Start  int64  `json:"start"`
	Count  int64  `json:"count"`
	Total  int64  `json:"total"`
	Prev   string `json:"prev,omitempty"`
	Next   string `json:"next,omitempty"`
}

func NewEnvelopePagination

func NewEnvelopePagination(
	search string,
	start,
	count,
	total int64,
) EnvelopePagination

type EnvelopeStatus

type EnvelopeStatus struct {
	Status  int             `json:"status"`
	Success bool            `json:"success"`
	Errors  []EnvelopeError `json:"error"`
}

type ProblemEnvelope

type ProblemEnvelope struct {
	flam.Bag
}

func NewProblemEnvelope

func NewProblemEnvelope(
	status int,
	typeURI,
	title,
	details,
	instance string,
	ctx ...flam.Bag,
) ProblemEnvelope

func NewProblemEnvelopeFrom

func NewProblemEnvelopeFrom(
	envelope Envelope,
) ProblemEnvelope

func (ProblemEnvelope) Get

func (problem ProblemEnvelope) Get(
	key string,
) any

func (ProblemEnvelope) GetDetail

func (problem ProblemEnvelope) GetDetail() string

func (ProblemEnvelope) GetId

func (problem ProblemEnvelope) GetId() string

func (ProblemEnvelope) GetInstance

func (problem ProblemEnvelope) GetInstance() string

func (ProblemEnvelope) GetStatus

func (problem ProblemEnvelope) GetStatus() int

func (ProblemEnvelope) GetTitle

func (problem ProblemEnvelope) GetTitle() string

func (ProblemEnvelope) GetType

func (problem ProblemEnvelope) GetType() string

func (ProblemEnvelope) With

func (problem ProblemEnvelope) With(
	key string,
	value any,
) ProblemEnvelope

Jump to

Keyboard shortcuts

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