Documentation ¶
Index ¶
Constants ¶
const (
// LeesahTimeformat is Python's time format for Leesah messages, which is a form of RFC3339
LeesahTimeformat = "2006-01-02T15:04:05.999999"
)
Variables ¶
This section is empty.
Functions ¶
func NewLocalRapid ¶
NewLocalRapid creates a new Rapid instance with a local configuration. The local configuration is read from "leesah-certs.yaml". It is used when playing the local edition of Leesah. You can override the path to the local certification by setting the environment variable QUIZ_CERTS. You can also override the topic by setting the environment variable QUIZ_TOPIC, or else the first topic in the file will be used.
func NewRapid ¶
func NewRapid(teamName string, config RapidConfig) (*rapid, error)
NewRapid creates a new Rapid instance with the given configuration. It is used when playing the Nais-edition of Leesah.
Types ¶
type Message ¶
type Message struct { Answer string `json:"svar"` Category string `json:"kategori"` Created string `json:"@opprettet"` AnswerID string `json:"svarId"` Question string `json:"spørsmål,omitempty"` QuestionID string `json:"spørsmålId"` AnswerFormat string `json:"svarformat,omitempty"` TeamName string `json:"lagnavn"` Type MessageType `json:"@event_name"` Documentation string `json:"dokumentasjon"` }
Message is a struct that represents a message in the Leesah Kafka topic
func (Message) ToQuestion ¶
ToQuestion converts a Message to a simpler Question model
type MessageType ¶
type MessageType string
MessageType is an enum for the type of message in the Leesah Kafka topic
const ( MessageTypeQuestion MessageType = "SPØRSMÅL" MessageTypeAnswer = "SVAR" )
type Question ¶
type Question struct { ID string Category string Question string AnswerFormat string Documentation string }
Question is a simplified version of a Message with just the category, question, and answer format
type RapidConfig ¶
type RapidConfig struct { Broker string CAPath string CertPath string GroupID string IgnoredCategories []string KafkaDir string Log *slog.Logger PrivateKeyPath string Topic string }
RapidConfig is a struct that represents the configuration for a Rapid instance This is used when creating a new Rapid instance on the NAIS platform