Added API (preliminary, mostly for decoupling and separation of concerns) Chats are *mostly* implemented as far as metadata goes. Datastore confusion persists.
72 lines
1.7 KiB
Go
72 lines
1.7 KiB
Go
package api
|
|
|
|
import (
|
|
"go.destrealm.net/vfs"
|
|
)
|
|
|
|
type BaseVerse interface {
|
|
// FullReference returns the full verse reference for the current verse
|
|
// (e.g. Matthew 5:20).
|
|
FullReference() string
|
|
|
|
// IncludeVerseNum enables or disables the display of verse numbers.
|
|
IncludeVerseNum(bool)
|
|
|
|
// SetFormatter sets the formatter to use for this verse. Any struct will
|
|
// work as long as it implements VerseFormatter.
|
|
SetFormatter(VerseFormatter)
|
|
|
|
// ShortRef returns a shortened (and standardized) reference for the current
|
|
// verse (e.g. "mat 5:20"). Truncated book names are always lowercase.
|
|
ShortRef() string
|
|
|
|
// SkipLineBreaks enables or disables skipping linebreaks.
|
|
SkipLineBreaks(bool)
|
|
|
|
// Returns the verse as a string.
|
|
String() string
|
|
|
|
// UseMarkdown enables or disables the use of Markdown to format verse
|
|
// output. Not all formatters may support Markdown.
|
|
UseMarkdown(bool)
|
|
}
|
|
|
|
type VerseFormatter interface {
|
|
Format(string) string
|
|
}
|
|
|
|
type Verse interface {
|
|
BaseVerse
|
|
}
|
|
|
|
type VerseReader interface {
|
|
// AddSource includes additional sources for random verse lookup.
|
|
// System-level sources are always included.
|
|
AddSource(vfs.VFS)
|
|
|
|
// Read a verse or verses from the designated translation. In most
|
|
// implementations, this is a pass-through to the underlying translation
|
|
// reader.
|
|
Read(ref string) VerseSet
|
|
|
|
// SetRotationSource sets the writeable location for verse rotation.
|
|
SetRotationSource(vfs.VFS)
|
|
|
|
// SetTranslation configures the default translation to use.
|
|
SetTranslation(Translation)
|
|
}
|
|
|
|
type VerseSet interface {
|
|
BaseVerse
|
|
|
|
// Set returns the boundary set for the current verses.
|
|
Set() VerseBounds
|
|
|
|
// Verses returns a list of verses in this set.
|
|
Verses() []Verse
|
|
}
|
|
|
|
type VerseBounds interface {
|
|
First() int
|
|
Last() int
|
|
}
|