Reads the flat labels attached to blog articles, available as lynkow.tags. With cache: true, responses are cached for 5 minutes.

Access via: lynkow.tags

Methods

2 methods

clearCache

TypeScript
clearCache(): void

Clears every cached tag response held by the client. Call it when a tag.* webhook arrives so the next read fetches fresh data.

Returns: void

TypeScript
lynkow.tags.clearCache()

list

TypeScript
list(filters?: TagsListFilters, options?: BaseRequestOptions): Promise<TagsListResponse>

Fetches a page of the site's tags, sorted by name. Defaults to 20 per page, at most 100. Without a locale, tags of every language are listed. With one, each translation group appears once and a missing translation is served from the fallback locale (fallback: false in options drops those). With cache: true, cached for 5 minutes. Resolves to { data, meta }.

Parameter

Type

Description

filters

TagsListFilters

page (1-based), limit (up to 100) and locale.

options

BaseRequestOptions

Request options. options.locale takes precedence over filters.locale.

Returns: Promise<TagsListResponse>

TypeScript
// Default: first 20 tags.
const { data, meta } = await lynkow.tags.list()

// Page through everything.
for (let page = 1; page <= meta.lastPage; page++) {
  const { data } = await lynkow.tags.list({ page, limit: 50 })
  data.forEach(t => console.log(t.name))
}