Help us shape the future of Go! Take the 2026 Go Developer Survey

discovery

package
v0.135.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Completed = "completed"
)
View Source
const (
	InProgress = "in_progress"
)
View Source
const PopularityDepth = 100_000

PopularityDepth bounds the ranked contents per kind and window a popular list reads; the rest sort as unranked.

View Source
const SearchRetention = 180 * 24 * time.Hour

SearchRetention is how long a recent search is kept after its last use.

View Source
const (
	SortMostFavorited = "most_favorited"
)
View Source
const (
	SortNewest = "newest"
)
View Source
const (
	SortOldest = "oldest"
)
View Source
const (
	SortPopular = "popular"
)
View Source
const (
	SortPosition = "position"
)
View Source
const (
	SortRandom = "random"
)
View Source
const SortRelevance = "relevance"

SortRelevance orders search results by match, personalized for a signed-in reader.

View Source
const (
	SortTitle = "title"
)
View Source
const (
	SortTopRated = "top_rated"
)
View Source
const (
	TargetChannels = "channels"
)
View Source
const (
	TargetContents = "contents"
)
View Source
const (
	TargetEntities = "entities"
)
View Source
const TypeClick = "click"

TypeClick attributes an explicit card selection to its render.

View Source
const (
	Unseen = "unseen"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity added in v0.85.0

type Activity struct {
	Days []ActivityDay `json:"days"`
	// Cohorts lists application-defined category IDs in matching priority order.
	Cohorts []string `json:"cohorts"`
}

Activity is a kind's measured activity for every UTC day of the period, newest first; days without activity are zero.

type ActivityContext added in v0.98.0

type ActivityContext struct {
	ActivityTarget
	Token      string    `json:"token"`
	OccurredAt time.Time `json:"occurred_at"`
}

ActivityContext is an opaque, subject-bound snapshot. OccurredAt is the server's observation time and stays fixed across every view checkpoint.

type ActivityContexts added in v0.98.0

type ActivityContexts struct {
	Enabled  bool              `json:"enabled"`
	Contexts []ActivityContext `json:"contexts"`
}

type ActivityContextsInput added in v0.98.0

type ActivityContextsInput struct {
	Session  string           `json:"session,omitempty"`
	Language string           `json:"language,omitempty"`
	Targets  []ActivityTarget `json:"targets"`
}

type ActivityDay added in v0.85.0

type ActivityDay struct {
	Date     string            `json:"date"`
	Readers  uint64            `json:"readers"`
	Cohorts  map[string]uint64 `json:"cohorts"`
	ActiveMS uint64            `json:"active_ms"`
}

ActivityDay is one day's distinct people who read or played the kind, by application-defined cohort. Readers counts all, including unmatched people.

type ActivitySigner added in v0.98.0

type ActivitySigner interface {
	SignTicket(scope string, expires time.Time) string
	VerifyTicket(ticket, scope string) error
}

ActivitySigner signs domain-separated activity receipts. The media reader implements it with its persistent delivery key; non-media hosts may supply their own signer. No signing key is generated implicitly.

type ActivityTarget added in v0.98.0

type ActivityTarget struct {
	ContentID string `json:"content_id"`
	VersionID string `json:"version_id,omitempty"`
}

ActivityTarget is the content a client is about to display or consume.

type Admit added in v0.81.0

type Admit func(ctx context.Context, refs []contentref.ContentRef) (map[contentref.ContentKey]bool, error)

Admit decides which candidate works a list may show, in one batch: the reader's visibility. Recommender oversamples its sources so admission still fills the list.

type Backfill added in v0.86.0

type Backfill func(ctx context.Context, kind string, exclude []string, limit int) ([]contentref.ContentRef, error)

Backfill lists up to limit works of kind, best first (e.g. newest), none of exclude (content ids): the last fill of a "for you" list.

type Candidate

type Candidate struct {
	Ref   contentref.ContentRef
	Score float64
}

Candidate is one ranked work.

type Candidates

type Candidates interface {
	Similar(ctx context.Context, anchor contentref.ContentRef, q Query) ([]Candidate, error)
	ForSubject(ctx context.Context, subject signal.Subject, q Query) ([]Candidate, error)
}

Candidates generates ranked candidate works for similar and "for you" lists; Recommender applies the shared policy (tenant, kinds, anchor, seen and disliked exclusions, admission, dedupe, limit, popularity fill) so every source gets it. Engagement is the default co-engagement source; Fallback composes a new source over it. Order is rank. Implementations should oversample past Limit: Recommender filters afterward and truncates.

type Card added in v0.81.0

type Card struct {
	ID   string `json:"id"`
	Kind string `json:"kind"`
	// Code and Path are its page, /{lang}/{route}/{code}/{slug}, which opens
	// the card's version: with ?v= when that is not the page's default.
	Code string `json:"code"`
	Path string `json:"path"`
	// Title is in Language: the display language, else a fallback.
	Title    string                  `json:"title"`
	Language string                  `json:"language"`
	Cover    []media.PublicRendition `json:"cover"`
	Version  CardVersion             `json:"version"`
	// Entities are the version's effective entities with a page, by entity kind.
	Entities map[string][]Chip `json:"entities"`
	// Channel is the original authoring home; reposts do not replace it.
	Channel     *channels.Card       `json:"channel,omitempty"`
	Repost      *channels.Repost     `json:"repost,omitempty"`
	Counts      Counts               `json:"counts"`
	Access      CardAccess           `json:"access"`
	Viewer      *catalog.ViewerState `json:"viewer,omitempty"`
	PublishedAt *time.Time           `json:"published_at,omitempty"`
	Attributes  map[string]any       `json:"attributes"`
	// UpdatedAt is when the work last gained something after this card's
	// version was published: a newer version, or pages added to this one
	// (new chapters); absent until then.
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
	// Deleted marks a deleted item or version for staff and its creators.
	Deleted bool `json:"deleted,omitempty"`
	// Excerpt is a post kind's plain-text summary, about 300 characters: its
	// description, else its body's opening for readers who open it.
	Excerpt string `json:"excerpt,omitempty"`
}

Card is one content item as a grid shows it, with the version that fits the reader best: of the versions the query matches, the one the display language opens by default (internal/edition), whose cover it shows. Of a version the reader does not open it shows what its kind's locked view does (kinds.Locked).

type CardAccess added in v0.81.0

type CardAccess struct {
	Allowed bool `json:"allowed"`
	// Level and Tiers are the version's effective rule, the same for every
	// reader (public once free): what a premium badge shows.
	Level access.Level `json:"level"`
	Tiers []string     `json:"tiers,omitempty"`
	// Unknown: entitlements could not be read; denied, nothing offered.
	Unknown bool `json:"unknown,omitempty"`
	// Sell are the keys whose purchase opens it; Requires is the key a buyer
	// holds first.
	Sell     []string         `json:"sell,omitempty"`
	Requires string           `json:"requires,omitempty"`
	Preview  *access.Preview  `json:"preview,omitempty"`
	Releases []access.Release `json:"releases,omitempty"`
}

CardAccess is the reader's access decision on the card's version.

type CardVersion added in v0.81.0

type CardVersion struct {
	ID         string   `json:"id"`
	Code       string   `json:"code"`
	Languages  []string `json:"languages"`
	Traits     []string `json:"traits"`
	Label      string   `json:"label,omitempty"`
	Pages      *int     `json:"pages,omitempty"`
	DurationMS *int64   `json:"duration_ms,omitempty"`
	HasAudio   bool     `json:"has_audio"`
	// HLS is the folder of its ladder (a read's hls entry) once its video is
	// in, for a reader who opens it: the card previews it inline.
	HLS string `json:"hls,omitempty"`
}

CardVersion is the version a card shows; Code selects it on the card's page (?v=).

type Chip added in v0.81.0

type Chip struct {
	ID       string `json:"id"`
	Slug     string `json:"slug"`
	Name     string `json:"name"`
	Path     string `json:"path,omitempty"`
	Position *int   `json:"position,omitempty"`
}

Chip names one entity on a card. Position is the content's sort key in an ordered entity: auto-filled from 1, but a host may set any value of 0 or more.

type ContentFilterState added in v0.81.0

type ContentFilterState struct {
	Entity         entities.EntityCard `json:"entity"`
	DefaultVisible bool                `json:"default_visible"`
	// Visible is the reader's setting, Overridden whether it is their own.
	Visible    bool `json:"visible"`
	Overridden bool `json:"overridden"`
}

ContentFilterState is one configured content filter as the reader has it.

type ContentFilters added in v0.81.0

type ContentFilters struct {
	AppliesTo []string             `json:"applies_to"`
	Filters   []ContentFilterState `json:"filters"`
}

ContentFilters offers one control per entity across the selected content kinds.

type ContentFiltersInitialization added in v0.94.0

type ContentFiltersInitialization struct {
	AccountID string               `json:"account_id"`
	Filters   []GuestFilterSetting `json:"filters"`
}

type ContentFiltersUpdate added in v0.81.0

type ContentFiltersUpdate struct {
	Filters []GuestFilterSetting `json:"filters,omitempty"`
}

ContentFiltersUpdate atomically changes only submitted choices. Omitted entities retain their values, including across tabs.

type ContentPage added in v0.81.0

type ContentPage struct {
	Popularity *PopularitySnapshot `json:"popularity,omitempty"`
	Contents   []Card              `json:"contents"`
	Summary    *ListingSummary     `json:"summary,omitempty"`
	// NextCursor pages on; empty on the last page.
	NextCursor string `json:"next_cursor,omitempty"`
}

ContentPage is one page of cards.

type Counts added in v0.81.0

type Counts struct {
	Likes     *int `json:"likes,omitempty"`
	Dislikes  *int `json:"dislikes,omitempty"`
	Favorites *int `json:"favorites,omitempty"`
}

Counts are explicit reactions and favorites; reading quality is not a public open counter.

type DailyReleases added in v0.95.0

type DailyReleases struct {
	TimeZone    string       `json:"time_zone"`
	FromDate    string       `json:"from_date"`
	ThroughDate string       `json:"through_date"`
	Days        []ReleaseDay `json:"days"`
}

DailyReleases contains every visible card in the requested window, without a per-day or whole-response item limit. Empty days preserve its extent.

type DateCount added in v0.81.0

type DateCount struct {
	// Date is YYYY-MM-DD or YYYY-MM in the filter's time zone.
	Date string `json:"date"`
	// Count is the contents released then; Free those open to anyone.
	Count int `json:"count"`
	Free  int `json:"free"`
}

DateCount is one day or month of the index.

type EngagementBatch added in v0.104.0

type EngagementBatch struct {
	Session   string               `json:"session,omitempty"`
	Snapshots []EngagementSnapshot `json:"snapshots"`
}

EngagementBatch names the stable browser identity only for a guest. The server resolves signed-in subjects and checks every receipt against them.

type EngagementSnapshot added in v0.104.0

type EngagementSnapshot struct {
	ContentID     string           `json:"content_id"`
	VersionID     string           `json:"version_id,omitempty"`
	VisitID       string           `json:"visit_id"`
	OriginClickID string           `json:"origin_click_id,omitempty"`
	SegmentID     string           `json:"segment_id"`
	Revision      uint64           `json:"revision"`
	ActivityToken string           `json:"activity_token"`
	ActiveMS      uint32           `json:"active_ms"`
	Resume        string           `json:"resume,omitempty"`
	Pages         []PageEngagement `json:"pages,omitempty"`
	Watched       []WatchedRange   `json:"watched,omitempty"`
}

EngagementSnapshot is one cumulative measured segment of a visit. Page changes stay local; clients checkpoint about every two minutes and on exit. Opening a route, preloading an image, and seeking are not measurements.

type ExposureInput added in v0.81.0

type ExposureInput struct {
	// RenderID is stable per render and shared with its clicks.
	RenderID string `json:"render_id"`
	// Stage is served, rendered or visible.
	Stage    string `json:"stage"`
	Revision uint64 `json:"revision,omitempty"`
	QueryID  string `json:"query_id,omitempty"`
	// SearchQuery is normalized like recent search history, at most 200 runes.
	SearchQuery string `json:"search_query,omitempty"`
	Surface     string `json:"surface,omitempty"`
	Ranker      string `json:"ranker,omitempty"`
	Language    string `json:"language,omitempty"`
	// OccurredAt is the render's time; now by default.
	OccurredAt *time.Time  `json:"occurred_at,omitempty"`
	Shown      []Placement `json:"shown"`
}

ExposureInput is one result list at one stage.

type Exposures added in v0.81.0

type Exposures struct {
	Session   string          `json:"session,omitempty"`
	Exposures []ExposureInput `json:"exposures"`
}

Exposures are result lists a client rendered or showed.

type Fallback

type Fallback struct {
	Primary, Secondary Candidates
	OnError            func(error)
}

Fallback serves Primary and uses Secondary when Primary fails (after OnError) or returns fewer than Limit candidates. Recommender decides whether to fill after its policy filters, so excluded candidates do not count.

func (Fallback) ForSubject

func (f Fallback) ForSubject(ctx context.Context, subject signal.Subject, q Query) ([]Candidate, error)

func (Fallback) Similar

func (f Fallback) Similar(ctx context.Context, anchor contentref.ContentRef, q Query) ([]Candidate, error)

type GuestFilterSetting added in v0.98.0

type GuestFilterSetting struct {
	EntityID string `json:"entity_id"`
	Visible  *bool  `json:"visible,omitempty"`
	Default  *bool  `json:"default,omitempty"`
}

GuestFilterSetting is a shared entity choice or reset without pinning a domain's current default value. Exactly one of Visible or Default:true is required.

type HistoryOptions added in v0.81.0

type HistoryOptions struct {
	Reader
	Kind string
	// Status is seen, in_progress or completed; anything they touched by
	// default.
	Status       string
	CardEntities []string
	Cursor       string
	Summary      bool
	// Limit defaults to 24 and is capped at 100.
	Limit int
}

HistoryOptions select one page of the signed-in reader's history.

type Hit

type Hit struct {
	contentref.ContentRef
	Score float32
}

Hit is one ranked work of a discovery list.

type ImportLegacyReading added in v0.104.0

type ImportLegacyReading struct {
	ContentID   string
	VersionID   string
	Subject     signal.Subject
	FirstReadAt *time.Time
	LastReadAt  time.Time
	Progress    uint32
	ProgressMax uint32
	Completed   bool
	Resume      string
	Revision    uint64
}

type ImportSignal added in v0.81.0

type ImportSignal struct {
	ContentID  string
	VersionID  string
	Subject    signal.Subject
	Type       string
	EventID    string
	Revision   uint64
	OccurredAt time.Time
}

ImportSignal is a recorded event as the bulk import replays it: its subject given, scored as RecordSignals scores a client's.

type Interaction added in v0.81.0

type Interaction struct {
	Channel *channels.Card       `json:"channel,omitempty"`
	Content *Card                `json:"content,omitempty"`
	Entity  *entities.EntityCard `json:"entity,omitempty"`
	// Value is 1 for a favorite.
	Value int16 `json:"value"`
	// At is when the reader favorited or last reacted.
	At time.Time `json:"at"`
}

Interaction is one content item or entity the reader favorited or reacted to, as its card shows it now.

type InteractionPage added in v0.81.0

type InteractionPage struct {
	Items []Interaction `json:"items"`
	// NextCursor pages on; empty on the last page.
	NextCursor string          `json:"next_cursor,omitempty"`
	Summary    *ListingSummary `json:"summary,omitempty"`
}

InteractionPage is one page of the reader's favorites, most recent first.

type KnownCardsOptions added in v0.111.0

type KnownCardsOptions struct {
	Reader
	IDs          []string
	Kind         string
	CardEntities []string
	Summary      bool
}

KnownCardsOptions selects a bounded set of already-known IDs, not a listing.

type LibraryItem added in v0.125.0

type LibraryItem struct {
	ContentID string `json:"content_id"`
	Kind      string `json:"kind"`
	Title     string `json:"title"`
	Language  string `json:"language,omitempty"`
	// Deleted marks a purchase whose content is deleted: it stays in the
	// buyer's library but is unreadable unless restored.
	Deleted bool `json:"deleted"`
	// Whole is always false: a gallery parent does not grant audience access.
	// VersionIDs lists only currently eligible, individually granted editions.
	Whole      bool     `json:"whole"`
	VersionIDs []string `json:"version_ids"`
}

LibraryItem groups the independently purchased editions of one gallery.

type LibraryPage added in v0.125.0

type LibraryPage struct {
	Items      []LibraryItem `json:"items"`
	NextCursor string        `json:"next_cursor,omitempty"`
	// Complete is false when the viewer holds more keys than one billing read
	// returns (access.HeldLimit); the library lists those it read.
	Complete bool `json:"complete"`
}

LibraryPage is one page of a library, newest content first.

type LibraryQuery added in v0.125.0

type LibraryQuery struct {
	// Language picks the titles; the configured languages follow.
	Language string
	Cursor   string // the previous page's next_cursor
	Limit    int    // 20 by default, at most 100
}

LibraryQuery pages a viewer's library.

type ListingSummary added in v0.104.0

type ListingSummary struct {
	FilteredCount    int                     `json:"filtered_count"`
	FilteredEntities []ReleaseFilteredEntity `json:"filtered_entities"`
	LockedCount      int                     `json:"locked_count"`
	// Total is the contents the list pages through under its access mode.
	Total int `json:"total"`
	// Truncated makes counts lower bounds for bounded keyword or recommendation
	// candidate windows. Ordinary lists have exact selection counts.
	Truncated bool `json:"truncated,omitempty"`
}

ListingSummary describes this query's selection before cursor pagination. Only optional entity preferences are relaxed to count filtered contents.

type ManagementCatalog added in v0.104.0

type ManagementCatalog interface {
	ManagementSearch(context.Context, access.Actor, catalog.ManagementSearchQuery) (catalog.ManagementNames, error)
}

ManagementCatalog keeps editor authorization with the catalog. The standard *catalog.Store implements it; a custom Visibility may forward this capability.

type ManagementSuggestionsOptions added in v0.104.0

type ManagementSuggestionsOptions struct {
	Actor                            access.Actor
	Query, DisplayLanguage           string
	ContentKinds, EntityKinds        []string
	IncludeContents, IncludeEntities bool
	Limit                            int
}

type Media added in v0.88.0

type Media interface {
	Covers(ctx context.Context, covers []versions.CoverOf) ([][]media.PublicRendition, error)
	Ladder(kind string) string
}

Media is the cards' media: versions.Service. Covers resolves covers to public renditions, per cover in order; Ladder is the folder of a kind's HLS ladder (a read's hls entry), "" when it streams none.

type MineOptions added in v0.81.0

type MineOptions struct {
	Reader
	// Target is contents (the default), entities or channels.
	Target string
	// Kind is one content kind or entity kind; every kind by default.
	Kind         string
	CardEntities []string
	Cursor       string
	// Limit defaults to 24 and is capped at 100.
	Limit int
	// Summary adds counts scoped to this reader's matching contents, before pagination.
	Summary bool
}

MineOptions select one page of the signed-in reader's favorites.

type MyStats added in v0.85.0

type MyStats struct {
	// Completed counts the contents they finished, per kind; empty without
	// a signal plane.
	Completed map[string]int64 `json:"completed"`
	// AccessSeconds is elapsed access to each configured tier, from billing's
	// recorded product windows and entitlement history. Overlaps count once;
	// future access does not count. Absent when history is unavailable.
	AccessSeconds map[string]int64 `json:"access_seconds,omitempty"`
	// Comments counts their published comments; CommentLikes and
	// CommentDislikes the reactions those received.
	Comments        int64 `json:"comments"`
	CommentLikes    int64 `json:"comment_likes"`
	CommentDislikes int64 `json:"comment_dislikes"`
}

MyStats is the signed-in reader's account statistics.

type PageEngagement added in v0.104.0

type PageEngagement = signal.PageEngagement

type Placement added in v0.81.0

type Placement struct {
	ContentID     string `json:"content_id"`
	Position      uint32 `json:"position"`
	VersionID     string `json:"version_id,omitempty"`
	ActivityToken string `json:"activity_token,omitempty"`
}

Placement is one shown content item at its 1-based position.

type PopularitySnapshot added in v0.131.0

type PopularitySnapshot struct {
	Bucket string `json:"bucket"`
	Ready  bool   `json:"ready"`
	// WindowFrom/WindowUntil are the resolved bucket requested at preparation.
	WindowFrom  *time.Time `json:"window_from,omitempty"`
	WindowUntil *time.Time `json:"window_until,omitempty"`
	// From/Until are the covered whole UTC days actually ranked.
	From          *time.Time `json:"from,omitempty"`
	Until         *time.Time `json:"until,omitempty"`
	AvailableFrom *time.Time `json:"available_from,omitempty"`
	ComputedAt    *time.Time `json:"computed_at,omitempty"`
	// Provisional marks recent days still accepting measurements. Absence does
	// not certify that every older day has completed its final preparation.
	Provisional bool `json:"provisional,omitempty"`
}

PopularitySnapshot describes the prepared ranking actually served. A pending bucket has Ready=false; a successfully prepared empty ranking has Ready=true.

type Query

type Query struct {
	// ContentKinds limits candidate kinds (empty = any).
	ContentKinds []string
	// Limit is the number of results the caller returns after filtering.
	Limit int
	// Window bounds the evidence (zero = all time).
	Window signal.Window
	// SeedLimit and SeedContentKinds bound which of the subject's history
	// informs ForSubject (0 / empty = implementation default).
	SeedLimit        int
	SeedContentKinds []string
}

Query bounds one candidate request.

type Reader added in v0.81.0

type Reader struct {
	Actor access.Actor
	// Host is the request's host: it picks the site scope.
	Host string
	// Language lists only content with a live version serving it.
	Language string
	// DisplayLanguage is the language of titles and entity names and the
	// preferred language of each card's version; Language, else the site's
	// first.
	DisplayLanguage string
	// Mode is lock (the default) or hide.
	Mode access.Mode
}

Reader is who reads, on which site, in which language.

type RecentSearch added in v0.81.0

type RecentSearch struct {
	Query string `json:"query"`
	// Results is how many cards its first page showed.
	Results    int       `json:"results"`
	SearchedAt time.Time `json:"searched_at"`
}

RecentSearch is one query the reader searched.

type RecentSearches added in v0.81.0

type RecentSearches struct {
	Searches []RecentSearch `json:"searches"`
}

RecentSearches is the reader's recent searches, newest first.

type RecommendOptions

type RecommendOptions struct {
	// ContentKinds are the candidate kinds to recommend. Required.
	ContentKinds []string

	// Limit caps results (default: Recommender.DefaultLimit).
	Limit int

	// SeedLimit is how many of the subject's highest-signal works inform
	// candidates (source default; Engagement: 5).
	SeedLimit int

	// SeedContentKinds limits which kinds may seed (default: any).
	SeedContentKinds []string

	// IncludeSeen keeps already-seen works in results (default: excluded).
	IncludeSeen bool

	// Popular fills cold or thin results from the kind's default prepared bucket.
	// Nil skips popularity fill.
	Popular func(ctx context.Context, kind string, limit int) ([]string, error)

	// Backfill fills what popularity leaves short, from works no signal
	// names; nil leaves the list short.
	Backfill Backfill

	// Admit keeps the works the reader may be shown; nil admits all.
	Admit Admit
}

RecommendOptions controls Recommend ("for you": subject → works).

type ReleaseDates added in v0.81.0

type ReleaseDates struct {
	Dates      []DateCount `json:"dates"`
	NextCursor string      `json:"next_cursor,omitempty"`
}

ReleaseDates is one page of the index, newest first.

type ReleaseDay added in v0.95.0

type ReleaseDay struct {
	Date     string `json:"date"`
	Contents []Card `json:"contents"`
	// FilteredCount is the unique contents omitted only by optional entity
	// preferences, not by access or hard domain policy.
	FilteredCount int `json:"filtered_count"`
	// Counts overlap, so their sum is not FilteredCount. Hidden public filters
	// with no matches have count zero. Locked entity redaction still applies.
	FilteredEntities []ReleaseFilteredEntity `json:"filtered_entities"`
}

type ReleaseFilteredEntity added in v0.99.0

type ReleaseFilteredEntity struct {
	Entity entities.EntityCard `json:"entity"`
	Count  int                 `json:"count"`
}

type SearchPage added in v0.127.1

type SearchPage struct {
	ContentPage
	Entities []entities.EntityCard `json:"entities,omitempty"`
}

SearchPage is a page of search results. The first page also carries the entities matching the query that have contents the reader can see.

type SignalInput added in v0.81.0

type SignalInput struct {
	ContentID string `json:"content_id"`
	VersionID string `json:"version_id,omitempty"`
	// Only click is accepted here. Measured reading has its own snapshot route.
	Type       string    `json:"type"`
	EventID    string    `json:"event_id"`
	Revision   uint64    `json:"revision,omitempty"`
	OccurredAt time.Time `json:"occurred_at"`
	// RenderID, Surface and Position attribute it to an exposure.
	RenderID string `json:"render_id,omitempty"`
	Surface  string `json:"surface,omitempty"`
	Position uint32 `json:"position,omitempty"`
	// ActivityToken is the server's immutable access snapshot from /activity-contexts.
	ActivityToken string `json:"activity_token,omitempty"`
}

SignalInput is one event on a content item or one of its versions.

type Signals added in v0.81.0

type Signals struct {
	Session string        `json:"session,omitempty"`
	Signals []SignalInput `json:"signals"`
}

Signals is what a client reports, for the signed-in reader or, signed out, for the browser session Session names.

type SimilarOptions

type SimilarOptions struct {
	Limit int
	// ContentKinds limits result kinds (default: any).
	ContentKinds []string
	// Window bounds the candidate evidence (default all time).
	Window signal.Window

	// ExcludeSeenFor drops works this subject has already seen (and always
	// drops works they negatively reacted to).
	ExcludeSeenFor *signal.Subject

	// Admit keeps the works the reader may be shown; nil admits all.
	Admit Admit
}

SimilarOptions controls Similar ("more like this").

type SitemapAlias added in v0.85.0

type SitemapAlias struct {
	Language string `json:"language"`
	Path     string `json:"path"`
	Image    string `json:"image,omitempty"`
}

SitemapAlias is a page in one language. A content page's Image is the cover of the edition the language opens by default, its widest rendition, where its kind's locked view shows covers.

type SitemapEntry added in v0.85.0

type SitemapEntry struct {
	ID   string `json:"id"`
	Code string `json:"code"`
	// Path is the page in the first of the site's languages it serves;
	// Languages are its page in each, for hreflang alternates.
	Path      string         `json:"path"`
	LastMod   time.Time      `json:"lastmod"`
	Languages []SitemapAlias `json:"languages"`
}

SitemapEntry is one public page: a content item or entity.

type SitemapOptions added in v0.85.0

type SitemapOptions struct {
	// Host picks the site scope.
	Host string
	Kind string
	// Cursor is the previous page's NextCursor.
	Cursor string
	// Limit defaults to 1000 and is capped at 10000.
	Limit int
}

SitemapOptions select one page of the feed.

type SitemapPage added in v0.85.0

type SitemapPage struct {
	Entries []SitemapEntry `json:"entries"`
	// NextCursor pages on; empty on the last page.
	NextCursor string `json:"next_cursor,omitempty"`
}

SitemapPage is one page of a site's public pages of one kind, by id.

type Typeahead added in v0.81.0

type Typeahead struct {
	Contents []Card                `json:"contents"`
	Entities []entities.EntityCard `json:"entities"`
}

Typeahead is the suggestions: content cards and entities, best first.

type TypeaheadOptions added in v0.81.0

type TypeaheadOptions struct {
	Reader
	Query string
	// Kind limits content suggestions to one kind.
	Kind string
	// EntityKinds are the entity kinds suggested; every kind with a page by
	// default.
	EntityKinds []string
	// Limit is per section: 8 by default, at most 20.
	Limit int
}

TypeaheadOptions select suggestions while a reader types.

type WatchedRange added in v0.104.0

type WatchedRange = signal.WatchedRange

Jump to

Keyboard shortcuts

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