rest

package
v0.0.0-...-1a3a2fa Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: BSD-3-Clause Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPerPage = 20
View Source
const (
	PrefsMaxBytes = 8192 // 8k
)

Variables

View Source
var (
	ErrNoCall          = errors.New("no call specified")
	ErrMustBePlaintext = errors.New("content type must be text/plain")
	ErrMustBeJSON      = errors.New("content type must be application/json")
)
View Source
var (
	ErrMissingTGSys = errors.New("missing talkgroup ID and system ID")
	ErrTGIDMismatch = errors.New("url talkgroup ID and document talkgroup ID mismatch")
	ErrSysMismatch  = errors.New("url system ID and document system ID mismatch")
	ErrNoSuchSystem = tgstore.ErrNoSuchSystem
	ErrBadSystem    = errors.New("invalid system")
)
View Source
var (
	ErrBadAppName = errors.New("bad app name")
)
View Source
var (
	ErrBadShare = errors.New("bad share request type")
)

Functions

func New

func New(baseURL url.URL, nex nexus.Nexus, auth authn.Authn, push push.PushNotifier) *api

func NewProgressSender

func NewProgressSender[T any](w http.ResponseWriter, r *http.Request) (*progressSender[T], bool)

NewProgressSender creates and starts a progressSender. The bool return is whether the connection accepts SSE.

func ShareFrom

func ShareFrom(ctx context.Context) *shares.Share

Types

type API

type API interface {
	Subrouter() http.Handler
}

type APIRoot

type APIRoot interface {
	API
	ShareRouter() http.Handler
}

type CallIncidentParams

type CallIncidentParams struct {
	Add   jsontypes.UUIDs `json:"add"`
	Notes json.RawMessage `json:"notes"`

	Remove jsontypes.UUIDs `json:"remove"`
}

type EntityFunc

type EntityFunc func(ctx context.Context, id ID) (SharedItem, error)

type FilterPagination

type FilterPagination struct {
	tgstore.Pagination

	Filter *string `json:"filter"`
}

type ID

type ID any

type ShareHandlerFunc

type ShareHandlerFunc func(id ID, w http.ResponseWriter, r *http.Request)

type ShareHandlers

type ShareHandlers map[ShareRequestType]ShareHandlerFunc

type ShareRequestType

type ShareRequestType string
const (
	ShareRequestCall          ShareRequestType = "call"
	ShareRequestCallInfo      ShareRequestType = "callinfo"
	ShareRequestCallDL        ShareRequestType = "callDL"
	ShareRequestIncident      ShareRequestType = "incident"
	ShareRequestIncidentM3U   ShareRequestType = "m3u"
	ShareRequestIncidentCalls ShareRequestType = "calls"
	ShareRequestTalkgroups    ShareRequestType = "talkgroups"
)

func (ShareRequestType) IsValid

func (rt ShareRequestType) IsValid() bool

type SharedItem

type SharedItem interface {
	SetShareURL(baseURL url.URL, shareID string)
}

Jump to

Keyboard shortcuts

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