tri

package module
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: BSD-2-Clause Imports: 7 Imported by: 2

README

tri

Trinity message service interfaces.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidReference = errors.New("invalid reference")
)

Functions

func IsValidContent

func IsValidContent(content []Paragraph) bool

func IsValidReferenceString

func IsValidReferenceString(s string) bool

func Version added in v0.6.2

func Version() string

Types

type Message

type Message struct {
	ID string `json:"id"`
	// Timestamp is the unix millisecond timestamp of sending
	Timestamp int64       `json:"timestamp"`
	SenderID  string      `json:"sender_id"`
	Content   []Paragraph `json:"content"`
}

func NewMessage

func NewMessage(senderID string, content []Paragraph) (m Message)

NewMessage uses a new UUID as ID and the timestamp of now as Timestamp

func (*Message) Plaintext

func (m *Message) Plaintext() string

type Name

type Name struct {
	DisplayName       string `json:"display_name"`
	UserPrincipalName string `json:"user_principal_name"`
}

type Neko

type Neko struct {
	ID   string `json:"id"`
	Name Name   `json:"name"`
}

type Paragraph

type Paragraph struct {
	Type ParagraphType `json:"type"`
	Data string        `json:"data"`
}

func ParagraphFile added in v0.6.1

func ParagraphFile(rs string) Paragraph

func ParagraphText added in v0.6.1

func ParagraphText(text string) Paragraph

func (*Paragraph) IsValid

func (p *Paragraph) IsValid() bool

type ParagraphType

type ParagraphType uint8
const (
	ParagraphTypeText ParagraphType = iota + 1
	ParagraphTypeFile
)

func (ParagraphType) String

func (pt ParagraphType) String() string

type Reference

type Reference struct {
	Name string `json:"name"`
	ID   string `json:"id"`
}

func (*Reference) IsValid

func (ref *Reference) IsValid() bool

func (*Reference) MarshalString

func (ref *Reference) MarshalString() (s string, err error)

func (*Reference) String

func (ref *Reference) String() (s string)

func (*Reference) UnmarshalString

func (ref *Reference) UnmarshalString(s string) (err error)

Jump to

Keyboard shortcuts

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