request

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_TTL_VALUE = 2147483648 // see https://datatracker.ietf.org/doc/html/rfc8030#section-5.2
)

Variables

This section is empty.

Functions

func ParseBody

func ParseBody(req *http.Request, iface any) (err error)

func ParseSubscriptionRequest

func ParseSubscriptionRequest(req *http.Request) (sub *models.PushSubscription, err error)

Types

type WebPushDetails

type WebPushDetails struct {
	ClientId    string `json:"client" schema:"client" validate:"required"`
	RecipientId string `json:"id,omitempty" schema:"id"`

	*WithWebPushParams
}

func (*WebPushDetails) Validate

func (w *WebPushDetails) Validate() (err error)

type WebPushRequest

type WebPushRequest struct {
	Endpoint string `validate:"http_url"`
	Payload  []byte `validate:"required,lte=4096"`

	*WithWebPushParams
	*WithSalt
	*WithPublicKey
}

func (*WebPushRequest) Send

func (r *WebPushRequest) Send() (res *http.Response, err error)

func (*WebPushRequest) String

func (r *WebPushRequest) String() string

func (*WebPushRequest) Validate

func (r *WebPushRequest) Validate() error

type WithPublicKey

type WithPublicKey struct {
	*ecdh.PublicKey `json:"publicKey" validate:"required"`
}

func (*WithPublicKey) String

func (w *WithPublicKey) String() string

type WithSalt

type WithSalt struct {
	Salt []byte `json:"salt" validate:"required,len=16"`
}

func (*WithSalt) String

func (s *WithSalt) String() string

type WithWebPushParams

type WithWebPushParams struct {
	Topic   string `json:"topic,omitempty" schema:"topic"`
	TTL     int64  `json:"ttl" schema:"ttl" validate:"gte=0"`
	Urgency string `json:"urgency,omitempty" schema:"urgency" validate:"omitempty,oneof=very-low low normal high"` // see https://datatracker.ietf.org/doc/html/rfc8030#section-5.3
}

Jump to

Keyboard shortcuts

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