Documentation
¶
Index ¶
- Variables
- type BilingualString
- type CalendarGetOptions
- type CalendarService
- type Client
- type ClientOption
- type DictionaryEntry
- type Haftorah
- type Index
- type IndexService
- type IndexShapeOptions
- type LearningSchedule
- type LexiconCompletionsOptions
- type LexiconGetOptions
- type LexiconService
- type Links
- type Manuscript
- type Parsha
- type ParshaReading
- type RandomTextOptions
- type RelatedContent
- type RelatedLinksOptions
- type RelatedService
- type RequestOption
- type ScheduledLearning
- type Shape
- type Term
- type TermCompletion
- type TermCompletions
- type TermNameOptions
- type TermService
- type TermTitle
- type Text
- type TextFormat
- type TextOptions
- type TextService
- func (s *TextService) Get(ctx context.Context, tref string, opts *TextOptions) (*Text, error)
- func (s *TextService) Languages(ctx context.Context) ([]string, error)
- func (s *TextService) Manuscripts(ctx context.Context, tref string) ([]Manuscript, error)
- func (s *TextService) Random(ctx context.Context, opts *RandomTextOptions) (*Text, error)
- func (s *TextService) Translations(ctx context.Context, lang string) ([]Translation, error)
- func (s *TextService) Versions(ctx context.Context, index string) ([]Version, error)
- type TextVersion
- type Topic
- type TopicService
- func (s *TopicService) All(ctx context.Context, limit int) ([]Topic, error)
- func (s *TopicService) Get(ctx context.Context, topic string) (*Topic, error)
- func (s *TopicService) Graph(ctx context.Context, topic string, linkType string) ([]Topic, error)
- func (s *TopicService) Random(ctx context.Context) ([]Topic, error)
- func (s *TopicService) Recommended(ctx context.Context, refs ...string) ([]Topic, error)
- type Translation
- type Version
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyTerm = fmt.Errorf("term cannot be empty")
View Source
var ErrInvalidParsha = errors.New("invalid parsha")
View Source
var Parshiot = []string{
"Bereshit",
"Noach",
"Lech-Lecha",
"Vayera",
"Chayei Sara",
"Toldot",
"Vayetzei",
"Vayishlach",
"Vayeshev",
"Miketz",
"Vayigash",
"Vayechi",
"Shemot",
"Vaera",
"Bo",
"Beshalach",
"Yitro",
"Mishpatim",
"Terumah",
"Tetzaveh",
"Ki Tisa",
"Vayakhel",
"Pekudei",
"Vayikra",
"Tzav",
"Shmini",
"Tazria",
"Metzora",
"Achrei Mot",
"Kedoshim",
"Emor",
"Behar",
"Bechukotai",
"Bamidbar",
"Nasso",
"Beha'alotcha",
"Sh'lach",
"Korach",
"Chukat",
"Balak",
"Pinchas",
"Matot",
"Masei",
"Devarim",
"Vaetchanan",
"Eikev",
"Re'eh",
"Shoftim",
"Ki Teitzei",
"Ki Tavo",
"Nitzavim",
"Vayeilech",
"Ha’azinu",
"Vezot Haberakhah",
"Vayakhel-Pekudei",
"Tazria-Metzora",
"Achrei Mot-Kedoshim",
"Behar-Bechukotai",
"Chukat-Balak",
"Matot-Masei",
"Nitzavim-Vayeilech",
}
Functions ¶
This section is empty.
Types ¶
type BilingualString ¶
type BilingualString struct {
English string `json:"en,omitempty"`
Hebrew bidi.String `json:"he,omitempty"`
}
func (BilingualString) String ¶
func (bs BilingualString) String() string
type CalendarGetOptions ¶
type CalendarService ¶
type CalendarService service
func (*CalendarService) Get ¶
func (s *CalendarService) Get(ctx context.Context, opts *CalendarGetOptions) (*LearningSchedule, error)
func (*CalendarService) NextRead ¶
func (s *CalendarService) NextRead(ctx context.Context, parsha string) (*ParshaReading, error)
type Client ¶
type Client struct {
BaseURL *url.URL
UserAgent string
Normalizers []normalizer.Normalizer
Text *TextService
Index *IndexService
Related *RelatedService
Calendar *CalendarService
Lexicon *LexiconService
Topics *TopicService
Terms *TermService
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
type ClientOption ¶
type ClientOption func(*Client)
func WithAPIEndpoint ¶
func WithAPIEndpoint(endpoint string) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
func WithLogger ¶
func WithLogger(logger *slog.Logger) ClientOption
type DictionaryEntry ¶
type Haftorah ¶
type Haftorah struct {
Title BilingualString `json:"title" table:"Title"`
DisplayValue BilingualString `json:"displayValue"`
URL string `json:"url"`
Ref string `json:"ref"`
Order int `json:"order"`
Category string `json:"category"`
}
type IndexService ¶
type IndexService service
func (*IndexService) Contents ¶
func (s *IndexService) Contents(ctx context.Context) (*Index, error)
func (*IndexService) Shape ¶
func (s *IndexService) Shape(ctx context.Context, title string, opts *IndexShapeOptions) ([]Shape, error)
type IndexShapeOptions ¶
type LearningSchedule ¶
type LearningSchedule struct {
Date types.Date `json:"date"`
Timezone string `json:"timezone"`
Learnings []ScheduledLearning `json:"calendar_items"`
}
type LexiconCompletionsOptions ¶
type LexiconCompletionsOptions struct {
Limit int `url:"limit,omitempty"`
}
type LexiconGetOptions ¶
type LexiconService ¶
type LexiconService service
func (*LexiconService) Completions ¶
func (s *LexiconService) Completions(ctx context.Context, word string, lexicon string, opts *LexiconCompletionsOptions) ([][]string, error)
func (*LexiconService) Get ¶
func (s *LexiconService) Get(ctx context.Context, word string, opts *LexiconGetOptions) ([]DictionaryEntry, error)
type Manuscript ¶
type Manuscript struct {
ManuscriptSlug string `json:"manuscript_slug"`
PageID string `json:"page_id"`
ImageURL string `json:"image_url"`
ThumbnailURL string `json:"thumbnail_url"`
AnchorRef string `json:"anchorRef"`
AnchorRefExpanded []string `json:"anchorRefExpanded"`
Manuscript struct {
Slug string `json:"slug"`
Title string `json:"title"`
HeTitle string `json:"he_title"`
Source string `json:"source"`
Description string `json:"description"`
HeDescription string `json:"he_description"`
} `json:"manuscript"`
}
type Parsha ¶
type Parsha struct {
Title BilingualString `json:"title"`
DisplayValue BilingualString `json:"displayValue"`
URL string `json:"url"`
Ref string `json:"ref"`
HeRef bidi.String `json:"heRef"`
Order int `json:"order" table:"-"`
Category string `json:"category"`
ExtraDetails struct {
Aliyot []string `json:"aliyot"`
} `json:"extraDetails"`
Description BilingualString `json:"description"`
}
type ParshaReading ¶
type ParshaReading struct {
Parsha Parsha `json:"parasha"`
Haftorah []Haftorah `json:"haftarah" table:"Haftorah"`
Date types.Date `json:"date"`
HebrewDate BilingualString `json:"he_date"`
}
type RandomTextOptions ¶
type RelatedContent ¶
type RelatedLinksOptions ¶
type RelatedService ¶
type RelatedService service
func (*RelatedService) Get ¶
func (s *RelatedService) Get(ctx context.Context, tref string) (*RelatedContent, error)
func (*RelatedService) Links ¶
func (s *RelatedService) Links(ctx context.Context, tref string, opts *RelatedLinksOptions) (*RelatedContent, error)
func (*RelatedService) TopicLinks ¶
type RequestOption ¶
type ScheduledLearning ¶
type ScheduledLearning struct {
Title BilingualString `json:"title"`
DisplayValue BilingualString `json:"displayValue"`
Description BilingualString `json:"description"`
URL string `json:"url"`
Ref string `json:"ref"`
HeRef bidi.String `json:"heRef"`
Order int `json:"order"`
Category string `json:"category"`
ExtraDetails struct {
Aliyot []string `json:"aliyot,omitempty"`
} `json:"extraDetails"`
}
type Term ¶
type Term struct {
// Name of the Term. Since a Term is a shared title node that
// can be referenced and used by many different Index nodes, the
// name field is critical as it contains the shared title.
Name string `json:"name" table:"Name"`
// Array of Alternative Titles for the Term in Hebrew and English.
Titles []TermTitle `json:"titles"`
// A shared scheme to for a group of terms.
Scheme string `json:"scheme"`
// Terms that share a scheme can be ordered within that scheme. So for
// example, Parshiyot within the Parasha scheme can be ordered
// as per the order of the Parshiyot.
Order int `json:"order"`
// A string representing a citation to a Jewish text. A valid Ref consists
// of a title string followed optionally by a section string or a segment
// string. A title string is any one of the known text titles or title
// variants in the Sefaria Database.
Ref string `json:"ref"`
// The category of a specific term.
Category string `json:"category"`
}
type TermCompletion ¶
type TermCompletion struct {
Title string `json:"title" table:"Title"`
Key string `json:"key" table:"Key"`
Type string `json:"type" table:"Type"`
PictureURL string `json:"pic,omitempty"`
Primary bool `json:"is_primary" table:"Primary"`
Order int `json:"order"`
TopicPools []string `json:"topic_pools,omitempty"`
}
type TermCompletions ¶
type TermCompletions struct {
// The language of the completions, either "en" or "he"
Lang string `json:"lang"`
// The type of terms returned. Possible values are:
// - ref
// - Topic
// - AuthorTopic
// - PersonTopic
// - User
Type string `json:"type"`
// A list of autocompletion responses for the submitted text, as the API returns it.
CompletionTitles []string `json:"completions"`
Completions []TermCompletion `json:"completion_objects"`
// IsBook=true if the submitted text is a book level reference. e.g. (Genesis)
IsBook bool `json:"is_book"`
// IsSection=true if the submitted text is a section Ref (e.g. Genesis 4, as opposed
// to a segment Ref such as Genesis 4.1).
IsSection bool `json:"is_section"`
// IsSegment=true if the submitted text is a segment level Ref (e.g. Genesis 43:3, as
// opposed to a section Ref such as Genesis 43)
IsSegment bool `json:"is_segment"`
// IsRange=true if the submitted text is a a ranged Ref (one that spans multiple
// sections or segments.) e.g. Genesis 4-5
IsRange bool `json:"is_range"`
// If type=ref, this returns the canonical ref for the submitted text.
Ref string `json:"ref"`
// If type=ref, this returns the URL path to link to the submitted text on Sefaria.org
URL string `json:"url"`
// If type=ref, this returns the canonical name of the index of the submitted text.
Index string `json:"index"`
// If the submitted response is a Ref, this returns the book it belongs to.
Book string `json:"book"`
InternalSections []int `json:"internalSections"`
InternalToSections []int `json:"internalToSections"`
Sections []string `json:"sections"`
ToSections []string `json:"toSections"`
Examples []any `json:"examples"`
// Given a reference, this returns the names of the sections and segments at
// each depth of that text.
SectionNames []string `json:"sectionNames"`
HebrewSectionNames []bidi.String `json:"heSectionNames"`
// Given a partial Ref, this will return an array of strings of possible ways
// that it might be completed.
AddressExamples []string `json:"addressExamples"`
HebrewAddressExamples []bidi.String `json:"heAddressExamples"`
}
type TermNameOptions ¶
type TermNameOptions struct {
// Number of results to return. 0 indicates no limit.
Limit int `url:"limit,omitempty" validate:"gte=0" desc:"number of results to return. 0 = no limit."`
// By default the Name API returns Refs, book titles, authors,
// topics, and collections. If the type is set, the response will
// only contain items of that type. Note: Topic includes authors,
// topics and people without differentiation.
//
// If empty, the results will include all types.
Type string `` /* 147-byte string literal not displayed */
}
type TermService ¶
type TermService service
func (*TermService) Get ¶
Get the given term. A term is a shared title node. It can be referenced and used by many different Index nodes. Terms that use the same TermScheme can be ordered within that scheme. So for example, Parsha terms who all share the TermScheme of parsha, can be ordered within that scheme.
Arguments:
- term: a valid english name of a sefaria term
Examples of valid terms: Noah, HaChovel
func (*TermService) Name ¶
func (s *TermService) Name(ctx context.Context, name string, opts *TermNameOptions) (*TermCompletions, error)
Name serves primarily as an autocomplete endpoint, returning potential keyword matches for Refs, book titles, authors, topics, and collections available on Sefaria.
Arguments:
- Name: an arbitrary string to search for matches
- opts: optional parameters
type TermTitle ¶
type TermTitle struct {
// The text of the title
Text bidi.String `json:"text" table:"Title"`
// The language of the title, either "en" or "he"
Lang string `json:"lang" table:"Language"`
// Whether or not the title is a primary title. For any given topics,
// one should expect two titles with this field present and set to true,
// an English and a Hebrew primary title. The English value with primary
// set to true will match the string value of the primaryTitle
// field on topic.
Primary bool `json:"primary,omitempty" table:"Primary"`
}
type Text ¶
type Text struct {
Ref string `json:"ref"`
HeRef string `json:"heRef"`
IsComplex bool `json:"isComplex"`
Text []string `json:"text"`
He []string `json:"he"`
Versions []Version `json:"versions"`
TextDepth int `json:"textDepth"`
SectionNames []string `json:"sectionNames"`
AddressTypes []string `json:"addressTypes"`
Lengths []int `json:"lengths"`
Length int `json:"length"`
HeTitle string `json:"heTitle"`
TitleVariants []string `json:"titleVariants"`
HeTitleVariants []string `json:"heTitleVariants"`
Type string `json:"type"`
PrimaryCategory string `json:"primary_category"`
Book string `json:"book"`
Categories []string `json:"categories"`
Order []int `json:"order"`
Sections []any `json:"sections"`
ToSections []any `json:"toSections"`
Commentator string `json:"commentator"`
HeCommentator string `json:"heCommentator"`
CollectiveTitle string `json:"collectiveTitle"`
HeCollectiveTitle string `json:"heCollectiveTitle"`
BaseTexTitles []string `json:"baseTexTitles"`
IsDependant bool `json:"isDependant"`
IndexTitle string `json:"indexTitle"`
HeIndexTitle string `json:"heIndexTitle"`
SectionRef string `json:"sectionRef"`
FirstAvailableSectionRef string `json:"firstAvailableSectionRef"`
HeSectionRef string `json:"heSectionRef"`
IsSpanning bool `json:"isSpanning"`
HeVersionTitle string `json:"heVersionTitle"`
HeVersionTitleInHebrew string `json:"heVersionTitleInHebrew"`
HeShortVersionTitle string `json:"heShortVersionTitle"`
HeShortVersionTitleInHebrew string `json:"heShortVersionTitleInHebrew"`
HeVersionSource string `json:"heVersionSource"`
HeVersionStatus string `json:"heVersionStatus"`
HeVersionNotes string `json:"heVersionNotes"`
HeExtendedNotes string `json:"heExtendedNotes"`
HeExtendedNotesHebrew string `json:"heExtendedNotesHebrew"`
HeVersionNotesInHebrew string `json:"heVersionNotesInHebrew"`
HeDigitizedBySefaria bool `json:"heDigitizedBySefaria"`
HeLicense string `json:"heLicense"`
FormatHeAsPoetry bool `json:"formatHeAsPoetry"`
Title string `json:"title"`
HeBook string `json:"heBook"`
Alts []any `json:"alts"`
IndexOffsetsByDepth struct{} `json:"index_offsets_by_depth"`
Next string `json:"next"`
Prev string `json:"prev"`
Commentary []any `json:"commentary"`
Sheets []any `json:"sheets"`
Layer []any `json:"layer"`
}
type TextFormat ¶
type TextFormat string
const ( FormatDefault TextFormat = "default" FormatTextOnly TextFormat = "text_only" FormatStripOnlyFootnotes TextFormat = "strip_only_footnotes" FormatWrapAllEntities TextFormat = "wrap_all_entities" )
type TextOptions ¶
type TextOptions struct {
Versions []TextVersion
FillMissingSegments bool
Format TextFormat
}
func (TextOptions) Query ¶
func (t TextOptions) Query() string
type TextService ¶
type TextService service
func (*TextService) Get ¶
func (s *TextService) Get(ctx context.Context, tref string, opts *TextOptions) (*Text, error)
func (*TextService) Languages ¶
func (s *TextService) Languages(ctx context.Context) ([]string, error)
func (*TextService) Manuscripts ¶
func (s *TextService) Manuscripts(ctx context.Context, tref string) ([]Manuscript, error)
func (*TextService) Random ¶
func (s *TextService) Random(ctx context.Context, opts *RandomTextOptions) (*Text, error)
func (*TextService) Translations ¶
func (s *TextService) Translations(ctx context.Context, lang string) ([]Translation, error)
type TextVersion ¶
func (TextVersion) String ¶
func (t TextVersion) String() string
type TopicService ¶
type TopicService service
func (*TopicService) Recommended ¶
type Translation ¶
type Version ¶
type Version struct {
Title string `json:"title"`
VersionTitle string `json:"versionTitle"`
VersionSource string `json:"versionSource"`
Language string `json:"language"`
Status string `json:"status"`
License string `json:"license"`
VersionNotes string `json:"versionNotes"`
DigitizedBySefaria types.StringOr[bool] `json:"digitizedBySefaria"`
Priority types.StringOr[float32] `json:"priority"`
VersionTitleInHebrew string `json:"versionTitleInHebrew"`
VersionNotesInHebrew string `json:"versionNotesInHebrew"`
ExtendedNotes string `json:"extendedNotes"`
ExtendedNotesHebrew string `json:"extendedNotesHebrew"`
PurchaseInformationImage string `json:"purchaseInformationImage"`
PurchaseInformationURL string `json:"purchaseInformationURL"`
ShortVersionTitle string `json:"shortVersionTitle"`
ShortVersionTitleInHebrew string `json:"shortVersionTitleInHebrew"`
FirstSectionRef string `json:"firstSectionRef"`
FormatAsPoetry string `json:"formatAsPoetry"`
Method string `json:"method"`
HeversionSource string `json:"heversionSource"`
VersionURL string `json:"versionUrl"`
HasManuallyWrappedRefs string `json:"hasManuallyWrappedRefs"`
ActualLanguage string `json:"actualLanguage"`
LanguageFamilyName string `json:"languageFamilyName"`
IsSource bool `json:"isSource"`
IsPrimary bool `json:"isPrimary"`
Direction string `json:"direction"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bidi provides bidirectional text support for Hebrew and Arabic text.
|
Package bidi provides bidirectional text support for Hebrew and Arabic text. |
|
Package normalizer provides text normalization utilities for cleaning and standardizing text data.
|
Package normalizer provides text normalization utilities for cleaning and standardizing text data. |
|
Package types provides custom types with specialized marshaling and unmarshaling behavior for the Sefaria API client.
|
Package types provides custom types with specialized marshaling and unmarshaling behavior for the Sefaria API client. |
|
Package tz provides timezone detection functionality for cross-platform systems.
|
Package tz provides timezone detection functionality for cross-platform systems. |
Click to show internal directories.
Click to hide internal directories.