Documentation ¶
Index ¶
- Constants
- func LoadIndexJson(r io.Reader, i *Index) error
- func LoadIndexYaml(r io.Reader, i *Index) error
- func LoadPhotoJson(r io.Reader, p *Photo) error
- func LoadPhotoYaml(r io.Reader, p *Photo) error
- func LoadVerseJson(r io.Reader, v *Verse) error
- func LoadVerseYaml(r io.Reader, v *Verse) error
- type Client
- func (c *Client) Today(ctx context.Context, opts ...DayOption) (string, error)
- func (c *Client) TodayHTML(ctx context.Context, opts ...DayOption) (template.HTML, error)
- func (c *Client) TodayPhoto(ctx context.Context, opts ...DayOption) (*Photo, error)
- func (c *Client) TodayVerse(ctx context.Context, opts ...DayOption) (*Verse, error)
- func (c *Client) VerseIndex(ctx context.Context, opts ...IndexOption) (*Index, error)
- type DayOption
- type Index
- type IndexEntry
- type IndexOption
- type Metadata
- type Photo
- type Verse
Constants ¶
const DefaultBaseURL = `https://openscripture.today`
DefaultBaseURL is the default base URL for the openscripture.today API.
Variables ¶
This section is empty.
Functions ¶
func LoadIndexJson ¶ added in v0.6.0
LoadIndexJson loads a scripture index file in JSON format.
func LoadIndexYaml ¶ added in v0.6.0
LoadIndexYaml loads a scripture index file in YAML format.
func LoadPhotoJson ¶ added in v0.6.0
LoadPhotoJson loads a photo descriptior file in JSON format.
func LoadPhotoYaml ¶ added in v0.6.0
LoadPhotoYaml loads a photo descriptor file in YAML format.
func LoadVerseJson ¶ added in v0.6.0
LoadVerseJson loads a verse reference file in JSON format.
Types ¶
type Client ¶
type Client struct { Client *http.Client TextService *text.Service PhotoService *photo.Service BaseURL string }
Client is a client for the openscripture.today API.
func New ¶
New creates a new openscripture.today API client. The context is used only to help load related client objects from the local environment and is not stored.
func (*Client) Today ¶
Today returns the text of the verse for the current day. If no time is provided via the ost.On option, the current day is used.
func (*Client) TodayHTML ¶
TodayHTML returns the HTML of the verse for the current day. If no time is provided via the ost.On option, the current day is used.
func (*Client) TodayPhoto ¶ added in v0.3.0
TodayPhoto returns the photo for the current day. If no time is provided via the ost.On option, the current day is used.
func (*Client) TodayVerse ¶
TodayVerse returns the entire verse object for a given day. If no time is provided via the ost.On option, the current day is used.
func (*Client) VerseIndex ¶ added in v0.6.0
VerseIndex returns an index for some segment of verses. Use one of the ost.IndexOption options to select the period of verses to index.
type DayOption ¶ added in v0.6.0
type DayOption func(*dayOptions)
DayOption is a functional option for the openscripture.today API client.
type Index ¶ added in v0.6.0
type Index struct { Metadata Metadata `yaml:"metadata" json:"metadata"` Description string `yaml:"description" json:"description"` Verses map[string]IndexEntry `yaml:"verses" json:"verses"` }
Index describes a scripture index on openscripture.net.
type IndexEntry ¶ added in v0.6.0
type IndexEntry struct {
Reference string `yaml:"reference" json:"reference"`
}
IndexEntry describes an entry in the scripture index of openscripture.net.
type IndexOption ¶ added in v0.6.0
type IndexOption func(*indexOptions)
IndexOption is a functional option for the openscripture.today API client.
func ForAllTime ¶ added in v0.6.0
func ForAllTime() IndexOption
ForAllTime is the option that selects all verses for all time. This is the default.
func ForMonth ¶ added in v0.6.0
func ForMonth(year, month string) IndexOption
ForMonth is the option that selects all verses for a given month.
func ForYear ¶ added in v0.6.0
func ForYear(year string) IndexOption
ForYear is the option that selects all verses for a given year.
type Metadata ¶ added in v0.6.0
type Metadata struct { Version int `yaml:"version" json:"version"` OriginalVersion int `yaml:"original_version" json:"original_version"` Pruned bool `yaml:"pruned,omitempty" json:"pruned,omitempty"` }
Metadata describes general information about the documents published in the openscripture.net API.
type Photo ¶ added in v0.6.0
type Photo struct { Metadata Metadata `yaml:"metadata" json:"metadata"` photo.Descriptor `yaml:",inline" json:",inline"` }
Photo describes the photos paired with scripture on openscripture.net.