Reads legal documents (privacy policy, terms of service), which are pages tagged 'legal'. Available as lynkow.legal. With cache: true, responses are cached for 5 minutes.

Access via: lynkow.legal

Methods

3 methods

clearCache

TypeScript
clearCache(): void

Clears every cached legal document held by the client.

Returns: void

TypeScript
lynkow.legal.clearCache() // Deprecated; prefer lynkow.pages.clearCache()

getBySlug

TypeScript
getBySlug(slug: string, options?: BaseRequestOptions): Promise<LegalDocument>

Fetches one published page by slug, with its resolved data and SEO settings. The slug is not checked against the 'legal' tag. With cache: true, cached for 5 minutes. Throws LynkowError NOT_FOUND for an unknown slug, and for an empty, '.' or '..' slug, which is refused without a request.

Parameter

Type

Description

slug

string

The page slug, such as 'privacy-policy'.

options

BaseRequestOptions

Request options. locale selects the translation.

Returns: Promise<LegalDocument>

TypeScript
const privacy = await lynkow.pages.getBySlug('privacy-policy')

list

TypeScript
list(options?: BaseRequestOptions): Promise<LegalDocument[]>

Fetches the published pages tagged 'legal' as summaries. Resolves to an array of LegalDocument. With cache: true, cached for 5 minutes.

Parameter

Type

Description

options

BaseRequestOptions

Request options. locale selects the language.

Returns: Promise<LegalDocument[]>

TypeScript
const docs = await lynkow.pages.list({ tag: 'legal' })
docs.data.forEach(doc => console.log(doc.slug, doc.name))