Documentation
¶
Overview ¶
Package legal is the legal texts api serves (R52; R130, R136 spec): the part legal/ of spec at the tag api pins, spec.Legal, or a self-hosted copy's folder of its operator's texts, read once at the start by the rules of legal/README.md, section 5. It answers LegalService.GetLegalTexts, and tells whether a request that gives a consent names the current versions of the texts it is given to.
Index ¶
Constants ¶
const ( PrivacyPolicy = "privacy-policy" TermsOfUse = "terms-of-use" ParentConsent = "parent-consent" TeenConsent = "teen-consent" StorageConsent = "storage-consent" )
The texts the requests of a consent name (contracts README, section 15).
const ( StepSchema = "schema" RuleFiles = "legal.files" RuleVersions = "legal.versions" RuleSetTexts = "legal.set-texts" RuleMarkdown = "legal.markdown" RuleInForceUnchanged = "legal.in-force-unchanged" )
The steps of reading a part, by the names section 5 of legal/README.md gives them: the schema, then the rules in their order.
Variables ¶
This section is empty.
Functions ¶
func Markdown ¶
Markdown says whether source keeps legal.markdown: it begins with a heading of the first level, and holds no HTML, no image and no link — an autolink, a literal one of GFM and a definition of a link among them.
func Read ¶
Read reads the part by section 5: the schema of the passport, then legal.files, legal.versions, legal.set-texts and legal.markdown, then, when previous is the part of the release before, legal.in-force-unchanged. It gives the passport, or the Refusal of the first step that refuses the part: a part is never read in part.
Types ¶
type Part ¶
type Part struct {
Passport json.RawMessage
Files map[string][]byte
}
Part is a part of the legal texts as it is read: its passport as a JSON value and its files under texts/, by their paths from the part.
type Refusal ¶
Refusal is a part that a step of section 5 refuses, with the names it gives: the paths the schema refuses, or what a rule names, in the order of code units.
type Service ¶
type Service struct {
apiv1connect.UnimplementedLegalServiceHandler
// contains filtered or unexported fields
}
Service is LegalService on the texts.
func (*Service) GetLegalTexts ¶
func (s *Service) GetLegalTexts(ctx context.Context, req *v1.GetLegalTextsRequest) (*v1.GetLegalTextsResponse, error)
GetLegalTexts gives the current version of every text whose place is app, by ID in the order of code units: its body, its summary in the language asked — or else in English — and its translation into it, when the version has one, with no English in its place (contracts README, section 15). The answer is kept for an hour. A tag that is no BCP 47 is the one refusal.
type Text ¶
type Text struct {
ID string
Version int32
InForceSince string
Place string
Body string
// Summaries is the gist of the version, by the tag of its language.
Summaries map[string]string
// Translations is the translations of the version, by the tag of their
// language, other than English.
Translations map[string]string
}
Text is the current version of a text.
type Texts ¶
type Texts struct {
// contains filtered or unexported fields
}
Texts is the current version of every text of a part that has one.
func Load ¶
Load is the texts of spec's Go module at the tag api pins, read as section 5 reads a part: spec checked them before its release, and the same rules hold them here, but legal.in-force-unchanged, which needs the release before.
func LoadDir ¶
LoadDir is the texts of a self-hosted copy's folder at dir, which holds VERSION, legal.yaml and texts/ alone, its VERSION that of the part of spec's tag, and keeps the rules of section 5 but legal.in-force-unchanged: the copy's operator keeps its own history (legal/README.md, section 8).
func Spec ¶
func Spec() *Texts
Spec is the texts of the tag api pins, spec.Legal. They are embedded in the binary and read by the tests of this package, so that they cannot fail to read.
func (*Texts) Current ¶
Current is the number of the current version of the text id, and whether it has one.
func (*Texts) List ¶
List is the texts of the place app in the language tag, as GetLegalTexts gives them.
func (*Texts) Names ¶
func (t *Texts) Names(refs []*v1.LegalTextRef, ids ...string) bool
Names says whether refs names exactly the current version of each of ids that has one, and no other text: a text with no version in force is named by no request, and a version that is not current, a text in force left out, a text named twice or one that is none of ids is CAUSE_TEXT_NOT_CURRENT (contracts README, section 15).