api

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package api contains commonly used constants and functions for the HTTP endpoints.

Index

Constants

View Source
const (
	MemberKindKey    = "member_kind"
	PermissionKey    = "permission"
	RelationKey      = "relation"
	StatusKey        = "status"
	OffsetKey        = "offset"
	OrderKey         = "order"
	LimitKey         = "limit"
	MetadataKey      = "metadata"
	ParentKey        = "parent_id"
	OwnerKey         = "owner_id"
	ClientKey        = "client"
	UsernameKey      = "username"
	NameKey          = "name"
	GroupKey         = "group"
	ActionKey        = "action"
	ActionsKey       = "actions"
	RoleIDKey        = "role_id"
	RoleNameKey      = "role_name"
	AccessTypeKey    = "access_type"
	TagKey           = "tag"
	FirstNameKey     = "first_name"
	LastNameKey      = "last_name"
	TotalKey         = "total"
	SubjectKey       = "subject"
	ObjectKey        = "object"
	LevelKey         = "level"
	StartLevelKey    = "start_level"
	EndLevelKey      = "end_level"
	TreeKey          = "tree"
	DirKey           = "dir"
	ListPerms        = "list_perms"
	VisibilityKey    = "visibility"
	EmailKey         = "email"
	SharedByKey      = "shared_by"
	TokenKey         = "token"
	UserKey          = "user"
	DomainKey        = "domain"
	ChannelKey       = "channel"
	DefPermission    = "read_permission"
	DefTotal         = uint64(100)
	DefOffset        = 0
	DefOrder         = "updated_at"
	DefDir           = "asc"
	DefLimit         = 10
	DefLevel         = 0
	DefStartLevel    = 1
	DefEndLevel      = 0
	DefStatus        = "enabled"
	DefClientStatus  = clients.Enabled
	DefUserStatus    = users.Enabled
	DefGroupStatus   = groups.Enabled
	DefListPerms     = false
	SharedVisibility = "shared"
	MyVisibility     = "mine"
	AllVisibility    = "all"
	// ContentType represents JSON content type.
	ContentType = "application/json"

	// MaxNameSize limits name size to prevent making them too complex.
	MaxLimitSize = 100
	MaxNameSize  = 1024
	MaxIDSize    = 36
	NameOrder    = "name"
	IDOrder      = "id"
	AscDir       = "asc"
	DescDir      = "desc"
)
View Source
const SessionKey = sessionKeyType("session")

Variables

This section is empty.

Functions

func AuthenticateMiddleware

func AuthenticateMiddleware(authn smqauthn.Authentication, domainCheck bool) func(http.Handler) http.Handler

func EncodeError

func EncodeError(_ context.Context, err error, w http.ResponseWriter)

EncodeError encodes an error response.

func EncodeResponse

func EncodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error

EncodeResponse encodes successful response.

func ValidateUUID

func ValidateUUID(extID string) (err error)

ValidateUUID validates UUID format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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