ost

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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

func LoadIndexJson(r io.Reader, i *Index) error

LoadIndexJson loads a scripture index file in JSON format.

func LoadIndexYaml added in v0.6.0

func LoadIndexYaml(r io.Reader, i *Index) error

LoadIndexYaml loads a scripture index file in YAML format.

func LoadPhotoJson added in v0.6.0

func LoadPhotoJson(r io.Reader, p *Photo) error

LoadPhotoJson loads a photo descriptior file in JSON format.

func LoadPhotoYaml added in v0.6.0

func LoadPhotoYaml(r io.Reader, p *Photo) error

LoadPhotoYaml loads a photo descriptor file in YAML format.

func LoadVerseJson added in v0.6.0

func LoadVerseJson(r io.Reader, v *Verse) error

LoadVerseJson loads a verse reference file in JSON format.

func LoadVerseYaml added in v0.6.0

func LoadVerseYaml(r io.Reader, v *Verse) error

LoadVerseYaml loads a verse reference file in YAML 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

func New(ctx context.Context) (*Client, error)

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

func (c *Client) Today(ctx context.Context, opts ...DayOption) (string, error)

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

func (c *Client) TodayHTML(ctx context.Context, opts ...DayOption) (template.HTML, error)

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

func (c *Client) TodayPhoto(ctx context.Context, opts ...DayOption) (*Photo, error)

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

func (c *Client) TodayVerse(ctx context.Context, opts ...DayOption) (*Verse, error)

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

func (c *Client) VerseIndex(ctx context.Context, opts ...IndexOption) (*Index, error)

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.

func On added in v0.2.0

func On(t time.Time) DayOption

On sets the time to use for the request. Only the date part of the time is used.

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.

type Verse

type Verse struct {
	Metadata   Metadata `yaml:"metadata" json:"metadata"`
	text.Verse `yaml:",inline" json:",inline"`
}

Verse describes the verses paired with scripture on openscripture.net.

Jump to

Keyboard shortcuts

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