models

package
v2.4.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidSessionConfig

func IsValidSessionConfig(
	webhookID *string,
	webhookURL *string,
	metadata map[string]*string,
) (valid bool, invalidReason string)

IsValidSessionConfig - check validty of session config parameters

func IsValidSessionID

func IsValidSessionID(id string) bool

IsValidSessionID - check validity of a given session ID

func IsValidSessionKey

func IsValidSessionKey(key string) bool

IsValidSessionKey - check validity of a given session key

func MarkEventSeen

func MarkEventSeen(
	st store.Store, sessionID, eventID string,
) (updated bool, err error)

MarkEventSeen - mark the event as seen

Types

type Event

type Event struct {
	ID    string `json:"id"`
	Event string `json:"event"`
	Data  string `json:"data"`
}

Event - event published by a host or guest

func LoadEvent

func LoadEvent(
	st store.Store,
	sessionID string,
	eventID string,
) (*Event, error)

LoadEvent - load an event from the store. if an event with a given ID is not found in the store, (nil, nil) is returned

func LoadEventsForSession

func LoadEventsForSession(
	st store.Store, since int64, unseen bool, sessionID string,
) ([]Event, error)

LoadEventsForSession - load all events from the store for the session with the given ID. If unseen is true, only return events that have not been seen

func (*Event) Save

func (e *Event) Save(st store.Store, sessionID string) error

Save - save event in the store

type Session

type Session struct {
	ID         string            `json:"id"`
	Key        string            `json:"key"`
	Linked     bool              `json:"linked"`
	WebhookID  string            `json:"webhookId,omitempty"`
	WebhookURL string            `json:"webhookUrl,omitempty"`
	Metadata   map[string]string `json:"metadata,omitempty"`
}

Session - rpc session

func LoadSession

func LoadSession(st store.Store, sessionID string) (*Session, error)

LoadSession - load a session from the store. if a session with a given ID is not found in the store, (nil, nil) is returned

func (*Session) Save

func (s *Session) Save(st store.Store) error

Save - save session in the store

Jump to

Keyboard shortcuts

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