contentkit

package module
v0.145.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 91 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

contentkit

contentkit is the deterministic content library for the Doujins, Hentai0 and marketplace hosts: tenant-scoped content (items, versions, entities), interactions (comments, reactions, favorites, polls), keyword search over that content, the activity log in ClickHouse (opens, reading progress, reactions, hides, searches) with the reading state and daily rollups folded from it, and the discovery reads over both. It needs no model provider, API key or vector extension. Semantic search belongs entirely to the separate, deferred User Intelligence library; ContentKit has no semantic search configuration or runtime hook.

Design: open-rails-tracker/contentkit/DESIGN.md. Host contract: HOST_INTEGRATION.md. Hosts use ContentKit only through its client, routes and event log, never SQL on its tables: it can run on its own database (host references). Post/channel policies: docs/posts-and-channels.md. Migrations: docs/migration.md, docs/restore.md.

From 0.141.0 each migration set is one immutable baseline. A database an earlier release built is refused and rebuilt, never migrated forward: rebuilding.

Release policy

Standalone gateway patches use media-gateway/vX.Y.Z tags and publish only contentkit-media-gateway:gateway-vX.Y.Z for amd64 and arm64, keeping those immutable tags separate from root-release image tags. They do not release the Go modules, media worker or UI package; those components can retain their existing versions when their code and protocol are unchanged.

ContentKit is pre-stable and releases on v0.x; its API may change between minor versions. The historical v1.0.0-rc.1 through v1.1.1 tags were premature and are retracted. v1.1.2 is a self-retracted, withdrawal-only marker carrying Go module metadata, not a supported stable API release.

The marker and v0.12.2 identify the same source commit. Go reads retractions from the highest release before applying them, so the marker makes fresh @latest requests select the latest unretracted v0.x release, including future v0.x releases. Existing tags remain immutable; retraction preserves explicit pins and does not automatically downgrade existing consumers. See Go module retractions.

Vocabulary

Name Meaning
Scope.TenantID the business owning an account directory and its apps
Scope.AppID one tenant-owned app and its separate content catalog, such as Doujins or Hentai0
content_id the host-owned work: a gallery, a video, a listing; a canonical UUIDv7, never reused (Content ids)
content_version_id one selectable version of that work (optional)
channel_id the overall item's primary authoring channel
entity_id an associated tag, artist, series, character, playlist or featured rail
ContentRef {TenantID, ContentKind, ContentID, ContentVersionID *string} — the typed reference every API, key, index and cursor carries

A language is metadata on a document or version, never part of a reference. Each engine serves the app pinned by Scope. Apps can share tenant-owned account data without sharing their catalogs. ContentRef.TenantID retains the catalog partition key: it is Scope.AppID, distinct from the business's Scope.TenantID. Scope is required. A reference to another catalog is an error, never remapped. See scope.go.

Packages

Hosts import only the public packages. Each domain package holds its route bodies' wire and data types and its ports; its implementation is the internal/<domain>store twin, which the compiler keeps from hosts (Public surface).

Package Owns
root Engine: New (validates or migrates storage according to Database.SkipMigrations), Start (serve; requests enqueue jobs), StartJobs (work its jobs on its own River), Routes (route groups under /v1), Client/NewClient (the typed client of every route), EventReader, account lifecycle, Reconcile, Ready, Probes, Close; Config, Deps, MigratePostgres, MigrateClickHouse, error codes
kinds the content model: content and entity kinds, languages, tiers, channels
contentref ContentRef, ContentKey, EntityID
access Actor, the staff permissions (Permission, Permissions()), the key grammar, rules and the Billing port (Access)
catalog, entities, channels, content, contenturl, discovery, importer, signal, media, media/versions the routes' request and response types, events, the media registry's config types and the bucket port (media.Store), and the host ports (content.ContentModerator, entities.Scopes, …)
media/s3 media.Store over aws-sdk-go-v2 (Ceph RGW in production, MinIO in tests), bucket policy and point-in-time Restore
media/avatar the standard account avatar kind
media/gateway, media/token, media/layout the media gateway's handler (cmd/media-gateway), its access tokens and object keys
adapters/authkit, adapters/openrails their own modules: AuthKit auth and scopes, access.Billing over OpenRails
server its own module: the standalone contentkit binary (server/cmd/contentkit)
internal/catalogstore content items, versions, content_facets, the one visibility rule, the content_events log (cursor reads), search documents, totals, retention jobs
internal/entitystore, internal/channelstore entities by kind and channels: names, text, covers, scopes, merges, memberships
internal/contentstore comments, reactions, favorites, polls, bans, moderation, interaction limits
internal/discoverystore, internal/search, internal/rankings public reads: lists, search, typeahead, similar and recommended, release dates, history; keyword search; popularity rankings and similar lists (popularity)
internal/signalstore, internal/readingstore, internal/analytics the ClickHouse activity log and daily rollups; reading state, history and sign-in links in PostgreSQL; the job folding one into the other (docs/analytics.md)
internal/mediastore, internal/versionstore media manifests, uploads, reads, processing records; version reader plans, publication and downloads
internal/entitlement the access Gate, its listing Filter and the request memo
internal/urlstore, internal/importstore content codes, slugs, aliases; the bulk import
internal/media/{worker,workqueue,image,video} the media worker (cmd/media-worker), its queue, libvips and ffmpeg producers
internal/migrations the PostgreSQL catalog and account baselines and the ClickHouse baseline

Engine

ContentKit runs in the host's process the way OpenRails does: one New, one Start, routes the host mounts.

ck, _ := contentkit.New(ctx, contentkit.Config{
	Scope:            &contentkit.Scope{TenantID: tenantID, AppID: appID}, // stable provisioned IDs
	Database:   contentkit.DatabaseConfig{Schema: "doujins_contentkit", SkipMigrations: true}, // River: doujins_contentkit_river
	Content:    siteKinds, // kinds.Config: languages, tiers, content and entity kinds
	Media:      &contentkit.MediaConfig{Config: registry, Delivery: contentkit.DeliveryConfig{SigningKey: key}},
	ClickHouse: contentkit.ClickHouseConfig{Database: "analytics", Addr: chAddr},
}, contentkit.Deps{Postgres: pool, Auth: ak.Authenticator(), Users: ak.UserInfo(),
	Billing: ckopenrails.Billing(merchant), Store: bucket})
_ = ck.Start(ctx)     // API process: serve; requests enqueue jobs
_ = ck.StartJobs(ctx) // worker process: work ContentKit's jobs on its own River
routes, _ := ck.Routes(contentkit.Routes{Prefix: "/api/contentkit", Groups: contentkit.AllRoutes})
for _, r := range routes {
	mux.Handle(r.Path, r.Handler)
}
  • With Database.SkipMigrations: true, New checks prepared storage read-only. Run the explicit host migration command first; it calls the applicable PostgreSQL, media and ClickHouse migration stages. MigratePostgres also provisions configured fixed channels and their groups through MigrationOptions.Scopes; hosts need no separate seeding code. The default false retains embedded startup migrations. Catalog tables use Database.Schema (default contentkit); account tables can use a separately shared schema. PGroonga and pg_trgm live in public. See migration instructions.
  • Config is plain data (YAML/JSON); Deps holds connections and providers. Scope binds the business and app; media paths derive from that scope, with tenant-shared account media. Content kinds' media are their versions' (media.ForContent, the media/versions service). All content belongs to ContentKit: hosts create it through /v1/contents (or Client()).
  • Start runs every background job: search indexing, the analytics job and its ranking precompute, publication events, event retention and content purge, and the media jobs. Hosts schedule nothing. Start before serving: writes queue jobs.
  • The engine builds the access Gate from Config.Content and Deps.Billing. Billing supplies authoritative entitlement reads; product and price management stays in OpenRails.
  • Client() is the HTTP surface as a Go client acting as the host, over an in-process transport (for example PostContents, CreateContent).
  • Ready fails until Start; Probes are the optional dependencies (ClickHouse, the bucket, Redis); AnonymizeAccount is account deletion.
  • Config.Accounts.Avatars is people's avatars: held by one site's engine, the primary, which other sites sharing its people forward their avatar writes to (HOST_INTEGRATION "Avatars").

server/ runs the same engine standalone: a YAML config file, secrets from the environment, an AuthKit resource server, OpenRails' remote client and health at /livez, /readyz and /statusz (server/cmd/contentkit).

For machine uploads, the media upload guide covers app-bound API keys, presign/upload/commit, durable processing status and explicit publication. The same guide covers retained source ZIPs, automatic page normalization and the editor's reversible page review.

HTTP API

Routes returns each selected route group as a subtree under {Prefix}/v1. No auth middleware goes in front: each route's gate asks Deps.Auth who the request is (once) and admits it by its tier:

Route group Sub-path Needs
ContentRoutes /v1: the content model (GET /v1/kinds), content items and versions (/v1/contents, /v1/manage or /v1/manage/{kind}), catalog totals, comments, reactions, favorites, polls, comment bans, moderation always
UploadRoutes /v1/media/upload Config.Media
MediaRoutes /v1/media: reads and HLS playlists; /v1/contents/{id}/reader: reader plan; /v1/contents/{id}/versions/{vid}/…: reader metadata, download Config.Media
CodeRoutes /v1/codes/{code} always
EntityRoutes /v1/entities, /v1/contents/{id}/entities: listings and pages, writes for root:entities:write always
DiscoveryRoutes public lists/search, history and /v1/me/library for purchased content always; purchased access uses Deps.Billing
Tier Admits
open anyone; never authenticates
public anyone: anonymous without a credential, else the subject it proves (a credential that fails is 401 with the provider's challenge)
user a signed-in person (401 anonymous, 403 an application)
staff a person or an application holding the route's permission, one of access.Permissions() (root:<resource>:<action>), in the Authenticator's root scope, by its Verified.Can (403 without it)

Refusals carry auth.Refuse's status and WWW-Authenticate; an auth outage is 503, and any other panic while serving is 500 internal_error. ContentKit names its staff permissions (access.Permissions()); the host declares them in its auth's roles from those constants. They are root-wide; per-item rights (creators, primary-channel editors) are the catalog's. Behind a proxy, list it in Config.TrustedProxies, or set Request.RemoteAddr to the client's address before the routes: location rules, anonymous votes and limits are keyed by it (client address). No content kind may be named media, codes, entities, contents, kinds, catalog or notifications.

Every route is declared once, in its module's route table (internal/httpapi): method, path, tier, query, bodies and error codes. The table mounts the handlers and generates api/openapi.json, docs/api/routes.md and the browser SDK's sdk/ui/src/client/generated/{routes,wire,error-codes}.ts. After changing a route or a wire type, run go generate ./internal/contract; TestGeneratedContractIsFresh fails while a generated file is stale.

Documents are one per content item or entity and language. The engine's search job keeps them current from the dirty queue, renamed entities (expanded to their items in batches) and a bounded backfill; rejected documents are recorded in content_search_invalid until their source changes. Search, autocomplete and discovery apply eligibility before every bounded retrieval. Autocomplete matches literal substrings of an item's own title/name/aliases, with exact names and prefixes first. It does not suggest a gallery merely because an associated artist matches. Full search also uses contextual keywords and conservative one-edit typos. Search-only normalization ignores complete English filler words the, a and an; filler-only queries return no matches. Entity identity, aliases and slug normalization are unchanged.

A full-search score is a match tier: exact title 1, alias 0.9, name prefix 0.84–0.85, name substring 0.81–0.82, contextual/token matches 0.75–0.77, and typo 0.5–0.52. Queries are capped at 1 KiB, 256 characters, 16 tokens of at most 128 normalized characters and two seconds; typos are tried only in tokens of up to 16 characters. Each search document stores its normalized terms, so a bounded candidate window keeps the strongest name matches. A search sorted by newest, title or popularity orders every literal match; typo matches come from the nearest-distance window.

GET /v1/manage/search-suggestions (tier editor) is private quick navigation to editors. Explicitly request include_contents and/or include_entities, optionally limiting content_kinds / entity_kinds; limit defaults to 8 per section and is capped at 20. Current draft/held names and internal entities are matched only within the caller's management authority. display_language chooses labels while matching current names in every language. This API does not use body/associated-entity keywords, public reader filters or a results-page fallback. Separate current-name views and indexes serve it; approved/published search documents are unchanged.

Errors

Every module answers failures with one flat body. Branch on code; error is a human message and may change. A code's own members appear only with it (retry_after, action, ban, blobs, details). The codes and their statuses are listed in docs/api/routes.md.

{"error":"not found","code":"not_found"}

5xx bodies carry no cause: it goes to Options.Logger (slog.Default() when unset) with the request method, path, status and duration. Postgres constraint names, driver text and stack traces are logged, never served.

Access (access)

OpenRails owns products, prices, checkout, subscriptions, purchases and granted entitlements. ContentKit owns content and its access requirements. Applications compose OpenRails's product/price API and billing UI with ContentKit's content editor; no local offer catalog or billing synchronization jobs are involved. The same boundary applies to embedded and HTTP deployments.

A subscription-only app can restrict its content model to free and tier access:

content_kinds:
  gallery:
    # Other kind settings omitted.
    access_levels: [public, tier]
    comment_modes: [open]

The model is returned by /kinds and enforced on creation, updates, version overrides and imports. Allowed access levels are public, tier, ppv, group, group_ppv; an omitted list permits every level. Comment modes are open, closed, hidden. Tier names come from tiers; their products and prices are defined in OpenRails. channels.entitled: true exposes channel-membership standing, without defining a price or making every post paid. Changing the model does not rewrite existing access rules or billing products.

ContentKit defines stable entitlement keys; OpenRails grants them without interpreting their syntax:

Key Opens
access.ContentKey → <tenant>:content:<id> legacy audit/migration only; grants no edition access
access.VersionKey → <tenant>:content:<id>/<version> one version
access.ChannelKey → <tenant>:group:<id> channel-owned content whose parent policy requires that membership
access.TierKey → premium versions whose rule names that tier

Use these existing keys in an OpenRails product's entitlements. A product may grant several keys; its product key and its granted entitlements are separate concepts. OpenRails's required_entitlements can require a channel membership before a customer buys an individually gated item. Product/price edits report OpenRails errors directly. They do not first save local terms for later sync.

For example, after creating a ContentKit item, its authoring flow can create a native OpenRails product and price with the OpenRails Go client:

key, err := access.VersionKey(tenant, contentID, versionID)
if err != nil { return err }
product, err := billingClient.CreateProduct(ctx, billing.CreateProductParams{
    Key: "edition-" + versionID, DisplayName: title,
    Entitlements: []string{key.String()},
})
if err != nil { return err }
_, err = billingClient.CreatePrice(ctx, billing.CreatePriceParams{
    ProductID: product.ID, Key: "standard", UnitAmount: 5_000_000, Currency: "USD",
})
return err

Here billing is github.com/open-rails/openrails/billing; amounts are in millionths of a currency unit, so the example price is $5. The same calls work through the embedded or remote OpenRails client. Price history, retries and checkout are owned by OpenRails. A channel product uses access.ChannelKey instead, while a Premium product grants the configured tier key.

Rule is stored on content and, for channel-free kinds, optional version overrides. Channel posts share the overall item's policy. It is validated against the model and projected onto content_facets. Gate reads grants through access.Billing.Held; optional access.TenureReader supplies account statistics. Access decisions expose Sell entitlement keys and Requires as hints for the host's OpenRails checkout integration, never copied prices.

The host passes Deps.Billing (ckopenrails.Billing(client)); the gate is the engine's own. Each request reads entitlements once. Verified token claims can supply configured tiers; revocation then has the token's lifetime. Billing read failures fail closed for protected content, while public content remains readable. Truncated keyspace reads are settled with exact-key checks. GET /v1/me/library lists purchased content using the same authoritative grants and domain visibility boundary.

See the ownership decision.

Media

Media is an app-defined file system in the app's own private bucket. The bucket is the only record of an item's files: each item has one manifest, rewritten in place, and every file is named by the SHA-256 of its bytes in the area that decides who may read it. PostgreSQL keeps only a cache of the manifests, rebuilt from the bucket on demand. The app declares its kinds in one registry (media.Config); HOST_INTEGRATION "Media" covers the registry, commit ops, reads and exposure.

{kind}/{id}/manifest.json        the item's files; never served
           /internal/{sha256}    unreleased uploads and outputs; never served
           /private/{sha256}     released files, behind the item's token
           /public/{sha256}      covers, free pages; served to anyone
           /tmp/u-{uuid}         staged uploads; never served
           /tmp/w-{run}-{name}   a video encode's chunks until their rung is assembled; never served
{kind}/_default/                 the kind's default images, an item like any other
_accounts/{kind}/{id}/…          the tenant's account media (avatars) and their kind's _default, in the avatar primary's bucket

One bucket per app. The bucket is the tenancy boundary: no key names a tenant or an app, and two apps never share a bucket. The tenant and app IDs (Config.Scope) name database partitions and refs, never objects. A hosted deployment gives each tenant app its own bucket and S3 credentials. Top-level names starting with _ and work/ are reserved, so no kind takes them.

For versioned content, id is the version ID. Its parent content ID exists only in the database and has no media folder. Covers, pages and body images belong to the version. Domain APIs still use {kind, content, version} for authorization and relationships. Other kinds use their own item ID. Media URLs add /v1/ before the storage key.

GET /v1/contents/{id} reads the database-only parent and reports its selected default edition in selected_version_id. GET /v1/versions/{vid} reads a specific edition, returning the same parent detail with only that version. Shared entities remain in Content.entities; version-specific associations remain in Version.entities. Their effective set is the union, without copying shared memberships into each edition.

Config.Media is the registry (media.Config, without hooks) and how it is served; the engine builds the uploads, reads, cache, worker queue and jobs from it and Deps.Store. Every media item is ContentKit's: content kinds' through the catalog's resolver, entities', avatars' and, when the registry declares the poll kind, poll images.

The user-avatar kind comes from github.com/open-rails/contentkit/media/avatar; avatar.User() includes its upload rules and embedded default silhouette. An avatar's URL names its hash, so the API lists it beside what a person wrote (one cache read per response). media-worker publish-defaults renders every kind's default images into its _default item as part of deployment; reads and GET /v1/media/presets (default_image) show them for items without their own. An account kind's defaults are account media: the avatar primary publishes them into _accounts/{kind}/_default/ in its bucket and the tenant account cache (it needs DATABASE_URL and MEDIA_ACCOUNT_SCHEMA), from which every site shows them at its own media host.

Manifests. An edit reads the manifest with its ETag, applies its change and writes it back with If-Match (If-None-Match: * to create). A 412 re-reads and re-applies, so every change is a re-appliable delta that checks the state it changes; a commit's operation id and request digest are kept for the latest 32 commits, so a retried commit applies once and an id reused for another batch is refused. Each write raises rev and names its op. Files an edit stops referencing go to the manifest's retired list with a due time: 7 days for a replaced file (the undo window), an hour for a release's leftovers, at once for withdrawn, taken-down or erased files. An edit refuses to reference bytes the bucket does not hold, and a hash whose DELETE may still be in flight (GC marks it deleting with a conditional write before deleting, one attempt, and the mark settles two minutes). Reads are served from an in-process cache (an LRU bounded by bytes) at the revision content_media_items records; the bucket is asked only for a revision the process lacks. Writes always read the bucket. A 2,000-page gallery is about 1.5 MB of JSON and 400 KB stored; a 2-hour video about 5 KB, its segment tables living in index blobs. Every read and write stops at MaxManifestBytes (16 MiB of JSON). An item holds at most MaxUploads (10,000) uploads, an upload's meta at most 4 KiB of JSON and the item's 16 KiB; names are capped at 200 bytes of JSON.

The bucket must never have had versioning. On a bucket that ever had versioning, Ceph RGW checks If-Match apart from the write, so two writers can both land. s3.New never dials; register store.Check(ctx) as the host's optional S3 dependency probe. The first write probes the bucket's versioning and conditional PUT, and media writes are refused (ErrBucketVersioned, ErrConditionalPutRequired) unless it never had versioning and honours both conditions. A failed or cut-off probe records nothing, its write is media.ErrUnavailable and the next use probes again. An unreachable or 5xx bucket is media.ErrUnavailable: 503 unavailable over HTTP, and in media jobs a River snooze (not an attempt) while a fresh Check confirms the outage, capped by MaxOutageSnoozes. Recovery from deletes is the manifests' retired grace, not bucket versions.

Cache. content_media_items holds one row per item: its revision and ETag, processing status and public images, written forward-only by rev after every manifest write. It drives processing events, version facts, release and garbage-collection wakes, and listings' images. media-worker rebuild refills it from the bucket; a dropped table rebuilt this way serves the same lists.

Uploads go straight to the bucket, to a staged name: up to 64 MiB is one PUT to tmp/u-{uuid} signed with its type, length and SHA-256, larger files are multipart (8–16 MiB parts, each signed with its length and SHA-256, resumed through ListParts, completed by the server from a signed ticket; nothing is stored). The browser's hash only finds identical bytes the item already holds (no upload). After the commit, the worker's place job hashes each staged upload and writes it under its hash: internal/ for a version (until its release), private/ for other kinds. The upload limiter rate-limits uploaders; there is no storage quota.

Release is a move. A version's uploads and outputs wait in internal/. Its release job (one per version, woken by every catalog change and manifest write, snoozed until the next chapter or audience deadline) changes nothing while the version's uploads still process (a release is all or nothing); otherwise it copies what is now released to private/ (public/ for a free version's pages and a locked version's preview pages), writes the manifest naming the copies, and retires the internal/ copies. A crash anywhere re-runs from the manifest: copies are idempotent, and until the manifest switches readers see the old areas complete. Withdrawal is the same move back; a withdrawn file's served copy is deleted at once; putting it back before GC marked it takes it out of retired, and after that waits only until the delete has settled (two minutes). Areas are decided per file: pages with identical bytes in different chapters reference the same hash in different areas. Public preset outputs (covers) are always in public/; a HostOnly preset's stay in internal/. Originals never move: downloads read them in internal/.

Garbage collection (contentkit_media_gc, one River job per item) deletes only what the manifest retired: entries past their due time are first marked deleting (fencing re-reference), deleted, and dropped once the DELETE has settled. After a write it lists the item's folder once for orphans older than a day (a crashed writer's), which the manifest does not name. Nothing else lists the bucket.

Media gateway (cmd/media-gateway, media/gateway, image ghcr.io/open-rails/contentkit-media-gateway:{tag}) reads no manifest or database. It serves each media host's bucket: public/ to anyone and private/ with the item's token, bound to the bucket and carried by the mt cookie path-scoped to that item's private/ (or ?t= for applications); internal/, tmp/ and the manifest are never served. Served names are hashes, so every answer is max-age=31536000, immutable (private ones add CDN-Cache-Control: no-store, and every answer Referrer-Policy: no-referrer). ?dl={name} serves the file as a download under that name when it has the file's type. A soft-deleted or erased item's reserved public/_contentkit_erased fence refuses all of its files, checked with one HEAD per read. Everything else and every denial is one no-store 404. It keeps no state: rate limit the media host at the ingress; the read API limits the items a viewer opens per hour (ReaderOptions.Issuance). It needs MEDIA_GATEWAY_S3_ENDPOINT, a key reading only */private/* and */public/*, MEDIA_GATEWAY_TOKEN_KEY and _TOKEN_KEY_PREVIOUS, and MEDIA_GATEWAY_ROUTES (a JSON list of {host, bucket, accounts, origins}, one per media host: its app's bucket and, in accounts, the bucket holding the tenant's _accounts/ media, the avatar primary's).

The media worker (media/worker) runs every producer from the host's worker River schema (MEDIA_WORKER_SCHEMA, per host: hosts sharing a database never share one): images, public presets and editor views (libvips) and HLS, subtitles and frames (ffmpeg). The host presigns, commits and reads through the engine: hosts link no codecs and need no ffmpeg, so they build with CGO_ENABLED=0 (CI checks every package but internal/media/{image,video}, media/worker and cmd/media-worker). The editor's poster picker decodes the encoded video in the browser. The stock build (cmd/media-worker, image ghcr.io/open-rails/contentkit-media-worker) needs only the registry as JSON (MEDIA_KINDS_FILE): an engine's is Config.MediaRegistry(), which contentkit media-config -config contentkit.yaml prints. Every host runs this image, or one of its own whose binary is media/worker.Main with its master hooks; MigratePostgres migrates its queue. Its subcommands are publish-defaults and rebuild.

It never exits for a missing dependency: Run takes no jobs until the bucket answers, and MEDIA_METRICS_ADDR serves /livez, /readyz, /statusz and app_dependency_up with /metrics. With Config.Metrics, the worker leading its River schema also exports the queue backlog (media_video_jobs, media_video_tenant_backlog, ...); hosts collect none.

Images (media/image, CGO over libvips): WebP at each Image spec (inside or cover box, quality), through the upload's edit (crop in EXIF-oriented source pixels, then a clockwise quarter rotation); nothing is upscaled: a cover box larger than its source renders the source's largest centred crop at the box's aspect. GIF and WebP animations keep every frame, delay and loop count; MaxPixels (100 MP over all frames, lowered per upload by Upload.MaxPixels; avatars 25 MP), MaxFrames (1000) and MaxAnimationSeconds (60) bound sources, every rendering is checked against the same pixel bound (frames × output area) before it decodes, and a stored source over its Upload's MaxBytes is refused unread. A JPEG or WebP still rendered small decodes at a fraction of its size. Uploads feeding image presets take only media.ImageTypes (JPEG, PNG, WebP, GIF, AVIF, HEIF, TIFF), the declared type binds the decoder, and every other libvips loader is blocked (libvips 8.13 or later). A source-format preset's unchanged copy drops the upload's metadata (EXIF, XMP, IPTC, comments, trailing data) without re-encoding, keeping its orientation and colour profile; Image.KeepMetadata keeps it, and is required for AVIF, HEIF and TIFF sources. Public presets render every width through the same spec (a width past the edited image at its width). Re-deriving unchanged outputs writes nothing: the same bytes have the same name.

A private image preset can instead use Format: media.ImageFormatSource to retain the upload's format. With no edit and an inside fit, files already inside the configured box keep their exact pixels, without their metadata unless KeepMetadata is set; zero dimensions leave that side unbounded. Width: 6000, Height: 6000 proportionally limits the longest edge to 6,000 pixels without cropping or enlarging. Only an oversized or edited image is re-encoded. A reader kind's Publish.Download names such a HostOnly preset: the ZIP then carries a page's bounded rendition in place of an oversized original.

Masters. An upload has three roles in its manifest: the original (as uploaded, never modified), its master (what a release serves and downloads carry) and its renditions, which derive from the master and record its hash (input) beside their spec fingerprint. A kind's master recipe is a chain of host hooks (media.MasterHook: straightening, contrast, a GPU upscaler) run by the media worker on each image and video upload; a host passes them to its own worker binary (worker.Main(hooks...)), and a worker missing a recipe's hook, or at another version, refuses to start; each master records the recipe's hooks, versions, parameters and fingerprint. The default, the identity recipe, makes the original the master: the manifest names the original's hash and nothing else is stored, copied or moved. Only a hook that changes pixels stores a master of its own, lossless (WebP lossless, PNG past 16,383 px, FFV1 in Matroska), which a release moves to private/ with its version. A failing hook keeps the upload's previous master and renditions, so the release is unchanged. contentkit regenerate -kind K [-id ID]… (Engine.RegenerateMedia) queues the worker over a kind's items after a deploy changed a recipe or a rendition's spec: masters whose recipe changed are made again, then renditions whose master or spec changed (for a video its HLS renditions, sprite and grabbed frames with theirs), each published as a manifest revision with what it replaced retired; current items write nothing, so it can be re-run.

Downloads. A kind's Download serves pages (the readers' default) or original (the players'), always the masters, read by the API where they are stored (the originals in internal/ under the identity recipe). A pages download is a ZIP streamed in reading order: stored entries without timestamps, so its bytes depend only on its entries. Unwatermarked, the same revision is byte-identical on every request, with an exact Content-Length, an ETag of that revision and byte ranges, cached privately under the viewer's ticket. A ZIP the host's policy watermarks (DownloadPolicy.Mark) is marked and zipped anew for every request and is never cached: Cache-Control: private, no-store and CDN-Cache-Control: no-store, with no length, validator or ranges. Each transfer repeats current visibility, access, chapter-release and host-policy checks, and refuses stale tickets: a version deleted or hidden from its viewer is 404 at once, never 202 pending, and a restore reopens an unexpired ticket. An original download streams the video's master (its original, by default) as {title} plus its extension, with its length, ETag and ranges. Downloads are charged to the viewer's download quota (media.downloads).

Reader page identity is the SHA-256 digest of the original source image. FileInfo.page_id and reader-plan page id expose that digest; logical names are display/path metadata. The manifest's ordered source list determines page positions and ZIP entry order. Reader metadata and chapter starts refer to source hashes. Upload commits remain asynchronous: a staged file has no verified page_id until placement finishes. Wait for placement before saving reader metadata or chapter starts that reference that source; a filename is not a fallback ID.

Directories organize a version's pages into named, nested folders the reader browses as a small file system (HOST_INTEGRATION "Directories"). They live in the version's manifest and carry nothing of their own: the version's access, publication and engagement govern every page in them. The manifest keeps the pages in the tree's reading order, a directory's own pages before its subdirectories', so chapters, previews, positions, progress and downloads all read through the directories in that order. The directory and remove_directory commit ops edit them, dir files a page; the reader plan lists each directory's page range, the ZIP download lays the pages out in their folders, and an uploaded ZIP's folders become directories.

Reader chapters accept start_page and derive their end from the next start, or the end of the version. Inserting or reordering unmarked pages does not require renumbering markers. Missing, duplicated or out-of-order starts require repair. Chapters are metadata: their boundaries, names and release dates move no files beyond the release's move of the pages they open. A locked version's free preview pages (its rule's preview, else its kind's) are released to public/, listed in the reader plan as plain, cacheable URLs; scheduled chapters never contribute preview pages before they release. Media reads accept up to 64 repeated path query parameters to sign the selected permitted files without changing their manifest order. The SDK batches larger selections and refreshes active grants before expiry.

Video (media/video): the contentkit_media_derivatives job on media_derivatives owns planning and conversion. It checkpoints bounded encoded ranges, yields between them so shorter videos can run, and resumes successful ranges after shutdown. An HLS preset encodes the ladder (rung = short side, default 2160/1080/480, none above the source) in each of the worker's codecs (MEDIA_WORKER_CODECS, default av1,h264), plus AAC per audio track, WebVTT per text subtitle and a seek sprite. An HDR source (PQ or HLG) keeps its range in 10-bit AV1 with its HDR10 metadata; its H.264 rungs, sprite and frames are tone-mapped to BT.709 SDR, and master playlists label each variant's VIDEO-RANGE. Each rendition is one byte-range fMP4 blob whose segment table is its own index blob; a compliant top rung is stream-copied, and sources outside the aspect bounds fail with video_aspect_unsupported. Subtitles converts SRT and SSA/ASS to clean WebVTT. Playlists are built per request by the read API, with the worker queue's encode progress. The original is kept as uploaded and is what a download serves.

Audio attachments are played as uploaded after verified placement, with no conversion job. A reader kind's Publish.Playback names its audio upload pattern, such as audio/{name}; page cues keep the same track names. The release moves declared audio with the pages. Audio tracks inside a movie still belong to its video conversion.

Deletion and erasure. Soft deletion records the deletion in the manifest and writes the gateway fence at once; files are kept, and restore removes the fence. Erasure writes the permanent fence, then an empty manifest whose files are all retired and due, and deletes everything else in the item's folder; GC deletes any late write. What is left in tmp/ (staged uploads, a killed encode's chunks) expires by bucket lifecycle (s3.Store.Configure: seven-day tmp/ expiration and incomplete-multipart abort, preserving other applications' rules).

Paywalls: media gates each item through the engine's access rules. A version's private/ holds only released files, so an item token opens what has been released until it expires; originals of readers' pages stay in internal/ outside the ZIP download.

Browser package (sdk/ui, @openrails/contentkit-ui on npm, one version per release): the client (uploads, commit ops, reads, waitFor, frames, HLS), content URLs, React hooks and styled components. See sdk/ui/README.md.

Entities

Entity kinds come from kinds.Config.EntityKinds (ordered, parent, scoped_by, version_level, roles, attributes, artist). They describe content; channel ownership and authority are configured separately with channels and a content kind's channel policy. See Posts and channels for fixed staff blogs, creator feeds and reposts.

A public listing of one kind defaults to sort=popular: the sum of its contents' popularity on the site over window. artist: true marks the kinds that name who made the content: similar lists weigh a shared artist and their cards show a read-through rate. See Popularity.

Reader editors use one page per stable version code. Shared entity edits use PUT /contents/{id}/entities/shared; per-version credits use PUT /contents/{id}/versions/{vid}/entities. Catalog responses keep the same separation: Content.entities contains shared associations only, while each Version.entities contains that version's own associations. The UI SDK's entitiesForVersion(content, version) combines and deduplicates the two for public display without mixing credits from sibling versions. These routes replace only their own scope in a transaction, including newly created entity names, and preserve sibling versions. The older all-scopes entity replacement remains available for imports and callers deliberately replacing the entire work.

Keyword documents include active associations and their active ancestors. Writes refresh association facets in the same transaction. Entity counts and automatic entity covers read current facets and release timestamps; no periodic recount or timed-membership job is needed. Manual entity covers remain explicit. Likes and favorites keep their existing atomic counters.

Entity writes record entity.* events on the catalog event log. Merging or deleting an entity a host links to is allowed; hosts repair their links from GET /v1/manage/entities?ids=, GET /v1/manage/entities/match and the events. A deleted entity's avatar and cover are unavailable to everyone until it is restored: after the write commits, the same request writes its item's deletion fence and the gateway answers 404; no bytes move. A failure after the commit is reported, and retrying the same write or import completes it. Purge makes the fence permanent and erases the files.

The engine builds separate entity and channel interfaces from Config.Content. Metadata operations use /entities; channel operations use /channels. Channels retain their editor teams and optional billing entitlements. Their lifecycle operations call AuthKit directly, report failures and support idempotent caller retries. No entity/channel sync worker is registered. Physical deletion stays with the content-purge sweep. Ordinary tags and series need no lifecycle work beyond their media fence. One primary channel governs the overall item and all of its versions; a repost only references that original from another channel and grants no editing rights.

Channel access uses access.ChannelLevel, access.ChannelPPV and access.Rule.ChannelID. Its existing JSON field group_id, access values group/group_ppv, and opaque billing keys containing :group: keep their encodings so saved policies, frozen plans and purchases retain their identities. These are channel membership rules, not permission granted by descriptive tags.

Content and versions

An overall item holds shared identity, its primary channel/editorial authority, creators and inherited entity associations. Every edition owns its authored title, summary, body/HTML, language, original title and media. An English gallery and a Chinese edition can use completely different image bytes while inheriting the same artist/series/tag associations. Each edition can add its own associations.

Create initial editions through ContentInput.Versions and edit their text/media through the version interface. Omitting initial versions creates one empty edition; adding another version starts empty. There is no automatic body-image propagation or copy-version operation. Reader Content and discovery cards project the selected edition's presentation, identified by selected_version_id; that convenience does not put content back onto the parent or borrow a sibling's text/files. See import and migration.

The catalog (internal/catalogstore) owns content items of the kinds in Config.Content.Kinds. Writes are batches; each transaction keeps content_facets current (rules through access.Rule.Facet, entities through EffectiveEntities), marks search documents dirty, queues content_events and calls media (republish, delete). Content edits do not rename or reprice billing products. Published with a future publish_at is publication intent; readers see the completed release after its deadline and required media preparation finish. A deleted item is unavailable to everyone, buyers included: reads hide it and the media gateway answers 404 for its files at once. Restoring reopens it to the same purchases; otherwise its media is erased after DeletedRetention. OpenRails retains product and purchase identity after content and media are gone; deleting content does not delete billing history. A product can grant multiple entitlements, so content deletion does not implicitly archive products or cancel subscriptions. Hosts explicitly retire affected products in OpenRails before deleting their last purchasable target.

The Viewer is the one visibility rule: published content whose release time has arrived, the domain's scope and the viewer's content filters. Every published item can be listed; its edition's access rule controls reading. It uses access.Filter.SQL for lists and Gate.Decide for items; staff (root:content:view-restricted), creators and primary-channel editors see everything. Discovery lists and searches under it; media and interactions resolve through it. Held text goes to the shared review queue, screened by Deps.Moderator. GET /v1/catalog/totals (kinds, languages) counts what anyone and each tier opens, per kind and language; a sibling deployment reads it with contentkit.NewClient(baseURL, nil).GetCatalogTotals(ctx, contentkit.GetCatalogTotalsQuery{Kinds, Languages}). Each process caches a count per site and kind: it reloads in the background after ten minutes, and the last good count serves for up to a day while reloads fail.

Content jobs use contentkit_content_* River kinds. Their previous contentkit_catalog_* kinds remain dispatch aliases, and the queue route stays contentkit_catalog so already queued jobs can drain. The Go package remains catalog; OpenRails uses catalog for its products and prices.

During deployment, keep old workers away from newly named jobs: stop the old fleet before starting the new one, or first deploy workers that recognize both names while producers still use the old names. River fetches unknown kinds by default, so overlapping old and new fleets can fail new jobs. Rollback has the same constraint: drain newly named jobs or retain workers that recognize them.

Content filters form one app-scoped entity layer across explicit applies_to content kinds. Domains define their offered toggles and defaults; require_entities independently scopes hard requirements by kind. One saved entity choice affects galleries and posts together. Public browsing, including staff browsing, honors optional choices; authorized management keeps its visibility. Fixed and required domain rules also constrain direct access. kinds.DecodeContentFilters strictly reads an embedded app's policy block.

Analytics and discovery

ClickHouse holds the activity log; PostgreSQL holds each reader's reading state and history. Product pages read only PostgreSQL. See docs/analytics.md.

  • The browser reports open and progress (POST /v1/activity); the server logs reactions, favorites, hides and searches where they happen. A row's subject is the account, else the browser's anonymous id (ContentKit-Anonymous-Id).
  • Each process buffers rows and writes them every second as one async INSERT.
  • The analytics job (every 15 minutes) folds new rows into reading_state and interaction_history and sign-in links into the account, rebuilds today's content_daily and audience_daily hourly, and deletes erased rows daily.
  • History, continue reading, card progress, view_status and hidden galleries read reading_state; hiding (PUT /v1/contents/{id}/hidden) is immediate.
  • AnonymizeAccount deletes the account's reading and fences its rows; see account lifecycle.
  • Popularity is quality-weighted person-days from content_daily, per site, over featured windows (week, 30d, 90d, year, all, today included), calendar months and years, or ranges of days; no decay. See Popularity.
  • Similar lists share the anchor's most specific entities and its artist; see discovery candidates.

Testing

The replacement public-contract suite is in tests/critical. It uses real AuthKit, OpenRails, PostgreSQL, ClickHouse, S3, media workers and the built browser SDK. Configure owned disposable services as documented there.

python3 tests/critical/run.py --race

The runner fails on missing fixtures, skipped or missing selected cases, zero executions, or incomplete scenario/operation review. This draft replacement is still incomplete; focused development runs are explicitly partial evidence. Features merge into the open release candidate (rc/<version>, named in OPEN.md), the candidate merges into master, and a release is a tag on master. CI runs on ready PRs only: light build, type and static checks into a release candidate, every suite once for the candidate's PR into master. Ordinary source pushes run nothing. See docs/ci.md.

Previously observed backend capabilities (not replacement-suite qualification):

Backend Conditional PUT SHA-256 enforced Notes
MinIO RELEASE.2025-09-07 yes yes drops AbortIncompleteMultipartUpload (expires uploads itself)
Ceph 19.2 / 20.2 standalone dbstore RGW no no wrong Range bytes; not representative of RADOS-backed RGW
production Ceph RGW (RADOS, 2026-09-24) no (If-Match yes, If-None-Match: * ignored) no Range, response-content-disposition, versioning, lifecycle (incl. AbortIncompleteMultipartUpload) and multipart work; hosts wire PGLocker

AuthKit owns user inboxes and their UI. ContentKit publishes or withdraws native comment notices through its injected two-method publisher. See notifications for source identities and publisher configuration.

Documentation

Overview

Package contentkit is ContentKit running in this process: the content library a host configures and mounts, as it does OpenRails and AuthKit.

ck, err := contentkit.New(ctx, cfg, deps)  // validates or migrates its schema
err = ck.Start(ctx)                        // serve: enqueue jobs on its own River
err = ck.StartJobs(ctx)                    // in the process that works jobs
routes, err := ck.Routes(contentkit.Routes{Prefix: "/api/contentkit", Entities: contentkit.AllRoutes})

The routes, the Go client (Client) and Ready, Probes and Close are the whole surface: hosts never read or write ContentKit's storage.

Index

Constants

View Source
const (
	// CodeAnimationNotAllowed (422): An animated image where the upload path refuses animation.
	CodeAnimationNotAllowed = "animation_not_allowed"
	// CodeAnimationTooLong (422): The animation has more frames or seconds than the processor allows.
	CodeAnimationTooLong = "animation_too_long"
	// CodeAnimationUnsupported (415): An AVIF or HEIF image sequence, which is decoded as one frame.
	CodeAnimationUnsupported = "animation_unsupported"
	// CodeChecksumMismatch (422): The stored bytes differ from the declared SHA-256.
	CodeChecksumMismatch = "checksum_mismatch"
	// CodeCommentBanned (403): The actor is banned from commenting on this target; `ban` says the scope, the reason and when it ends.
	CodeCommentBanned = "comment_banned"
	// CodeCommentModerated (403): The comment is held for review or was rejected, so its author can't edit it; a reviewer's approval makes a held one editable again.
	CodeCommentModerated = "comment_moderated"
	// CodeCommentTooLong (422): The comment is longer than the site allows; `details.max` is the limit in characters.
	CodeCommentTooLong = "comment_too_long"
	// CodeCommentsClosed (403): The target's comments are closed or hidden: existing ones may show, new ones and edits are refused.
	CodeCommentsClosed = "comments_closed"
	// CodeCommentsLocked (403): The actor can't open the content (or the comment's version), so its comments take no writes from them; reads withhold them.
	CodeCommentsLocked = "comments_locked"
	// CodeConflict (409): A concurrent change, a path or slug already taken, or an operation id already used for another commit.
	CodeConflict = "conflict"
	// CodeDownloadUnavailable (403): The host's download policy refuses this download now: `reason` is its code, `available_at` when it opens if a matter of time. Nothing was charged.
	CodeDownloadUnavailable = "download_unavailable"
	// CodeDuplicateComment (422): An identical comment was already saved in the configured duplicate window.
	CodeDuplicateComment = "duplicate_comment"
	// CodeEventCursorExpired (410): The event cursor predates retained history or names a reset stream; resync current state before continuing.
	CodeEventCursorExpired = "event_cursor_expired"
	// CodeForbidden (403): The actor may not do this.
	CodeForbidden = "forbidden"
	// CodeGone (410): The content was removed.
	CodeGone = "gone"
	// CodeImageTooLarge (413): The image has more pixels or frames than the processor decodes.
	CodeImageTooLarge = "image_too_large"
	// CodeImageTooSmall (422): The edited image is narrower than its public preset's minimum width.
	CodeImageTooSmall = "image_too_small"
	// CodeImageUnreadable (422): The file is not a decodable image of its declared type.
	CodeImageUnreadable = "image_unreadable"
	// CodeIncomplete (409): A multipart upload is missing parts.
	CodeIncomplete = "incomplete"
	// CodeInternalError (500): A server fault; the cause is in the server log.
	CodeInternalError = "internal_error"
	// CodeInvalidRequest (400): The request is malformed: its body, a query parameter or a path value.
	CodeInvalidRequest = "invalid_request"
	// CodeLimitReached (409): The owner already has as many groups of the kind as the site allows (max_per_owner).
	CodeLimitReached = "limit_reached"
	// CodeModerationRejected (422): The moderator refused the text; `error` says why.
	CodeModerationRejected = "moderation_rejected"
	// CodeNoDownload (409): The version has no file its kind's download serves: nothing uploaded, or its upload failed or was dropped.
	CodeNoDownload = "no_download"
	// CodeNotConfigured (501): The capability needs a port the host did not configure; retrying does not help.
	CodeNotConfigured = "not_configured"
	// CodeNotFound (404): Nothing by that name, or nothing the actor may see.
	CodeNotFound = "not_found"
	// CodeNotJoinable (409): The group has no free offer to join: it sells its membership, or nothing.
	CodeNotJoinable = "not_joinable"
	// CodeNotReady (409): A version that would go live still has files processing or a publication not yet current; `error` says what. Retry once processing finishes.
	CodeNotReady = "not_ready"
	// CodeNotUploaded (409): A commit names an upload that has not landed; `blobs` lists the ones to upload again.
	CodeNotUploaded = "not_uploaded"
	// CodeRateLimited (429): Too many requests; retry after `retry_after` seconds (also the Retry-After header).
	CodeRateLimited = "rate_limited"
	// CodeTenantMismatch (500): A host port answered with another tenant's data: a configuration fault.
	CodeTenantMismatch = "tenant_mismatch"
	// CodeTooLarge (413): The file is larger than its upload path allows; `details` has `size` and `max_bytes`.
	CodeTooLarge = "too_large"
	// CodeTooManyFiles (409): The commit would put more files in an upload path, or the item, than allowed; `details.max` is the limit.
	CodeTooManyFiles = "too_many_files"
	// CodeTypeNotAllowed (415): The file type is not allowed in the upload path; `details.allowed` lists the types.
	CodeTypeNotAllowed = "type_not_allowed"
	// CodeUnauthorized (401): The request needs a valid credential: it has none where the route needs one, or one that is expired, revoked or invalid. WWW-Authenticate says which.
	CodeUnauthorized = "unauthorized"
	// CodeUnavailable (503): The host's auth, media storage or signal plane cannot be reached, or a commit's recovery is pending; retry.
	CodeUnavailable = "unavailable"
	// CodeUpgradeRequired (503): The media item's publication is being restored and becomes readable when the restore finishes; retry later.
	CodeUpgradeRequired = "upgrade_required"
	// CodeVideoAspectUnsupported (422): The video's display aspect is outside what its upload path accepts; `details` has `min_aspect` and `max_aspect` (width/height).
	CodeVideoAspectUnsupported = "video_aspect_unsupported"
	// CodeVideoOverBudget (422): The planned encode costs more than its upload path allows, or the source averages under a frame a second.
	CodeVideoOverBudget = "video_over_budget"
	// CodeVideoTooLarge (422): The video's frames are larger than its upload path allows.
	CodeVideoTooLarge = "video_too_large"
	// CodeVideoTooLong (422): The video or audio runs longer than its upload path allows.
	CodeVideoTooLong = "video_too_long"
)

Error.Code is one of these; docs/api/routes.md lists each route's.

View Source
const DefaultAnonymousRetention = 30 * 24 * time.Hour

DefaultAnonymousRetention is Config.AnonymousRetention's zero value.

View Source
const DefaultSchema = "contentkit"

DefaultSchema is Config.Database.Schema's default.

Variables

View Source
var ErrAvatarPlacement = errors.New("contentkit: tenant avatar primary placement conflicts")

ErrAvatarPlacement prevents independent app deployments from becoming competing writers to a tenant's one avatar manifest space.

View Source
var ErrErasureReplayRequired = errors.New("contentkit: erasure replay required; run tools replay-content-erasures before serving restored content")
View Source
var ErrMigrationsRequired = errors.New("contentkit: database migrations required")

ErrMigrationsRequired means a read-only startup check found storage that the host's explicit migration command must prepare before serving this version.

View Source
var ErrScopeConflict = errors.New("contentkit: app ownership binding conflicts with configured scope")

ErrScopeConflict means a catalog key or app is already bound differently.

View Source
var ErrSignalPlaneRequired = errors.New("contentkit: this app's signal plane is provisioned; configure ClickHouse to finish account erasure")

ErrSignalPlaneRequired keeps an account erasure pending on an engine without a signal plane when the app's plane was provisioned (MigrateClickHouse): its activity log still holds the account.

Functions

func MigrateClickHouse added in v0.89.0

func MigrateClickHouse(ctx context.Context, pool *pgxpool.Pool, cfg Config) error

MigrateClickHouse creates the configured signal database before applying its schema, then records in PostgreSQL that this app has a signal plane: from then on an engine without one keeps account erasures pending (ErrSignalPlaneRequired). pool is PostgreSQL's migration-ledger pool, not a ClickHouse runtime connection; MigratePostgres runs first. It is a no-op when ClickHouse is entirely unconfigured.

func MigratePostgres added in v0.89.0

func MigratePostgres(ctx context.Context, pool *pgxpool.Pool, cfg Config, options ...MigrationOptions) error

MigratePostgres prepares all configured ContentKit PostgreSQL storage and records the configured scope binding. Call it from a host migration command, before New with Database.SkipMigrations=true. The flag never skips this explicit operation. Configured fixed owners and their authorization groups are provisioned using options.Scopes; no runtime or object-store client is started. The caller retains ownership of pool. The account inbox is AuthKit's, made by its Migrate; ContentKit neither migrates nor reads it.

Types

type AccountMediaStorage added in v0.89.0

type AccountMediaStorage struct{ Schema, WorkerSchema string }

AccountMediaStorage identifies the tenant account service's durable media state and processing queue. Paths and schemas are derived, never supplied by an upload request. A secondary forwards writes and owns neither queue.

type AccountsConfig added in v0.89.0

type AccountsConfig struct {
	Schema  string         `json:"schema" yaml:"schema"`
	Avatars *AvatarsConfig `json:"avatars,omitempty" yaml:"avatars,omitempty"`
}

AccountsConfig selects the shared tenant account storage and avatar service. Catalogs remain app-owned. Schema holds account metadata and the tenant avatar journal, allocations and publication metadata. The engine derives the account key from Scope.TenantID.

type AppID added in v0.89.0

type AppID uuid.UUID

AppID identifies one tenant-owned catalog and its app-specific activity.

func NewAppID added in v0.89.0

func NewAppID() AppID

func ParseAppID added in v0.89.0

func ParseAppID(s string) (AppID, error)

ParseAppID accepts a nonzero canonical lowercase UUID.

func (AppID) IsZero added in v0.89.0

func (id AppID) IsZero() bool

func (AppID) MarshalText added in v0.89.0

func (id AppID) MarshalText() ([]byte, error)

func (AppID) String added in v0.89.0

func (id AppID) String() string

func (*AppID) UnmarshalText added in v0.89.0

func (id *AppID) UnmarshalText(text []byte) error

type Authorization added in v0.89.0

type Authorization interface {
	ResolveActor(ctx context.Context, scope Scope, verified auth.Verified) (string, error)
	Authorize(ctx context.Context, scope Scope, verified auth.Verified, target PermissionTarget) (bool, error)
}

Authorization binds a verified credential to one tenant and app. AuthKit (or the host's identity provider) remains responsible for credentials and live sessions. This interface never receives an unverified request identity.

Implementations must reject foreign issuers and credentials bound to another app. ResolveActor returns the stable source actor for audit. Implementations admitting cross-tenant operators must also implement TenantAccountAuthorization so a source actor never becomes an implicit target-tenant audience account. Ordinary accounts need no app registration or membership record.

Authorize checks effective authority for the explicit target tenant/app, including the provider's registered root grants. A channel grant must belong to this app. Preserve credential ceilings, revocation and binding. Errors never authorize an operation. Implementations must be concurrent-safe.

type AvatarsConfig added in v0.86.0

type AvatarsConfig struct {
	// Kind is the avatar kind; nil is avatar.User() (accounts/user).
	Kind *media.Kind `yaml:"kind" json:"kind"`
	// Preset is the kind's public preset people are shown with; empty is
	// "avatar".
	Preset string `yaml:"preset" json:"preset"`
	// Primary is the primary's ContentKit API base, as its routes are
	// mounted ("https://doujins.dev/api/v1/contentkit"); empty: this engine
	// is the primary.
	Primary string `yaml:"primary" json:"primary"`
	// Key is an API key of the primary's auth holding root:avatars:write
	// (access.AvatarsWrite). A secret: the server reads it from the
	// environment. Required with Primary.
	Key string `yaml:"key" json:"key"`
}

AvatarsConfig is people's avatars, keyed by the auth subject and shown beside comment authors and in moderation lists from the tenant account item cache, else the kind's default. Of the sites sharing an account store, one holds them and the defaults: the primary. Another sets Primary and keeps none: its people's avatar uploads, edits and editor reads go to the primary with Key, its media host serves the primary's files (its gateway Route's accounts names the primary's bucket, where they are under _accounts/), and the primary's AnonymizeAccount erases them.

type ClickHouseConfig added in v0.81.0

type ClickHouseConfig struct {
	// Database is the signal plane's dedicated database; required with
	// Deps.ClickHouse or Addr.
	Database string `yaml:"database" json:"database"`
	// Addr (native protocol, "clickhouse:9000"), Username and Password let
	// New apply the signal plane's migrations, and open the connection when
	// Deps.ClickHouse is nil. Without Addr, New only checks the schema.
	Addr     string `yaml:"addr" json:"addr"`
	Username string `yaml:"username" json:"username"`
	Password string `yaml:"password" json:"password"`
	// Cluster runs DDL and account-anonymization synchronization on the whole
	// signal replica set. It must cover one complete shard; pooled connections
	// must route only to replicas of that shard.
	Cluster string `yaml:"cluster" json:"cluster"`
	// TLS connects to Addr over TLS (ClickHouse's secure native port,
	// usually 9440), verifying the server against the system roots or
	// CAFile. Without it the password crosses in clear: keep a plain
	// connection on a private network.
	TLS bool `yaml:"tls" json:"tls"`
	// CAFile is a PEM file of the CAs that sign the server's certificate;
	// it needs TLS.
	CAFile string `yaml:"ca_file" json:"ca_file"`
}

ClickHouseConfig is the signal plane's ClickHouse database.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the typed Go client of the HTTP surface: one method per route (client_gen.go, generated from the route catalog), named by its verb and path (PATCH /v1/entities/{id} is PatchEntity). Engine.Client makes one over the in-process transport, acting as the host; NewClient one for a remote ContentKit. It is safe for concurrent use.

func NewClient

func NewClient(base string, hc *http.Client) *Client

NewClient is a client of the ContentKit served at base, the host's prefix ("https://example.com/api/contentkit"). hc carries the caller's credentials (its Transport sets Authorization); nil is http.DefaultClient, anonymous.

base must be https, or http to a loopback host: a call to another plain http base fails without sending anything. Redirects are never followed, so a credential never leaves base; a 3xx answer is an *Error.

func (*Client) DeleteChannel added in v0.131.0

func (c *Client) DeleteChannel(ctx context.Context, id string) error

DeleteChannel is DELETE /v1/channels/{id} (editor). Soft-deletes the channel and synchronously closes its media to everyone and retires its authoring group and original content; restoring reopens them, and purge erases its media after the deletion retention.

func (*Client) DeleteChannelCommentBan added in v0.131.0

func (c *Client) DeleteChannelCommentBan(ctx context.Context, id string, user string) error

DeleteChannelCommentBan is DELETE /v1/channels/{id}/comment-bans/{user} (editor). Lifts a user's ban on a user-owned group and its content.

func (*Client) DeleteChannelFavorite added in v0.131.0

func (c *Client) DeleteChannelFavorite(ctx context.Context, id string) (content.FavoriteState, error)

DeleteChannelFavorite is DELETE /v1/channels/{id}/favorite (user). Unfavorites a channel, also one no longer visible. Answers the state with its favorite count.

func (*Client) DeleteChannelReaction added in v0.131.0

func (c *Client) DeleteChannelReaction(ctx context.Context, id string) (content.ReactionCounts, error)

DeleteChannelReaction is DELETE /v1/channels/{id}/reaction (public). Clears the caller's reaction to a channel.

func (*Client) DeleteChannelRepost added in v0.131.0

func (c *Client) DeleteChannelRepost(ctx context.Context, id string, contentId string) error

DeleteChannelRepost is DELETE /v1/channels/{id}/reposts/{content_id} (editor). Removes only the destination repost reference. Requires destination editorship or the original reposter's current posting permission.

func (*Client) DeleteComment added in v0.81.0

func (c *Client) DeleteComment(ctx context.Context, cid string) error

DeleteComment is DELETE /v1/comments/{cid} (public). Deletes a comment, leaving a tombstone: its author, or a root:comments:moderate holder.

func (*Client) DeleteCommentBan added in v0.81.0

func (c *Client) DeleteCommentBan(ctx context.Context, user string) error

DeleteCommentBan is DELETE /v1/comment-bans/{user} (user). Lifts the caller's ban on a user.

func (*Client) DeleteCommentReaction added in v0.81.0

func (c *Client) DeleteCommentReaction(ctx context.Context, cid string) (content.ReactionCounts, error)

DeleteCommentReaction is DELETE /v1/comments/{cid}/reaction (public). Clears the caller's reaction to a comment.

func (*Client) DeleteContentFavorite added in v0.81.0

func (c *Client) DeleteContentFavorite(ctx context.Context, id string, q DeleteContentFavoriteQuery) (content.FavoriteState, error)

DeleteContentFavorite is DELETE /v1/contents/{id}/favorite (user). Unfavorites a content item or one of its versions, also one no longer visible. Answers the state with its favorite count.

func (*Client) DeleteContentHidden added in v0.141.0

func (c *Client) DeleteContentHidden(ctx context.Context, id string) error

DeleteContentHidden is DELETE /v1/contents/{id}/hidden (public). Shows a hidden content item again: the undo of hiding it.

func (*Client) DeleteContentReaction added in v0.81.0

func (c *Client) DeleteContentReaction(ctx context.Context, id string, q DeleteContentReactionQuery) (content.ReactionCounts, error)

DeleteContentReaction is DELETE /v1/contents/{id}/reaction (public). Clears the caller's reaction to a content item or one of its versions.

func (*Client) DeleteContentVersion added in v0.81.0

func (c *Client) DeleteContentVersion(ctx context.Context, id string, vid string) error

DeleteContentVersion is DELETE /v1/contents/{id}/versions/{vid} (public). Soft-deletes a version, including a kind's single hidden version. Deleting the last undeleted version also soft-deletes its parent. Restoring a version restores an automatically deleted parent. Deleted content and its media are unavailable to everyone, buyers included, until restored; restoring reopens it to the same purchases. Purge erases its media after the deletion retention. Billing products and purchase history remain. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) DeleteEntity added in v0.93.0

func (c *Client) DeleteEntity(ctx context.Context, id string) (entities.Entity, error)

DeleteEntity is DELETE /v1/entities/{id} (editor). Marks an entity deleted and retires its AuthKit scope; a user-owned entity's content is deleted with it, and restoring the entity (PATCH state active) brings that content back within retention. Its media is unavailable to everyone until restored; purge erases it after the deletion retention. A failure after the deletion commits is reported, and retrying completes it. Staff holding root:entities:write write any entity; a signed-in person creates entities of user-owned kinds, as their owner and within the kind's max_per_owner, and the owner and holders of {kind}:settings:manage in its AuthKit scope edit names, text, attributes, cover, avatar and state.

func (*Client) DeleteEntityMembers added in v0.93.0

func (c *Client) DeleteEntityMembers(ctx context.Context, id string, body []entities.Membership) (entities.Written, error)

DeleteEntityMembers is DELETE /v1/entities/{id}/members (staff). Removes contents or versions from a entity.

func (*Client) DeleteEntityNames added in v0.93.0

func (c *Client) DeleteEntityNames(ctx context.Context, id string, body []entities.Name) ([]entities.Name, error)

DeleteEntityNames is DELETE /v1/entities/{id}/names (staff). Removes names and aliases from a entity.

func (*Client) DeleteEntityReaction added in v0.93.0

func (c *Client) DeleteEntityReaction(ctx context.Context, id string) (content.ReactionCounts, error)

DeleteEntityReaction is DELETE /v1/entities/{id}/reaction (public). Clears the caller's reaction to an entity.

func (*Client) DeleteGlobalCommentBan added in v0.81.0

func (c *Client) DeleteGlobalCommentBan(ctx context.Context, user string) error

DeleteGlobalCommentBan is DELETE /v1/global-comment-bans/{user} (staff). Lifts a tenant-wide comment ban.

func (*Client) DeleteMeHistory added in v0.81.0

func (c *Client) DeleteMeHistory(ctx context.Context, q DeleteMeHistoryQuery) error

DeleteMeHistory is DELETE /v1/me/history (user). Erases the reader's history: of one content item, one kind or everything. Hidden contents stay hidden.

func (*Client) DeleteMeSearches added in v0.81.0

func (c *Client) DeleteMeSearches(ctx context.Context, q DeleteMeSearchesQuery) error

DeleteMeSearches is DELETE /v1/me/searches (public). Clears the reader's recent searches: one query, or every one so far.

func (*Client) DeleteModerationBannedWords added in v0.81.0

func (c *Client) DeleteModerationBannedWords(ctx context.Context, body []string) error

DeleteModerationBannedWords is DELETE /v1/moderation/banned-words (staff). Unbans words.

func (*Client) DeleteModerationIpBans added in v0.81.0

func (c *Client) DeleteModerationIpBans(ctx context.Context, body []string) error

DeleteModerationIpBans is DELETE /v1/moderation/ip-bans (staff). Lifts the bans of addresses or networks.

func (*Client) DeleteModerationLocationRule added in v0.138.23

func (c *Client) DeleteModerationLocationRule(ctx context.Context, id string) error

DeleteModerationLocationRule is DELETE /v1/moderation/location-rules/{id} (staff). Deletes a location rule, retaining its history.

func (*Client) DeletePoll added in v0.81.0

func (c *Client) DeletePoll(ctx context.Context, id string) error

DeletePoll is DELETE /v1/polls/{id} (staff). Deletes a poll, its votes and its media folder.

func (*Client) DeletePollOption added in v0.81.0

func (c *Client) DeletePollOption(ctx context.Context, id string, oid string) error

DeletePollOption is DELETE /v1/polls/{id}/options/{oid} (staff). Before voting starts, removes an option; a poll keeps at least two.

func (*Client) EventReader added in v0.117.0

func (c *Client) EventReader() eventlog.Reader

EventReader reads the shared envelope through the client's existing transport and authorization. Cursors remain the catalog's legacy opaque cursors.

func (*Client) GetAccountErasure added in v0.139.0

func (c *Client) GetAccountErasure(ctx context.Context, id string) (content.AccountErasure, error)

GetAccountErasure is GET /v1/accounts/{id}/erasure (staff). Reads an account's lifecycle in this app: its state, when its erasure was requested and when it completed.

func (*Client) GetCatalogTotals added in v0.81.0

func (c *Client) GetCatalogTotals(ctx context.Context, q GetCatalogTotalsQuery) (catalog.Totals, error)

GetCatalogTotals is GET /v1/catalog/totals (open). Each kind's content, in all and per language: how many items an anonymous visitor's listing shows and opens, and how many each tier's holders open. The request's site scope applies.

func (*Client) GetChannel added in v0.131.0

func (c *Client) GetChannel(ctx context.Context, id string, q GetChannelQuery) (channels.Channel, error)

GetChannel is GET /v1/channels/{id} (public). Reads a channel, its metadata and the viewer's membership standing.

func (*Client) GetChannelCanComment added in v0.131.0

func (c *Client) GetChannelCanComment(ctx context.Context, id string, q GetChannelCanCommentQuery) (content.CommentStanding, error)

GetChannelCanComment is GET /v1/channels/{id}/can-comment (public). Whether the caller may comment on a channel, the ban that stops it, and the authoritative visible top-level comment count. Counts include tombstones and the author's held/rejected rows; omitted when comments are hidden or locked.

func (*Client) GetChannelCommentBans added in v0.131.0

func (c *Client) GetChannelCommentBans(ctx context.Context, id string, q GetChannelCommentBansQuery) ([]content.CommentBan, error)

GetChannelCommentBans is GET /v1/channels/{id}/comment-bans (editor). The bans on commenting on a user-owned group and the content it owns, newest first, expired ones included: for root:comments:ban holders and the group's comment moderators.

func (*Client) GetChannelComments added in v0.131.0

func (c *Client) GetChannelComments(ctx context.Context, id string, q GetChannelCommentsQuery) ([]content.Comment, error)

GetChannelComments is GET /v1/channels/{id}/comments (public). The top-level comments on a channel with reply counts; the caller also sees its own held and rejected ones.

func (*Client) GetChannelContents added in v0.131.0

func (c *Client) GetChannelContents(ctx context.Context, id string, q GetChannelContentsQuery) (discovery.ContentPage, error)

GetChannelContents is GET /v1/channels/{id}/contents (public). Lists a channel's published originals and repost references, once per original. Original publication, read, language, and domain policies always apply; reposting grants no editing or reading rights.

func (*Client) GetChannelEntities added in v0.131.0

func (c *Client) GetChannelEntities(ctx context.Context, id string, q GetChannelEntitiesQuery) ([]entities.EntityCard, error)

GetChannelEntities is GET /v1/channels/{id}/entities (public). Lists descriptive channel metadata; these associations confer no access or authoring authority.

func (*Client) GetChannelFavorite added in v0.131.0

func (c *Client) GetChannelFavorite(ctx context.Context, id string) (content.FavoriteState, error)

GetChannelFavorite is GET /v1/channels/{id}/favorite (public). The favorite count of a channel and whether the caller favorited it (never, signed out: then it must be visible).

func (*Client) GetChannelHeldComments added in v0.131.0

func (c *Client) GetChannelHeldComments(ctx context.Context, id string, q GetChannelHeldCommentsQuery) (content.HeldPage, error)

GetChannelHeldComments is GET /v1/channels/{id}/held-comments (person). Held comments on a user-owned group and the content it owns, oldest first: for root:moderation:review holders and the group's comment moderators.

func (*Client) GetChannelReaction added in v0.131.0

func (c *Client) GetChannelReaction(ctx context.Context, id string) (content.ReactionCounts, error)

GetChannelReaction is GET /v1/channels/{id}/reaction (public). The like and dislike counts of a channel and the caller's own reaction.

func (*Client) GetChannels added in v0.131.0

func (c *Client) GetChannels(ctx context.Context, q GetChannelsQuery) (channels.Page, error)

GetChannels is GET /v1/channels (public). Lists public channels independently of metadata entities.

func (*Client) GetCode added in v0.81.0

func (c *Client) GetCode(ctx context.Context, code string, q GetCodeQuery) (contenturl.Resolved, error)

GetCode is GET /v1/codes/{code} (public). A content code's link and canonical path; any spelling of the code resolves. With v, the live version that code names, if any. An editor of content not live yet gets it privately (no-store, noindex).

func (*Client) GetCommentBans added in v0.81.0

func (c *Client) GetCommentBans(ctx context.Context, q GetCommentBansQuery) ([]content.CommentBan, error)

GetCommentBans is GET /v1/comment-bans (user). The bans the caller placed on commenters of its own content, newest first, expired ones included.

func (*Client) GetCommentReplies added in v0.81.0

func (c *Client) GetCommentReplies(ctx context.Context, cid string, q GetCommentRepliesQuery) ([]content.Comment, error)

GetCommentReplies is GET /v1/comments/{cid}/replies (public). A comment's replies, oldest first; withheld (empty) where the caller can't open the content.

func (*Client) GetCommentsAdmin added in v0.81.0

func (c *Client) GetCommentsAdmin(ctx context.Context, q GetCommentsAdminQuery) ([]content.AdminComment, error)

GetCommentsAdmin is GET /v1/comments/admin (staff). Every comment, newest first, deleted, held and rejected ones with their real bodies.

func (*Client) GetCommentsLatest added in v0.81.0

func (c *Client) GetCommentsLatest(ctx context.Context, q GetCommentsLatestQuery) ([]content.FeedItem, error)

GetCommentsLatest is GET /v1/comments/latest (public). The newest published comments across the tenant, with their targets; a page may under-fill.

func (*Client) GetConfig added in v0.81.0

func (c *Client) GetConfig(ctx context.Context) (content.Config, error)

GetConfig is GET /v1/config (open). What the content module allows: which interactions signed-out visitors may make, and the longest comment.

func (*Client) GetContent added in v0.81.0

func (c *Client) GetContent(ctx context.Context, id string, q GetContentQuery) (catalog.Content, error)

GetContent is GET /v1/contents/{id} (public). A content item: its text in the viewer's language, live versions with their segments and access, groups and attributes; the body only to viewers who open a version, everyone else its description and the paywall decision. Editors see every version and every language.

func (*Client) GetContentCanComment added in v0.81.0

func (c *Client) GetContentCanComment(ctx context.Context, id string, q GetContentCanCommentQuery) (content.CommentStanding, error)

GetContentCanComment is GET /v1/contents/{id}/can-comment (public). Whether the caller may comment on a content item or one of its versions, the ban that stops it, and the authoritative visible top-level comment count. Counts include tombstones and the author's held/rejected rows; omitted when comments are hidden or locked.

func (*Client) GetContentCards added in v0.111.0

func (c *Client) GetContentCards(ctx context.Context, q GetContentCardsQuery) (discovery.ContentPage, error)

GetContentCards is GET /v1/content-cards (public). Hydrates 1-100 already-known content IDs in caller order. Current publication, deletion, domain, language, reader filters and access rules still apply. Missing or hidden IDs are omitted; this is not a discovery listing. It does not record engagement or history.

func (*Client) GetContentComments added in v0.81.0

func (c *Client) GetContentComments(ctx context.Context, id string, q GetContentCommentsQuery) ([]content.Comment, error)

GetContentComments is GET /v1/contents/{id}/comments (public). The top-level comments on a content item or one of its versions with reply counts; the caller also sees its own held and rejected ones. Withheld (empty) where the caller can't open the content; the standing says so.

func (*Client) GetContentEntities added in v0.93.0

GetContentEntities is GET /v1/contents/{id}/entities (staff). A content's memberships, its versions' included, with the entities they name.

func (*Client) GetContentFavorite added in v0.81.0

func (c *Client) GetContentFavorite(ctx context.Context, id string, q GetContentFavoriteQuery) (content.FavoriteState, error)

GetContentFavorite is GET /v1/contents/{id}/favorite (public). The favorite count of a content item or one of its versions (absent where its kind's locked view hides it) and whether the caller favorited it (never, signed out: then it must be visible).

func (*Client) GetContentFilters added in v0.94.0

func (c *Client) GetContentFilters(ctx context.Context, q GetContentFiltersQuery) (discovery.ContentFilters, error)

GetContentFilters is GET /v1/content-filters (public). The current reader's configured content filters and settings. Anonymous requests may supply ContentKit-Reader-Preferences JSON with filters [{entity_id,visible}]; one choice applies across applies_to kinds. Account settings take precedence when signed in.

func (*Client) GetContentReaction added in v0.81.0

func (c *Client) GetContentReaction(ctx context.Context, id string, q GetContentReactionQuery) (content.ReactionCounts, error)

GetContentReaction is GET /v1/contents/{id}/reaction (public). The like and dislike counts of a content item or one of its versions (absent where its kind's locked view hides them) and the caller's own reaction.

func (*Client) GetContentReader added in v0.145.0

func (c *Client) GetContentReader(ctx context.Context, id string, q GetContentReaderQuery) (*Reply, error)

GetContentReader is GET /v1/contents/{id}/reader (public). The reader plan of the version a content item (id is its id or code) opens for the viewer, the one GET /contents/{id} with the same v and language selects: its segments with their release state, the canonical version item for released spans, the public preview pages of a locked version, playback and reader metadata, and the signed read of its first page window. 202 while that version has no current publication; 404 for content the viewer does not see.

func (*Client) GetContentSimilar added in v0.81.0

func (c *Client) GetContentSimilar(ctx context.Context, id string, q GetContentSimilarQuery) (discovery.ContentPage, error)

GetContentSimilar is GET /v1/contents/{id}/similar (public). Contents like this one (co-engagement, or the configured source), of its kind unless kind names another.

func (*Client) GetContentVersion added in v0.81.0

func (c *Client) GetContentVersion(ctx context.Context, id string, vid string, q GetContentVersionQuery) (catalog.Version, error)

GetContentVersion is GET /v1/contents/{id}/versions/{vid} (public). One version of a content item as the viewer sees it, with its segments and access decision; vid is its id or code.

func (*Client) GetContentVersionArchive added in v0.87.0

func (c *Client) GetContentVersionArchive(ctx context.Context, id string, version string, q GetContentVersionArchiveQuery) (*Reply, error)

GetContentVersionArchive is GET /v1/contents/{id}/versions/{version}/archive (public). Streams the ZIP or exact configured single file a download granted after repeating access, publication, chapter and policy checks, reading masters where they are stored: internal originals and HostOnly renditions never gain a gateway URL. An unwatermarked download is the same bytes for its revision (Content-Length, ETag, ranges) and cached privately; a watermarked ZIP is marked and zipped anew for each request and never cached (private, no-store). Signed editor authority and token-tier claims delegate only this transfer until ticket expiry, like a private media URL. 404 for an expired, stale or foreign ticket, and at once for a version deleted or hidden from its viewer, never 202.

func (*Client) GetContentVersionDownload added in v0.81.0

func (c *Client) GetContentVersionDownload(ctx context.Context, id string, version string) (*Reply, error)

GetContentVersionDownload is GET /v1/contents/{id}/versions/{version}/download (public). Grants a version's download, what its kind's download serves (its pages' masters as a ZIP, or its downloadable upload's master, the original under the identity recipe), as the host's download policy allows and names, charged to the viewer's download quota: a FileDownload whose short-lived URL, the archive transfer route relative to this one, streams it as an attachment. Includes only the released, download-authorized pages in manifest order. 202 while it is prepared; 404 for a version deleted or hidden from the viewer; 403 download_unavailable with the policy's reason and available_at; 409 no_download when the version has nothing to serve.

func (*Client) GetContentVersionPageNotices added in v0.104.0

func (c *Client) GetContentVersionPageNotices(ctx context.Context, id string, version string) (versions.PageNotices, error)

GetContentVersionPageNotices is GET /v1/contents/{id}/versions/{version}/page-notices (editor). Editors: the version's undismissed notes about automatic page changes: pages removed as blank, duplicate or covered by a two-page spread, and archives reordered into natural name order. They never block saving or publishing.

func (*Client) GetContents added in v0.81.0

func (c *Client) GetContents(ctx context.Context, q GetContentsQuery) (discovery.ContentPage, error)

GetContents is GET /v1/contents (public). Lists contents as cards, one per content item with the version that fits the reader, under their visibility, site and content filters.

func (*Client) GetEntities added in v0.93.0

func (c *Client) GetEntities(ctx context.Context, q GetEntitiesQuery) (entities.EntityPage, error)

GetEntities is GET /v1/entities (public). Lists active entities with name, code, path, cover, avatar, count and the viewer's entitlement membership, filtered, ordered and cursor-paged.

func (*Client) GetEntity added in v0.93.0

func (c *Client) GetEntity(ctx context.Context, id string, q GetEntityQuery) (entities.EntityDetail, error)

GetEntity is GET /v1/entities/{id} (public). An active entity with its names, text, attributes, parent, scope, children, cover, avatar, counts and membership standing; a merged entity answers with its survivor.

func (*Client) GetEntityMembers added in v0.93.0

func (c *Client) GetEntityMembers(ctx context.Context, id string, q GetEntityMembersQuery) (entities.MemberPage, error)

GetEntityMembers is GET /v1/entities/{id}/members (staff). A entity's memberships in member order, paged.

func (*Client) GetEntityReaction added in v0.93.0

func (c *Client) GetEntityReaction(ctx context.Context, id string) (content.ReactionCounts, error)

GetEntityReaction is GET /v1/entities/{id}/reaction (public). The like and dislike counts of an entity and the caller's own reaction.

func (*Client) GetEvents added in v0.116.0

func (c *Client) GetEvents(ctx context.Context, q GetEventsQuery) (catalog.EventPage, error)

GetEvents is GET /v1/events (staff). Read this app's immutable catalog events in committed order. Readers save their own cursor; reading acknowledges or deletes nothing. Omitting after starts at the oldest retained event. Event-type filters are bound to the continuation; expired or reset cursors require a current-state resync.

func (*Client) GetGlobalCommentBan added in v0.81.0

func (c *Client) GetGlobalCommentBan(ctx context.Context, user string) (content.CommentBan, error)

GetGlobalCommentBan is GET /v1/global-comment-bans/{user} (staff). A user's tenant-wide comment ban, expired or not; 404 when they have none.

func (*Client) GetGlobalCommentBans added in v0.81.0

func (c *Client) GetGlobalCommentBans(ctx context.Context, q GetGlobalCommentBansQuery) ([]content.CommentBan, error)

GetGlobalCommentBans is GET /v1/global-comment-bans (staff). The tenant-wide comment bans, newest first, expired ones included.

func (*Client) GetKinds added in v0.81.0

func (c *Client) GetKinds(ctx context.Context) (ContentModel, error)

GetKinds is GET /v1/kinds (open). The site's content model: languages, tiers, content kinds, entity kinds, whether activity is logged and people's avatar preset.

func (*Client) GetManage added in v0.93.0

func (c *Client) GetManage(ctx context.Context, q GetManageQuery) ([]catalog.Content, error)

GetManage is GET /v1/manage (public). Content items to manage, newest first: drafts, scheduled, held and live ones; deleted ones on their own. App content:write holders see all; others see their own posts with current edit-own permission, or a channel's original posts when they currently edit that channel.

func (*Client) GetManageChannel added in v0.131.0

func (c *Client) GetManageChannel(ctx context.Context, id string, q GetManageChannelQuery) (channels.Channel, error)

GetManageChannel is GET /v1/manage/channels/{id} (staff). Reads channel administration identity, including a deleted channel during retention.

func (*Client) GetManageChannels added in v0.131.0

func (c *Client) GetManageChannels(ctx context.Context, q GetManageChannelsQuery) (channels.Page, error)

GetManageChannels is GET /v1/manage/channels (staff). Lists channel administration records, including deleted channels during retention.

func (*Client) GetManageCount added in v0.104.0

func (c *Client) GetManageCount(ctx context.Context, kind string, q GetManageCountQuery) (catalog.ManageCount, error)

GetManageCount is GET /v1/manage/{kind}/count (public). How many items of one kind the caller manages under the /manage/{kind} filters: exact up to 10,000; beyond that, truncated marks a lower bound.

func (*Client) GetManageEntities added in v0.97.0

func (c *Client) GetManageEntities(ctx context.Context, q GetManageEntitiesQuery) (entities.EntityPage, error)

GetManageEntities is GET /v1/manage/entities (staff). Lists active (or deleted) entities for administration, including internal classifications that are never exposed by public reads. With ids it resolves those entities in every state, deleted and merged ones included, each with its state and a merged one's final survivor (merged_into); unknown ids are absent.

func (*Client) GetManageEntitiesMatch added in v0.135.0

func (c *Client) GetManageEntitiesMatch(ctx context.Context, q GetManageEntitiesMatchQuery) ([]entities.NameMatch, error)

GetManageEntitiesMatch is GET /v1/manage/entities/match (staff). Resolves names to active, public entities of one kind within one scope whose canonical name or alias equals each name, literally or normalized: one result per name in order, each with at most two ids, two meaning ambiguous. Merged and deleted entities never match; nothing is created or reserved.

func (*Client) GetManageEntity added in v0.97.0

func (c *Client) GetManageEntity(ctx context.Context, id string, q GetManageEntityQuery) (entities.EntityDetail, error)

GetManageEntity is GET /v1/manage/entities/{id} (staff). An entity's administration view, including internal classifications and their relationships.

func (*Client) GetManageKind added in v0.93.0

func (c *Client) GetManageKind(ctx context.Context, kind string, q GetManageKindQuery) ([]catalog.Content, error)

GetManageKind is GET /v1/manage/{kind} (public). Content items to manage for one configured kind. Uses the same permissions and filters as the cross-kind /manage listing. Unknown kinds return not_found.

func (*Client) GetManageSearchSuggestions added in v0.104.0

func (c *Client) GetManageSearchSuggestions(ctx context.Context, q GetManageSearchSuggestionsQuery) (discovery.Typeahead, error)

GetManageSearchSuggestions is GET /v1/manage/search-suggestions (editor). Private quick navigation to authorized content/entity editors. Requires a signed-in person or application. Current own titles, names and aliases match literal substrings with prefix bias; includes drafts, held edits and internal entities within management authority. No associated metadata/body matching or public-search fallback. Sections require explicit include flags; forbidden sections are omitted when another section is authorized. Returns lean name targets, with no content body or cover reads.

func (*Client) GetMeChannels added in v0.131.0

func (c *Client) GetMeChannels(ctx context.Context, q GetMeChannelsQuery) (channels.MyPage, error)

GetMeChannels is GET /v1/me/channels (user). Lists the caller's channels and their current authoring permissions.

func (*Client) GetMeContinue added in v0.141.0

func (c *Client) GetMeContinue(ctx context.Context, q GetMeContinueQuery) (discovery.ContentPage, error)

GetMeContinue is GET /v1/me/continue (public). Continue reading and watching: the reader's contents started but not finished, most recent first, each card with its position; bounced, finished, hidden and disliked ones are left out. A signed-out reader's come from its anonymous id. Filters and access apply.

func (*Client) GetMeFavorites added in v0.81.0

GetMeFavorites is GET /v1/me/favorites (user). The content items (as their listing shows them) or channels the reader favorited, most recent first.

func (*Client) GetMeHistory added in v0.81.0

func (c *Client) GetMeHistory(ctx context.Context, q GetMeHistoryQuery) (discovery.ContentPage, error)

GetMeHistory is GET /v1/me/history (user). The contents the reader engaged with and their listing shows, most recent first, with their progress.

func (*Client) GetMeLibrary added in v0.81.0

func (c *Client) GetMeLibrary(ctx context.Context, q GetMeLibraryQuery) (discovery.LibraryPage, error)

GetMeLibrary is GET /v1/me/library (user). Content covered by the reader's purchased content or version entitlements, within the current domain's hard visibility boundary.

func (*Client) GetMeSearches added in v0.81.0

GetMeSearches is GET /v1/me/searches (public). The reader's recent searches, newest first, since they last cleared them; a signed-out reader's are its anonymous id's (ContentKit-Anonymous-Id).

func (*Client) GetMeStats added in v0.85.0

func (c *Client) GetMeStats(ctx context.Context) (discovery.MyStats, error)

GetMeStats is GET /v1/me/stats (user). The signed-in reader's account statistics: the contents they finished per kind, their comments and the reactions those received, and elapsed access seconds per tier when billing supplies its history.

func (*Client) GetMedia added in v0.81.0

func (c *Client) GetMedia(ctx context.Context, kind string, id string, q GetMediaQuery) (media.ReadResult, error)

GetMedia is GET /v1/media/{kind}/{id} (public). Released files under a prefix in manifest order. Offset/limit or repeated path selects which get URLs. Version access covers its private folder. Explicit editor reads can inspect unserved source/prepared files through short-lived storage URLs. Unreadable files are omitted.

func (*Client) GetMediaHls added in v0.81.0

func (c *Client) GetMediaHls(ctx context.Context, kind string, id string, path string, q GetMediaHlsQuery) (*Reply, error)

GetMediaHls is GET /v1/media/{kind}/{id}/hls/{path...} (public). HLS: {dir}master.m3u8 (a ladder of the read's hls), {path}.m3u8 (a track) or {dir}sprite.vtt (the seek sprite).

func (*Client) GetMediaPresets added in v0.81.0

func (c *Client) GetMediaPresets(ctx context.Context) ([]media.PresetRule, error)

GetMediaPresets is GET /v1/media/presets (open). Every kind's public preset rules: crop bounds, widths and default images. Current image URLs come from a read's public.

func (*Client) GetMediaVersion added in v0.81.0

func (c *Client) GetMediaVersion(ctx context.Context, kind string, id string, version string, q GetMediaVersionQuery) (media.ReadResult, error)

GetMediaVersion is GET /v1/media/{kind}/{id}/versions/{version} (public). A content version's item, read as GET /{kind}/{id} reads any other kind's item.

func (*Client) GetMediaVersionHls added in v0.81.0

func (c *Client) GetMediaVersionHls(ctx context.Context, kind string, id string, version string, path string, q GetMediaVersionHlsQuery) (*Reply, error)

GetMediaVersionHls is GET /v1/media/{kind}/{id}/versions/{version}/hls/{path...} (public). A version's HLS playlists, as GET /{kind}/{id}/hls/{path...} serves an item's.

func (*Client) GetModerationBannedWords added in v0.81.0

func (c *Client) GetModerationBannedWords(ctx context.Context) ([]content.BannedWord, error)

GetModerationBannedWords is GET /v1/moderation/banned-words (staff). The banned words and what each does.

func (*Client) GetModerationHeld added in v0.81.0

func (c *Client) GetModerationHeld(ctx context.Context, q GetModerationHeldQuery) (content.HeldPage, error)

GetModerationHeld is GET /v1/moderation/held (staff). Held comments awaiting review, oldest first.

func (*Client) GetModerationIpBans added in v0.81.0

func (c *Client) GetModerationIpBans(ctx context.Context) ([]content.IPBan, error)

GetModerationIpBans is GET /v1/moderation/ip-bans (staff). The IP bans, newest first, expired ones included.

func (*Client) GetModerationLocationRuleHistory added in v0.138.23

func (c *Client) GetModerationLocationRuleHistory(ctx context.Context, id string, q GetModerationLocationRuleHistoryQuery) (content.LocationRuleHistoryPage, error)

GetModerationLocationRuleHistory is GET /v1/moderation/location-rules/{id}/history (staff). Lists a rule's history, including after deletion.

func (*Client) GetModerationLocationRules added in v0.138.23

func (c *Client) GetModerationLocationRules(ctx context.Context, q GetModerationLocationRulesQuery) (content.LocationRulePage, error)

GetModerationLocationRules is GET /v1/moderation/location-rules (staff). Lists location rules, newest first.

func (*Client) GetModerationLocationRulesCheck added in v0.138.23

func (c *Client) GetModerationLocationRulesCheck(ctx context.Context, q GetModerationLocationRulesCheckQuery) (content.LocationCheck, error)

GetModerationLocationRulesCheck is GET /v1/moderation/location-rules/check (staff). Resolves an IP and reports matching enabled rules for each domain.

func (*Client) GetModerationLocationRulesHistory added in v0.138.23

func (c *Client) GetModerationLocationRulesHistory(ctx context.Context, q GetModerationLocationRulesHistoryQuery) (content.LocationRuleHistoryPage, error)

GetModerationLocationRulesHistory is GET /v1/moderation/location-rules/history (staff). Lists all location rule history, newest first.

func (*Client) GetPoll added in v0.81.0

func (c *Client) GetPoll(ctx context.Context, id string) (content.Poll, error)

GetPoll is GET /v1/polls/{id} (public). A poll with the caller's vote; a scheduled poll only for root:polls:write holders.

func (*Client) GetPolls added in v0.81.0

func (c *Client) GetPolls(ctx context.Context, q GetPollsQuery) ([]content.Poll, error)

GetPolls is GET /v1/polls (public). Live polls, newest first.

func (*Client) GetPollsAdmin added in v0.81.0

func (c *Client) GetPollsAdmin(ctx context.Context, q GetPollsAdminQuery) ([]content.Poll, error)

GetPollsAdmin is GET /v1/polls/admin (staff). Every poll, scheduled and inactive ones included.

func (*Client) GetRecommendations added in v0.81.0

func (c *Client) GetRecommendations(ctx context.Context, q GetRecommendationsQuery) (discovery.ContentPage, error)

GetRecommendations is GET /v1/recommendations (user). Contents for the signed-in reader from their history, filled from what is popular; seen and disliked content left out.

func (*Client) GetReleaseDates added in v0.81.0

func (c *Client) GetReleaseDates(ctx context.Context, q GetReleaseDatesQuery) (discovery.ReleaseDates, error)

GetReleaseDates is GET /v1/release-dates (public). The release date index: per day or month, newest first, the contents the reader's listing shows released then and how many are free.

func (*Client) GetReleases added in v0.95.0

GetReleases is GET /v1/releases (public). Every visible release in a calendar-day window ending on end_date (today by default), grouped newest first, with complete card metadata and empty days. Each day also counts unique contents omitted solely by optional reader entity filters and overlapping per-entity counts, including zero counts for current hidden public toggles. Hard domain, publication, language and access policies remain enforced at the current time; omitted content metadata and covers are not returned. No item limit or pagination; future and deleted releases stay excluded.

func (*Client) GetSearch added in v0.81.0

func (c *Client) GetSearch(ctx context.Context, q GetSearchQuery) (discovery.SearchPage, error)

GetSearch is GET /v1/search (public). Keyword search over contents, grouped per content item, personalized for a reader with reading state unless sorted otherwise. A first page's request_id names the search in the activity log.

func (*Client) GetSitemapContents added in v0.85.0

func (c *Client) GetSitemapContents(ctx context.Context, q GetSitemapContentsQuery) (discovery.SitemapPage, error)

GetSitemapContents is GET /v1/sitemap/contents (open). Pages through the site's public content pages of one kind, by id, for host sitemaps: live, listed and in the request's site scope, each with every language it serves.

func (*Client) GetSitemapEntities added in v0.93.0

func (c *Client) GetSitemapEntities(ctx context.Context, q GetSitemapEntitiesQuery) (discovery.SitemapPage, error)

GetSitemapEntities is GET /v1/sitemap/entities (open). Pages through the site's public group pages of one kind, by id, for host sitemaps: active groups holding content the site lists, each with the languages that content serves.

func (*Client) GetStatsActive added in v0.141.0

func (c *Client) GetStatsActive(ctx context.Context, q GetStatsActiveQuery) (discovery.ActiveDays, error)

GetStatsActive is GET /v1/stats/active (staff). Distinct people active on the site for every UTC day of the period, newest first, by access (anonymous, account or the tiers an account's token claimed), from the analytics job's daily rollups; today is as of its last hourly rebuild.

func (*Client) GetTypeahead added in v0.81.0

func (c *Client) GetTypeahead(ctx context.Context, q GetTypeaheadQuery) (discovery.Typeahead, error)

GetTypeahead is GET /v1/typeahead (public). Completes literal own title and entity-name/alias substrings while the reader types (name prefixes only under three characters), with prefixes first and common fillers ignored; excludes contextual keywords and typos.

func (*Client) GetVersion added in v0.114.0

func (c *Client) GetVersion(ctx context.Context, vid string, q GetVersionQuery) (catalog.Content, error)

GetVersion is GET /v1/versions/{vid} (public). A version by its globally generated id: returns its parent content detail with only this edition selected, including shared and version-specific entities. The same visibility and access rules apply as on the parent's page; hidden versions never fall back to a sibling.

func (*Client) GetVersions added in v0.135.0

func (c *Client) GetVersions(ctx context.Context, q GetVersionsQuery) ([]catalog.VersionStatus, error)

GetVersions is GET /v1/versions (staff). Editions' catalog status by version id, for hosts that keep references to them: content, kind, languages, deletion, live, released and live_from, in ids' order. A purged edition is absent. No event fires when live_from passes: a released edition is open from live_from, or always when it is absent.

func (*Client) IngestMedia added in v0.81.0

func (c *Client) IngestMedia(ctx context.Context, bucket *http.Client, ref media.RefBody, operationID string, files []MediaFile, directories ...media.Directory) (media.CommitReply, error)

IngestMedia uploads files into one media item (a content item's, or one version's) and commits them as one operation: the upload routes' presign, a PUT or multipart parts to the bucket over a separate storage client (a fresh unauthenticated client when nil), then commit. operationID is a UUID of this commit; sending the files again (a new operationID) finds bytes the folder holds and uploads nothing twice. Files with From are copied server-side, in one request. It is how an importer fills an imported version's folder. This helper does not retain upload plans: on a commit error, MediaCommitError retains the exact batch for PostMediaUploadCommit, instead of a fresh invocation with the same ID. The call returns its attached uploads and pending processing; ZIP extraction and renditions run through the normal media workers. It changes no content metadata or publication. Create the item/version before uploading, and edit or publish it explicitly afterward. The storage client must not inject API credentials; its cookies and redirect handler are never used. The directories are created, or renamed and moved to match, before the files are put, in the same commit; a new one goes last among its siblings.

func (*Client) ListEvents added in v0.116.0

func (c *Client) ListEvents(ctx context.Context, query catalog.EventQuery) (catalog.EventPage, error)

ListEvents reads a retained page without registering or acknowledging a reader.

func (*Client) PatchChannel added in v0.131.0

func (c *Client) PatchChannel(ctx context.Context, id string, body channels.Update) (channels.Channel, error)

PatchChannel is PATCH /v1/channels/{id} (editor). Edits channel identity as staff or a current channel manager.

func (*Client) PatchComment added in v0.81.0

func (c *Client) PatchComment(ctx context.Context, cid string, body content.CommentEdit) (content.Comment, error)

PatchComment is PATCH /v1/comments/{cid} (public). Edits a comment: its author, or a root:comments:moderate holder. 202 when the moderator holds the new text. Its author can't edit it while it is held or rejected.

func (*Client) PatchContent added in v0.81.0

func (c *Client) PatchContent(ctx context.Context, id string, body catalog.ContentPatch) (catalog.Content, error)

PatchContent is PATCH /v1/contents/{id} (public). Edits a content item's access, restrictions, attributes or creators. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PatchContentFeedback added in v0.141.0

PatchContentFeedback is PATCH /v1/contents/{id}/feedback (public). Answers the reader's feedback prompt on the content, or takes or declines its hide suggestion. A taken suggestion hides the tag in an account's content filters; a signed-out browser keeps the choice itself. not_found when no prompt was offered.

func (*Client) PatchContentVersion added in v0.81.0

func (c *Client) PatchContentVersion(ctx context.Context, id string, vid string, body catalog.VersionInput) (catalog.Version, error)

PatchContentVersion is PATCH /v1/contents/{id}/versions/{vid} (public). Edits a version: languages, traits, label, state and schedule, access, attributes, text, segments and cover; a hidden version takes its cover, own access policy or state=published to restore it. Publication is durably accepted and remains pending while its media is processing. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PatchEntity added in v0.93.0

func (c *Client) PatchEntity(ctx context.Context, id string, body entities.EntityUpdate) (entities.Entity, error)

PatchEntity is PATCH /v1/entities/{id} (editor). Updates a entity's given fields; state restores or deletes it. Staff holding root:entities:write write any entity; a signed-in person creates entities of user-owned kinds, as their owner and within the kind's max_per_owner, and the owner and holders of {kind}:settings:manage in its AuthKit scope edit names, text, attributes, cover, avatar and state.

func (*Client) PatchMeContentFilters added in v0.103.0

PatchMeContentFilters is PATCH /v1/me/content-filters (user). Atomically changes only submitted shared entity choices. Omitted choices remain unchanged. Each choice sets visible or default:true.

func (*Client) PatchModerationLocationRule added in v0.138.23

func (c *Client) PatchModerationLocationRule(ctx context.Context, id string, body content.LocationRuleUpdate) (content.LocationRule, error)

PatchModerationLocationRule is PATCH /v1/moderation/location-rules/{id} (staff). Updates a location rule, including its enabled state.

func (*Client) PatchPoll added in v0.81.0

func (c *Client) PatchPoll(ctx context.Context, id string, body content.PollUpdate) (content.Poll, error)

PatchPoll is PATCH /v1/polls/{id} (staff). Updates a poll's given fields; closes_at null reopens it until deactivated.

func (*Client) PatchPollOption added in v0.81.0

func (c *Client) PatchPollOption(ctx context.Context, id string, oid string, body content.PollOptionPatch) (content.PollOption, error)

PatchPollOption is PATCH /v1/polls/{id}/options/{oid} (staff). Before voting starts, updates an option's label or position.

func (*Client) PostAccountAnonymize added in v0.135.0

func (c *Client) PostAccountAnonymize(ctx context.Context, id string) error

PostAccountAnonymize is POST /v1/accounts/{id}/anonymize (staff). Anonymizes a purged account: keeps its comments and contributions, unlinks it and removes its private data. Idempotent; retry on failure.

func (*Client) PostActivity added in v0.141.0

func (c *Client) PostActivity(ctx context.Context, body discovery.Activity) error

PostActivity is POST /v1/activity (public). Logs the reader's opens and reading progress: an open names the list it came from; progress is the active time since the last report and the furthest and current page or second. A signed-out reader sends its anonymous id in ContentKit-Anonymous-Id, and every request may send ContentKit-UTC-Offset. Unknown content is skipped.

func (*Client) PostChannelComments added in v0.131.0

func (c *Client) PostChannelComments(ctx context.Context, id string, body content.CommentInput) (content.Comment, error)

PostChannelComments is POST /v1/channels/{id}/comments (public). Comments on a channel in a language's thread, or replies to a top-level comment; a signed-out caller gives anon_name, where Config.anonymous.comments allows it. 202 when the moderator holds it.

func (*Client) PostChannelDislike added in v0.131.0

func (c *Client) PostChannelDislike(ctx context.Context, id string) (content.ReactionCounts, error)

PostChannelDislike is POST /v1/channels/{id}/dislike (public). Dislikes a channel.

func (*Client) PostChannelFavorite added in v0.131.0

func (c *Client) PostChannelFavorite(ctx context.Context, id string) (content.FavoriteState, error)

PostChannelFavorite is POST /v1/channels/{id}/favorite (user). Favorites a channel the caller sees; favoriting again is a no-op. Answers the state with its favorite count.

func (*Client) PostChannelLike added in v0.131.0

func (c *Client) PostChannelLike(ctx context.Context, id string) (content.ReactionCounts, error)

PostChannelLike is POST /v1/channels/{id}/like (public). Likes a channel.

func (*Client) PostChannels added in v0.131.0

func (c *Client) PostChannels(ctx context.Context, body channels.Input) (channels.Channel, error)

PostChannels is POST /v1/channels (editor). Creates a channel under the configured staff or user creation policy.

func (*Client) PostCodesAliases added in v0.83.0

PostCodesAliases is POST /v1/codes/aliases (open). Resolves legacy identifiers (the import's aliases) to their content's link, canonical path and locator, in order, following merges: found, not_found (unknown or hidden) or gone; at most 100.

func (*Client) PostCommentDislike added in v0.81.0

func (c *Client) PostCommentDislike(ctx context.Context, cid string) (content.ReactionCounts, error)

PostCommentDislike is POST /v1/comments/{cid}/dislike (public). Dislikes a comment.

func (*Client) PostCommentHold added in v0.81.0

func (c *Client) PostCommentHold(ctx context.Context, cid string) error

PostCommentHold is POST /v1/comments/{cid}/hold (person). Holds a published comment for review: out of its thread, shown to its author only, until released or deleted. For root:comments:moderate holders and, on a user-owned group or its content, the group's comment moderators (its owner, holders of {kind}:comments:moderate in its AuthKit scope).

func (*Client) PostCommentLike added in v0.81.0

func (c *Client) PostCommentLike(ctx context.Context, cid string) (content.ReactionCounts, error)

PostCommentLike is POST /v1/comments/{cid}/like (public). Likes a comment.

func (*Client) PostCommentRelease added in v0.81.0

func (c *Client) PostCommentRelease(ctx context.Context, cid string) error

PostCommentRelease is POST /v1/comments/{cid}/release (person). Publishes a held comment, as a reviewer's approval does. For root:comments:moderate holders and, on a user-owned group or its content, the group's comment moderators (its owner, holders of {kind}:comments:moderate in its AuthKit scope).

func (*Client) PostCommentRestore added in v0.81.0

func (c *Client) PostCommentRestore(ctx context.Context, cid string) (content.Restored, error)

PostCommentRestore is POST /v1/comments/{cid}/restore (staff). Restores a deleted comment.

func (*Client) PostContentComments added in v0.81.0

func (c *Client) PostContentComments(ctx context.Context, id string, body content.CommentInput, q PostContentCommentsQuery) (content.Comment, error)

PostContentComments is POST /v1/contents/{id}/comments (public). Comments on a content item or one of its versions in a language's thread, or replies to a top-level comment; a signed-out caller gives anon_name, where Config.anonymous.comments allows it. 202 when the moderator holds it.

func (*Client) PostContentDislike added in v0.81.0

func (c *Client) PostContentDislike(ctx context.Context, id string, q PostContentDislikeQuery) (content.ReactionCounts, error)

PostContentDislike is POST /v1/contents/{id}/dislike (public). Dislikes a content item or one of its versions.

func (*Client) PostContentFavorite added in v0.81.0

func (c *Client) PostContentFavorite(ctx context.Context, id string, q PostContentFavoriteQuery) (content.FavoriteState, error)

PostContentFavorite is POST /v1/contents/{id}/favorite (user). Favorites a content item or one of its versions the caller sees; favoriting again is a no-op. Answers the state with its favorite count.

func (*Client) PostContentFeedback added in v0.141.0

PostContentFeedback is POST /v1/contents/{id}/feedback (public). Offers a feedback prompt after the reader's own like, favorite or dislike of the content: a share of each reaction is asked about, one person is offered about one prompt a day and never two for one item. The prompt is recorded as offered; prompt is null when there is none.

func (*Client) PostContentImages added in v0.81.0

func (c *Client) PostContentImages(ctx context.Context, id string, body catalog.BodyImageInput) (catalog.InlineImage, error)

PostContentImages is POST /v1/contents/{id}/images (public). Returns a reference and editor preview for an inline image uploaded to the selected version. No sibling version is changed. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PostContentLike added in v0.81.0

func (c *Client) PostContentLike(ctx context.Context, id string, q PostContentLikeQuery) (content.ReactionCounts, error)

PostContentLike is POST /v1/contents/{id}/like (public). Likes a content item or one of its versions.

func (*Client) PostContentPublish added in v0.81.0

func (c *Client) PostContentPublish(ctx context.Context, id string, body catalog.PublishInput) (catalog.Content, error)

PostContentPublish is POST /v1/contents/{id}/publish (public). Accepts durable publication now, or schedules it for publish_at. Processing and publication may continue in the background; live becomes true only after completed publication. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PostContentRestore added in v0.81.0

func (c *Client) PostContentRestore(ctx context.Context, id string) (catalog.Content, error)

PostContentRestore is POST /v1/contents/{id}/restore (public). Restores an independently deleted content item as it was. A parent deleted with its last version is restored by restoring a version instead. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PostContentUnpublish added in v0.81.0

func (c *Client) PostContentUnpublish(ctx context.Context, id string) (catalog.Content, error)

PostContentUnpublish is POST /v1/contents/{id}/unpublish (public). Returns a published or scheduled content item to a draft. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PostContentVersionPageNoticeDismiss added in v0.104.0

func (c *Client) PostContentVersionPageNoticeDismiss(ctx context.Context, id string, version string, notice string) error

PostContentVersionPageNoticeDismiss is POST /v1/contents/{id}/versions/{version}/page-notices/{notice}/dismiss (editor). Editors: hides a current page notice; repeating it changes nothing.

func (*Client) PostContentVersionPageNoticeRestore added in v0.104.0

func (c *Client) PostContentVersionPageNoticeRestore(ctx context.Context, id string, version string, notice string) (versions.PageNotices, error)

PostContentVersionPageNoticeRestore is POST /v1/contents/{id}/versions/{version}/page-notices/{notice}/restore (editor). Editors: puts a removed-pages notice's pages back in their original positions and clears the notice.

func (*Client) PostContentVersions added in v0.81.0

func (c *Client) PostContentVersions(ctx context.Context, id string, body catalog.VersionInput) (catalog.Version, error)

PostContentVersions is POST /v1/contents/{id}/versions (public). Adds a version after the others, a draft unless state says otherwise. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PostContents added in v0.81.0

func (c *Client) PostContents(ctx context.Context, body catalog.ContentInput) (catalog.Content, error)

PostContents is POST /v1/contents (public). Creates a content item as a draft, with one version serving its text's languages when it names none. Staff with root:content:write may create anywhere. Signed-in people with root:content:create may create their own unowned posts; channel posts require that channel's owner or {kind}:content:create/write grant. Creator credits are attribution, not editorship.

func (*Client) PostEntities added in v0.93.0

func (c *Client) PostEntities(ctx context.Context, body []entities.EntityInput) ([]entities.Entity, error)

PostEntities is POST /v1/entities (editor). Creates entities with their names and text; an auth_scope kind's gets its AuthKit scope. Staff holding root:entities:write write any entity; a signed-in person creates entities of user-owned kinds, as their owner and within the kind's max_per_owner, and the owner and holders of {kind}:settings:manage in its AuthKit scope edit names, text, attributes, cover, avatar and state.

func (*Client) PostEntityDislike added in v0.93.0

func (c *Client) PostEntityDislike(ctx context.Context, id string) (content.ReactionCounts, error)

PostEntityDislike is POST /v1/entities/{id}/dislike (public). Dislikes an entity.

func (*Client) PostEntityLike added in v0.93.0

func (c *Client) PostEntityLike(ctx context.Context, id string) (content.ReactionCounts, error)

PostEntityLike is POST /v1/entities/{id}/like (public). Likes an entity.

func (*Client) PostEntityMembers added in v0.93.0

func (c *Client) PostEntityMembers(ctx context.Context, id string, body []entities.Membership) (entities.Written, error)

PostEntityMembers is POST /v1/entities/{id}/members (staff). Adds contents or versions to a entity, or updates their position and state.

func (*Client) PostEntityMerge added in v0.93.0

func (c *Client) PostEntityMerge(ctx context.Context, id string, body entities.MergeInput) (entities.MergeReport, error)

PostEntityMerge is POST /v1/entities/{id}/merge (staff). Merges a entity into another of its kind: memberships, names and children move, and its code redirects.

func (*Client) PostEntityNames added in v0.93.0

func (c *Client) PostEntityNames(ctx context.Context, id string, body []entities.Name) ([]entities.Name, error)

PostEntityNames is POST /v1/entities/{id}/names (staff). Adds names and aliases to a entity; a new canonical name demotes the old one to an alias.

func (*Client) PostImport added in v0.81.0

func (c *Client) PostImport(ctx context.Context, body importer.Batch) (importer.Result, error)

PostImport is POST /v1/import (staff). Imports a batch of groups, content items, memberships, aliases, comments, reactions, favorites, polls and signals, idempotently by external id: re-sending converges. Imported poll choices and images can change after voting; kept choice IDs retain votes. Favorites and legacy reading accept removed tombstones; reaction value 0 clears an imported reaction. Favorite/reaction writes preserve native, unknown-origin and other-source rows. Records that fail are reported and the rest written; their rebuild jobs are queued.

func (*Client) PostImportExternalIds added in v0.86.0

func (c *Client) PostImportExternalIds(ctx context.Context, body importer.ExternalIDsQuery) (importer.ExternalIDs, error)

PostImportExternalIds is POST /v1/import/external-ids (staff). Pages the external ids imports under a source hold, per entity, with their ids and whether each is deleted: a persistent sync compares them with its source to find the deletes to send.

func (c *Client) PostMeAnonymousLink(ctx context.Context, body discovery.AnonymousLink) error

PostMeAnonymousLink is POST /v1/me/anonymous-link (user). Sent once at sign-in: the browser's anonymous id is now this account, so its reading state, history, reactions and recent searches fold into the account's.

func (*Client) PostMeContentFiltersMerge added in v0.141.0

PostMeContentFiltersMerge is POST /v1/me/content-filters/merge (user). Carries a signed-out browser's content filter choices into account_id's settings at sign-in: a choice fills an entity the account has not set, and a hide wins over the account's show. account_id must be the authenticated account; resets and entities no domain offers are ignored.

func (*Client) PostMediaUploadAbort added in v0.81.0

func (c *Client) PostMediaUploadAbort(ctx context.Context, body media.TicketBody) error

PostMediaUploadAbort is POST /v1/media/upload/abort (editor). Abandons a multipart upload.

func (*Client) PostMediaUploadCommit added in v0.81.0

func (c *Client) PostMediaUploadCommit(ctx context.Context, body media.CommitBody) (media.CommitReply, error)

PostMediaUploadCommit is POST /v1/media/upload/commit (editor). Applies ops to an item in one conditional write, then queues placement and processing; answers its uploads as an editor reads them.

func (*Client) PostMediaUploadComplete added in v0.81.0

func (c *Client) PostMediaUploadComplete(ctx context.Context, body media.TicketBody) (media.CompleteReply, error)

PostMediaUploadComplete is POST /v1/media/upload/complete (editor). Assembles a multipart upload; blob is its staged name.

func (*Client) PostMediaUploadCopy added in v0.81.0

func (c *Client) PostMediaUploadCopy(ctx context.Context, body media.CopyBody) (media.CopyReply, error)

PostMediaUploadCopy is POST /v1/media/upload/copy (staff). Stages server-side copies of keys of the item's bucket outside ContentKit's namespaces, for one commit's puts (an importer's files).

func (*Client) PostMediaUploadParts added in v0.81.0

func (c *Client) PostMediaUploadParts(ctx context.Context, body media.PartsBody) (media.PartsReply, error)

PostMediaUploadParts is POST /v1/media/upload/parts (editor). Presigns multipart parts, each bound to its SHA-256.

func (*Client) PostMediaUploadPartsList added in v0.81.0

func (c *Client) PostMediaUploadPartsList(ctx context.Context, body media.TicketBody) (media.PartsReply, error)

PostMediaUploadPartsList is POST /v1/media/upload/parts/list (editor). The parts of a multipart upload that landed, to resume it.

func (*Client) PostMediaUploadPresign added in v0.81.0

func (c *Client) PostMediaUploadPresign(ctx context.Context, body media.PresignBody) (media.PresignReply, error)

PostMediaUploadPresign is POST /v1/media/upload/presign (editor). Plans one upload after checking its path's rules and CanUpload: exists (commit directly), one PUT, or a multipart ticket.

func (*Client) PostModerationBannedWords added in v0.81.0

func (c *Client) PostModerationBannedWords(ctx context.Context, body []content.BannedWordInput) ([]content.BannedWord, error)

PostModerationBannedWords is POST /v1/moderation/banned-words (staff). Bans words, or changes what banned ones do: mask (the default) or reject.

func (*Client) PostModerationIpBans added in v0.81.0

func (c *Client) PostModerationIpBans(ctx context.Context, body []content.IPBanInput) ([]content.IPBan, error)

PostModerationIpBans is POST /v1/moderation/ip-bans (staff). Bans addresses or networks from commenting, or replaces their bans.

func (*Client) PostModerationLocationRules added in v0.138.23

func (c *Client) PostModerationLocationRules(ctx context.Context, body content.LocationRuleInput) (content.LocationRule, error)

PostModerationLocationRules is POST /v1/moderation/location-rules (staff). Creates a location rule and its history snapshot.

func (*Client) PostModerationResolve added in v0.81.0

func (c *Client) PostModerationResolve(ctx context.Context, kind string, id string, body content.ResolveInput) (content.ReviewOutcome, error)

PostModerationResolve is POST /v1/moderation/{kind}/{id}/resolve (staff). Approves (publishes) or rejects a held comment, at the revision the queue listed.

func (*Client) PostPollOptions added in v0.81.0

func (c *Client) PostPollOptions(ctx context.Context, id string, body content.PollOptionPatch) (content.PollOption, error)

PostPollOptions is POST /v1/polls/{id}/options (staff). Before voting starts, adds an option to a multiple-choice poll, at the end unless position is given.

func (*Client) PostPollVote added in v0.81.0

func (c *Client) PostPollVote(ctx context.Context, id string, body content.PollVote) (content.Poll, error)

PostPollVote is POST /v1/polls/{id}/vote (public). Votes for an option of an open multiple-choice poll, signed out where Config.anonymous.votes allows it; a vote is final, and voting again changes nothing.

func (*Client) PostPolls added in v0.81.0

func (c *Client) PostPolls(ctx context.Context, body content.PollInput) (content.Poll, error)

PostPolls is POST /v1/polls (staff). Creates a poll with at least two predefined options; only multiple_choice is supported.

func (*Client) PutAccountDeleted added in v0.135.0

func (c *Client) PutAccountDeleted(ctx context.Context, id string, body content.AccountDeleted) error

PutAccountDeleted is PUT /v1/accounts/{id}/deleted (staff). Marks an account deleted during AuthKit's recovery period, hiding its attribution, or restored. Idempotent.

func (*Client) PutChannelCommentBan added in v0.131.0

func (c *Client) PutChannelCommentBan(ctx context.Context, id string, user string, body content.BanInput) (content.CommentBan, error)

PutChannelCommentBan is PUT /v1/channels/{id}/comment-bans/{user} (editor). Bans a user from commenting on a user-owned group and the content it owns, or replaces the ban: for root:comments:ban holders and the group's comment moderators.

func (*Client) PutChannelEntities added in v0.131.0

func (c *Client) PutChannelEntities(ctx context.Context, id string, body []string) error

PutChannelEntities is PUT /v1/channels/{id}/entities (editor). Replaces channel metadata with the given entity IDs, as a channel manager.

func (*Client) PutChannelRepost added in v0.131.0

func (c *Client) PutChannelRepost(ctx context.Context, id string, contentId string) (channels.Repost, error)

PutChannelRepost is PUT /v1/channels/{id}/reposts/{content_id} (editor). Idempotently reposts a published original into a channel the caller may post to; original ownership and access remain unchanged.

func (*Client) PutCommentBan added in v0.81.0

func (c *Client) PutCommentBan(ctx context.Context, user string, body content.BanInput) (content.CommentBan, error)

PutCommentBan is PUT /v1/comment-bans/{user} (user). Bans a user from commenting on the caller's content, or replaces the ban; no body bans without reason or end.

func (*Client) PutContentCreators added in v0.81.0

func (c *Client) PutContentCreators(ctx context.Context, id string, body catalog.CreatorsInput) (catalog.Content, error)

PutContentCreators is PUT /v1/contents/{id}/creators (public). Replaces a content item's creators. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PutContentEntities added in v0.93.0

PutContentEntities is PUT /v1/contents/{id}/entities (staff). Replaces a content's memberships, its versions' included, in the entity kinds named (every kind its kind joins by default).

func (*Client) PutContentEntitiesShared added in v0.106.0

PutContentEntitiesShared is PUT /v1/contents/{id}/entities/shared (staff). Replaces only shared content memberships in the named entity kinds, preserving every version's memberships. Entity kinds must allow the content membership scope; omitted kinds select all such kinds. New names attach to the shared content.

func (*Client) PutContentHidden added in v0.141.0

func (c *Client) PutContentHidden(ctx context.Context, id string) error

PutContentHidden is PUT /v1/contents/{id}/hidden (public). Hides a content item from every list the reader is served ("not interested"), at once; a signed-out reader hides by its anonymous id.

func (*Client) PutContentVersionEntities added in v0.106.0

PutContentVersionEntities is PUT /v1/contents/{id}/versions/{vid}/entities (staff). Replaces only this version's memberships in the named entity kinds, preserving shared and sibling-version memberships. Entity kinds must allow the version membership scope; omitted kinds select all such kinds. New names attach to this version. The version must belong to the content and not be deleted.

func (*Client) PutContentVersionReader added in v0.81.0

func (c *Client) PutContentVersionReader(ctx context.Context, id string, version string, body versions.ReaderMeta) error

PutContentVersionReader is PUT /v1/contents/{id}/versions/{version}/reader (editor). Sets a version's reader metadata (editors and staff): anchors and audio cues on its pages and audio uploads.

func (*Client) PutContentVersionSegments added in v0.81.0

func (c *Client) PutContentVersionSegments(ctx context.Context, id string, vid string, body catalog.SegmentsInput) (catalog.Version, error)

PutContentVersionSegments is PUT /v1/contents/{id}/versions/{vid}/segments (public). Replaces a version's chapters: ordered start markers naming virtual manifest files, with optional publication schedules. A chapter becomes released only after its durable publication completes. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PutContentVersionsOrder added in v0.81.0

func (c *Client) PutContentVersionsOrder(ctx context.Context, id string, body catalog.OrderInput) (catalog.Content, error)

PutContentVersionsOrder is PUT /v1/contents/{id}/versions/order (public). Orders a content item's versions: ids lists each version that is not deleted, first first. The authenticated author with current edit-own permission in the relevant app/channel, current channel content:write holders, or app content:write holders only. Author credits do not grant authority.

func (*Client) PutEntityMembersOrder added in v0.93.0

func (c *Client) PutEntityMembersOrder(ctx context.Context, id string, body entities.Order) (entities.Written, error)

PutEntityMembersOrder is PUT /v1/entities/{id}/members/order (staff). Orders an ordered entity: the listed members first, in list order.

func (*Client) PutEntityNames added in v0.93.0

func (c *Client) PutEntityNames(ctx context.Context, id string, body []entities.Name) ([]entities.Name, error)

PutEntityNames is PUT /v1/entities/{id}/names (staff). Replaces a entity's names and aliases.

func (*Client) PutGlobalCommentBan added in v0.81.0

func (c *Client) PutGlobalCommentBan(ctx context.Context, user string, body content.BanInput) (content.CommentBan, error)

PutGlobalCommentBan is PUT /v1/global-comment-bans/{user} (staff). Bans a user from commenting anywhere in the tenant, or replaces the ban.

func (*Client) PutPollImage added in v0.81.0

func (c *Client) PutPollImage(ctx context.Context, id string, body content.ImageInput) (content.PollImage, error)

PutPollImage is PUT /v1/polls/{id}/image (staff). Sets the question image to an inline image uploaded to the poll's media folder; "" clears it.

func (*Client) PutPollOptionImage added in v0.81.0

func (c *Client) PutPollOptionImage(ctx context.Context, id string, oid string, body content.ImageInput) (content.PollImage, error)

PutPollOptionImage is PUT /v1/polls/{id}/options/{oid}/image (staff). Before voting starts, sets an option's image to an inline image uploaded to the poll's media folder; "" clears it.

func (*Client) WatchMedia added in v0.126.1

func (c *Client) WatchMedia(ctx context.Context, ref media.RefBody, after string, receive func(MediaProgress) error) error

WatchMedia observes status over the same authenticated HTTP transport as GetMedia/GetMediaVersion. It blocks until cancellation, a stream failure, or receive returns an error. Reconnect explicitly with the last handled cursor; every connection starts with a fresh authorized snapshot. It issues no media capabilities and never enqueues processing. receive provides backpressure.

type Config added in v0.81.0

type Config struct {
	// GeoIPCityPath optionally names a GeoLite2-City .mmdb file.
	GeoIPCityPath string `yaml:"geoip_city_path" json:"geoip_city_path"`
	// TrustedProxies are the proxies in front of the routes (an ingress, a
	// load balancer). A request from one names its client in Forwarded or
	// X-Forwarded-For, read right to left past trusted hops; a malformed
	// chain is 400. Empty, the peer is the client: a host that rewrites
	// Request.RemoteAddr itself leaves it empty.
	TrustedProxies []netip.Prefix `yaml:"trusted_proxies,omitempty" json:"trusted_proxies,omitempty"`
	// Scope is the business and app this engine serves. It is a trusted
	// deployment binding, not request authorization. Required.
	Scope    *Scope         `yaml:"scope" json:"scope"`
	Database DatabaseConfig `yaml:"database" json:"database"`
	// Content is the site's content model: languages, tiers, content kinds
	// (commentable and indexed) and entity kinds. Required.
	Content kinds.Config `yaml:"content" json:"content"`
	// Interactions are what comments, reactions, favorites and polls allow.
	Interactions InteractionsConfig `yaml:"interactions" json:"interactions"`
	// Media is the media registry and how it is served; nil runs without
	// media (no upload or media route groups, no post and poll images).
	Media *MediaConfig `yaml:"media" json:"media"`
	// ClickHouse is the signal plane: the activity log every open, read,
	// reaction, favorite, hide and search is logged to, which the analytics
	// job folds into PostgreSQL's reading state and the daily rollups.
	// Unset, nothing is logged and reading state stays empty: the content
	// model says so (signals: false). While a configured one is down, rows
	// wait in each process's buffer, the contentkit_clickhouse probe fails
	// with the cause and the engine retries in the background.
	ClickHouse ClickHouseConfig `yaml:"clickhouse" json:"clickhouse"`
	// Accounts declares one shared account space for avatars and account
	// erasure records.
	// It does not combine this site's content catalog with any other site's.
	Accounts *AccountsConfig `json:"accounts,omitempty" yaml:"accounts,omitempty"`

	// Jobs sizes the engine's River queue.
	Jobs JobsConfig `yaml:"jobs" json:"jobs"`
	// EventRetention keeps catalog facts independently of readers; zero is fourteen days.
	EventRetention time.Duration `yaml:"event_retention,omitempty" json:"event_retention,omitempty"`
	// AnonymousRetention keeps a signed-out visitor's reading state, history
	// and recent searches this long after their last activity; their
	// reactions stay, unlinked. Zero is thirty days.
	AnonymousRetention time.Duration `yaml:"anonymous_retention,omitempty" json:"anonymous_retention,omitempty"`
	// contains filtered or unexported fields
}

Config is the engine's configuration: plain data.

func (Config) AccountMedia added in v0.89.0

func (c Config) AccountMedia() (AccountMediaStorage, bool, error)

AccountMedia returns the storage the avatar primary's worker must use in addition to its app media storage.

func (Config) MediaKinds added in v0.81.0

func (c Config) MediaKinds() (media.Config, error)

MediaKinds is the media registry Config.Media serves, scoped to the app: content kinds' media are their versions', each entity kind gains cover media (media.ForContent), and the avatar primary holds the avatar kind (Config.Accounts.Avatars). The media worker runs it from MediaRegistry's JSON.

func (Config) MediaRegistry added in v0.135.0

func (c Config) MediaRegistry() ([]byte, error)

MediaRegistry is MediaKinds validated and normalized as JSON: the media worker's MEDIA_KINDS_FILE (`contentkit media-config` prints it).

func (Config) Schemas added in v0.139.0

func (c Config) Schemas() (Schemas, error)

Schemas resolves c's schema names, defaults included, refusing names that collide. A host sharing the database checks its own (its River schema, AuthKit's) against them.

type ContentModel added in v0.135.0

type ContentModel struct {
	Channels    *kinds.Channels             `json:"channels,omitempty"`
	Languages   []string                    `json:"languages"`
	Tiers       []string                    `json:"tiers"`
	Kinds       map[string]kinds.Kind       `json:"kinds"`
	EntityKinds map[string]kinds.EntityKind `json:"entity_kinds"`
	// Signals: the site logs activity (it has a signal plane). Without,
	// clients send none: POST /v1/activity answers not_configured.
	Signals bool `json:"signals"`
	// Avatars is people's avatar preset with its default image; uploads
	// target {kind, user id}. Absent: people have none. Another person's
	// avatar is listed beside what they wrote.
	Avatars *media.PresetRule `json:"avatars,omitempty"`
}

ContentModel is the public part of kinds.Config: Client.GetKinds.

type DatabaseConfig added in v0.81.0

type DatabaseConfig struct {
	// SkipMigrations makes New validate storage read-only. Hosts then run
	// MigratePostgres/MigrateClickHouse from their explicit migration command.
	// False preserves the existing embedded startup migration behavior.
	SkipMigrations bool `yaml:"skip_migrations" json:"skip_migrations"`
	// Schema holds ContentKit's tables. Empty is "contentkit".
	Schema string `yaml:"schema" json:"schema"`
	// RiverSchema holds the River tables ContentKit's jobs run in; empty is
	// Schema plus "_river". ContentKit's own River client uses it; no host
	// job runs there.
	RiverSchema string `yaml:"river_schema" json:"river_schema"`
}

DatabaseConfig names the Postgres schemas New validates or migrates; the pool's role owns them. Shared account metadata may use its separately configured schema.

type DeleteContentFavoriteQuery added in v0.81.0

type DeleteContentFavoriteQuery struct {
	// one version of the content item; the item itself by default
	Version string
}

DeleteContentFavoriteQuery is the query of DeleteContentFavorite.

type DeleteContentReactionQuery added in v0.81.0

type DeleteContentReactionQuery struct {
	// one version of the content item; the item itself by default
	Version string
}

DeleteContentReactionQuery is the query of DeleteContentReaction.

type DeleteMeHistoryQuery added in v0.81.0

type DeleteMeHistoryQuery struct {
	// only this content kind
	Kind string
	// only this content item
	ContentId string
}

DeleteMeHistoryQuery is the query of DeleteMeHistory.

type DeleteMeSearchesQuery added in v0.81.0

type DeleteMeSearchesQuery struct {
	// only this query
	Query string
}

DeleteMeSearchesQuery is the query of DeleteMeSearches.

type DeliveryConfig added in v0.81.0

type DeliveryConfig struct {
	// Mode is "url" (the default) or "cookie".
	Mode string `yaml:"mode" json:"mode"`
	// CookieDomain is the site's registrable domain; required in cookie mode.
	CookieDomain string `yaml:"cookie_domain" json:"cookie_domain"`
	// SigningKey is the media gateway's current token key, "{kid}:{base64
	// secret}"; PreviousKey the one it still verifies, as the engine does for
	// download tickets and activity receipts signed before a rotation. A
	// secret: the server reads it from the environment. Required.
	SigningKey  string `yaml:"signing_key" json:"signing_key"`
	PreviousKey string `yaml:"previous_key" json:"previous_key"`
	// TTL is the minimum token lifetime and Window its rounding; zero takes
	// media's defaults.
	TTL    time.Duration `yaml:"ttl" json:"ttl"`
	Window time.Duration `yaml:"window" json:"window"`
}

DeliveryConfig is how viewers with access present their item token to the media gateway.

type Deps added in v0.81.0

type Deps struct {
	// Postgres is the pool ContentKit's schemas live in. Required. With
	// PostgresSession it may be a transaction-pooling PgBouncer; its
	// DefaultQueryExecMode is then cache_describe, exec or simple_protocol.
	Postgres *pgxpool.Pool
	// PostgresSession is a direct configuration of the same database and
	// role, without the pooler, for what needs a session: advisory locks held
	// across transactions, River's LISTEN and migrations. ContentKit dials and
	// closes those connections itself. Nil dials them with Postgres's
	// configuration, which must then be direct.
	PostgresSession *pgxpool.Config
	// ClickHouse is the signal plane's connection; nil opens one from
	// Config.ClickHouse.Addr, or runs without the signal plane.
	ClickHouse signal.Conn
	// Redis shares rate limits and issuance counts across replicas; nil
	// counts per process.
	Redis redis.UniversalClient

	// Auth says who a request is (authkit/auth; AuthKit's
	// ak.Authenticator()). Required.
	Auth auth.Authenticator
	// Authorization binds verified identities and permissions to Scope.
	// Required.
	Authorization Authorization
	// Users is the directory (authkit/userinfo; AuthKit's ak.UserInfo()):
	// authors' names. It must be restricted to Scope.TenantID
	// (AuthKit's ForTenant client); it also verifies privileged avatar targets.
	// Nil shows authors by id and refuses avatar edits. The notification
	// publisher independently validates recipient ownership in its transaction.
	Users userinfo.Lookup
	// Notifications publishes native notices through the account inbox owner.
	// The publisher joins each content transaction, including remote delivery
	// obligations. Nil disables notification publication; ContentKit creates no
	// fallback inbox, receipt tables or inbox HTTP routes.
	Notifications notify.Publisher
	// Billing is the site's OpenRails merchant (adapters/openrails.Billing
	// over an embedded engine or the remote client): held entitlement keys
	// and prices, free grants. Nil holds no keys and sells nothing.
	Billing access.Billing
	// Scopes provisions and retires the AuthKit groups of auth_scope entity
	// kinds (adapters/authkit.Scopes over an AuthKit client); nil leaves
	// auth_scope to staff.
	Scopes entities.Scopes

	// Store is the media bucket; required with Config.Media.
	Store media.Store
	// Downloads is the host's download policy: whether a viewer may
	// download a version now, and the pages of a page download it marks.
	// Nil allows every download the access gate and quotas let through and
	// marks none.
	Downloads versions.DownloadPolicy

	// Moderator screens comments; nil publishes every comment.
	Moderator content.ContentModerator
	// ProviderDataEraser erases what a retaining Moderator
	// keeps; required with one.
	ProviderDataEraser content.ProviderDataEraser
	// TextProcessor processes comment text on write; readers render it as
	// text. Nil trims whitespace.
	TextProcessor content.TextProcessor
	// BodySanitizer makes content bodies safe to render as HTML, keeping
	// "contentkit:" image references. Nil strips every tag.
	BodySanitizer catalog.HTMLSanitizer

	// Clock is the time; nil is time.Now.
	Clock func() time.Time
	// Logger; nil is slog.Default().
	Logger *slog.Logger
}

Deps is everything the engine reaches outside its process: connections and providers. The host owns each; Close leaves them open.

type Engine added in v0.81.0

type Engine struct {
	// contains filtered or unexported fields
}

Engine is ContentKit running in this process for one app's catalog.

func New added in v0.81.0

func New(ctx context.Context, cfg Config, deps Deps) (_ *Engine, err error)

New runs ContentKit in this process. With Database.SkipMigrations it checks prepared catalog, shared account, notification and queue storage read-only; the host calls MigratePostgres and MigrateClickHouse explicitly beforehand. The zero value retains automatic embedded migrations for compatibility. A configured ClickHouse outage disables signals while the engine retries; read-only mode never applies DDL on those retries. New starts no jobs: Start does, and queued jobs wait until then. ctx bounds database initialization.

func NewForErasureReplay added in v0.89.0

func NewForErasureReplay(ctx context.Context, cfg Config, deps Deps) (*Engine, error)

NewForErasureReplay opens the normal app stores for explicit restore repair. It permits pending erasure replay, but cannot serve routes, use Client, or start jobs. Close it after ReplayErasureFences and construct New normally.

func (*Engine) AccountErasure added in v0.139.0

func (e *Engine) AccountErasure(ctx context.Context, accountID string) (content.AccountErasure, error)

AccountErasure is one account's lifecycle in this app: its state, when its erasure was requested and when it completed.

func (*Engine) AccountMediaEvents added in v0.126.1

func (e *Engine) AccountMediaEvents() (eventlog.Reader, error)

AccountMediaEvents reads this Engine's configured tenant account processing log. Trusted account integrations own their cursors; no app receives a copy of a shared-avatar event. Application media uses Client.EventReader.

func (*Engine) AnonymizeAccount added in v0.117.0

func (e *Engine) AnonymizeAccount(ctx context.Context, accountID string) error

AnonymizeAccount is the host consumer's idempotent response to user.purged. It keeps comments and anonymous contributions, unlinks the account and removes its avatars, searches, reading and provider data; AuthKit's purge has already erased its inbox. Errors keep the consumer's checkpoint pending for retry; no periodic job is needed.

func (*Engine) Client added in v0.81.0

func (e *Engine) Client() *Client

Client is the engine's in-process client, acting as the host itself: holding the Engine is the authority, so it sends no credential, holds every staff permission and is held to no per-viewer read or interaction limit. Routes for a signed-in person (tier user) refuse it.

func (*Engine) Close added in v0.81.0

func (e *Engine) Close(ctx context.Context) error

Close stops the jobs StartJobs started and closes what New opened, leaving the host's pool, Redis and ClickHouse connections open.

func (*Engine) Probes added in v0.81.0

func (e *Engine) Probes() []Probe

Probes lists the optional dependencies the engine degrades without, for the host's dependency supervisor: the signal plane, the media bucket, Redis and the moderator (failing while its breaker holds writes for review). Scoped engines also report account purges from the last 30 days stuck beyond the event reader's 15-minute grace period.

func (*Engine) Ready added in v0.81.0

func (e *Engine) Ready(ctx context.Context) error

Ready reports whether the engine can serve: Postgres answers and Start ran. Optional dependencies never fail it (see Probes).

func (*Engine) Reconcile added in v0.135.0

func (e *Engine) Reconcile(ctx context.Context) (Reconciled, error)

Reconcile repairs the catalog's derived state from canonical content, versions and entities: listing facets, current access snapshots, search-document marks and content paths. It also wakes the release of released versions that lack a required upload, which withdraws them; the process running StartJobs does that work. It starts no workers and may run before Start. It is an explicit maintenance operation; it must not run on an engine opened for erasure recovery.

func (*Engine) RegenerateMedia added in v0.141.0

func (e *Engine) RegenerateMedia(ctx context.Context, r media.Regeneration) (int, error)

RegenerateMedia asks the media worker to bring the items r selects up to date after a deploy changed a kind's master recipe or a rendition's spec: masters whose recipe changed are made again, then renditions whose master or spec changed. Each change is published as a new manifest revision; what it replaced is retired and collected. Current items write nothing, so it can be repeated, and a run cut short is resumed by running it again. It returns the items queued.

func (*Engine) ReplayAccountErasures added in v0.89.0

func (e *Engine) ReplayAccountErasures(ctx context.Context) (signal.ErasureReport, error)

ReplayAccountErasures finishes this app's purges that never completed, including its avatar responsibility. It is for the identity purge worker or a privileged recovery command, never an automatic catalog restore.

func (*Engine) ReplayErasureFences added in v0.89.0

func (e *Engine) ReplayErasureFences(ctx context.Context) (signal.ErasureReport, error)

ReplayErasureFences repeats this app's recorded account deletions after a content-only restore. The restored app can have lost its local fences and anonymization; the shared account store must not be restored with it. Run before serving and retry until the report completes.

func (*Engine) RouteGroups added in v0.81.0

func (e *Engine) RouteGroups() RouteGroups

RouteGroups is every route group the engine can serve: those whose modules its Config provides.

func (*Engine) Routes added in v0.81.0

func (e *Engine) Routes(selection Routes) ([]Route, error)

Routes returns the selected route groups as one subtree, {Prefix}/v1/, for the host's root router (mux.Handle(r.Path, r.Handler) on net/http's ServeMux). It fails, before anything mounts, for a group the engine cannot serve: one whose module its Config leaves out.

func (*Engine) Scope added in v0.89.0

func (e *Engine) Scope() (Scope, bool)

Scope returns the immutable ownership identity. A zero scope never means all tenants or all apps.

func (*Engine) SetAccountDeleted added in v0.117.0

func (e *Engine) SetAccountDeleted(ctx context.Context, accountID string, deleted bool) error

SetAccountDeleted hides account attribution during AuthKit's recovery period. Restoring the account clears the marker and restores attribution; comments, favorites, votes and reading data are untouched.

func (*Engine) SetAccountHidden added in v0.134.0

func (e *Engine) SetAccountHidden(ctx context.Context, accountID string, hidden bool) error

SetAccountHidden hides an account's comments during a ban. Unhiding restores approved, undeleted comments; moderation and deletion state are preserved.

func (*Engine) SiteBlock added in v0.138.23

func (e *Engine) SiteBlock(ctx context.Context, ip netip.Addr, host string) (SiteBlock, bool, error)

SiteBlock checks the tenant's current enabled whole-site rules for a visitor. A GeoIP miss never matches countries or subdivisions; networks still match.

func (*Engine) Start added in v0.81.0

func (e *Engine) Start(ctx context.Context) error

Start makes the engine ready to serve. It builds ContentKit's own River client on Deps.Postgres in Config.Database.RiverSchema, through which requests enqueue background work, and works none of it: StartJobs does, in the process the host runs jobs in. It runs no DDL; ctx ending stops nothing. Call it once, before serving.

func (*Engine) StartJobs added in v0.135.0

func (e *Engine) StartJobs(ctx context.Context) error

StartJobs works ContentKit's background jobs in this process: search indexing, the analytics job, entity popularity, publication, retention and media release work, and their schedules. A host calls it from the process that runs jobs (its worker command); processes that only serve call Start. It starts the engine first when Start has not run. Close stops the jobs.

func (*Engine) VisitorClient added in v0.138.23

func (e *Engine) VisitorClient(ip netip.Addr, host string) *Client

VisitorClient acts as an anonymous visitor at ip and host. Host selects the configured content-filter domain. No request leaves the process.

type Error added in v0.81.0

type Error struct {
	Status  int
	Code    string
	Message string
	// RetryAfter is the server's minimum delay before another attempt.
	RetryAfter time.Duration
	// Details retains structured validation information without coupling the
	// client to one module's error type.
	Details   json.RawMessage
	Blobs     []string
	Field     string
	RequestID string
	Retryable bool
}

Error is a refused call: the route's status and stable code (docs/api/routes.md) and a message for people.

func (*Error) Error added in v0.81.0

func (e *Error) Error() string

type GetCatalogTotalsQuery added in v0.81.0

type GetCatalogTotalsQuery struct {
	// content kinds to total; every kind by default
	Kinds []string
	// languages to break the totals down by; every counted language by default
	Languages []string
}

GetCatalogTotalsQuery is the query of GetCatalogTotals.

type GetChannelCanCommentQuery added in v0.131.0

type GetChannelCanCommentQuery struct {
	// only this language's thread; all languages by default
	Language string
}

GetChannelCanCommentQuery is the query of GetChannelCanComment.

type GetChannelCommentBansQuery added in v0.131.0

type GetChannelCommentBansQuery struct {
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetChannelCommentBansQuery is the query of GetChannelCommentBans.

type GetChannelCommentsQuery added in v0.131.0

type GetChannelCommentsQuery struct {
	// only this language's comments; every language by default
	Language string
	// likes (most liked), best (Wilson lower bound) or newest (the default)
	Sort string
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetChannelCommentsQuery is the query of GetChannelComments.

type GetChannelContentsQuery added in v0.131.0

type GetChannelContentsQuery struct {
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// the previous page's next_cursor
	Cursor string
	// page size: 24 by default, at most 100
	Limit int
}

GetChannelContentsQuery is the query of GetChannelContents.

type GetChannelEntitiesQuery added in v0.131.0

type GetChannelEntitiesQuery struct {
	// display language
	Language string
}

GetChannelEntitiesQuery is the query of GetChannelEntities.

type GetChannelHeldCommentsQuery added in v0.131.0

type GetChannelHeldCommentsQuery struct {
	// the previous page's next
	Cursor string
	// page size: 20 by default, at most 100
	Limit int
}

GetChannelHeldCommentsQuery is the query of GetChannelHeldComments.

type GetChannelQuery added in v0.131.0

type GetChannelQuery struct {
	// display language
	Language string
}

GetChannelQuery is the query of GetChannel.

type GetChannelsQuery added in v0.131.0

type GetChannelsQuery struct {
	// display language
	Language string
	// canonical channel slug
	Slug string
	// substring of a channel name or slug
	Q string
	// previous next_cursor
	Cursor string
	// maximum results, at most 200
	Limit int
	// name, count or newest
	Sort string
}

GetChannelsQuery is the query of GetChannels.

type GetCodeQuery added in v0.81.0

type GetCodeQuery struct {
	// the language of the path's prefix and slug; the site's default by default
	Lang string
	// a version code (the page's ?v=)
	V string
}

GetCodeQuery is the query of GetCode.

type GetCommentBansQuery added in v0.81.0

type GetCommentBansQuery struct {
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetCommentBansQuery is the query of GetCommentBans.

type GetCommentRepliesQuery added in v0.81.0

type GetCommentRepliesQuery struct {
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetCommentRepliesQuery is the query of GetCommentReplies.

type GetCommentsAdminQuery added in v0.81.0

type GetCommentsAdminQuery struct {
	// only comments on this kind
	ContentKind string
	// only comments by this user id
	Author string
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetCommentsAdminQuery is the query of GetCommentsAdmin.

type GetCommentsLatestQuery added in v0.81.0

type GetCommentsLatestQuery struct {
	// only this language's comments; every language by default
	Language string
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetCommentsLatestQuery is the query of GetCommentsLatest.

type GetContentCanCommentQuery added in v0.81.0

type GetContentCanCommentQuery struct {
	// one version of the content item; the item itself by default
	Version string
	// only this language's thread; all languages by default
	Language string
}

GetContentCanCommentQuery is the query of GetContentCanComment.

type GetContentCardsQuery added in v0.111.0

type GetContentCardsQuery struct {
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// required: 1-100 known content IDs
	Ids []string
	// only this content kind
	Kind string
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// filtered and locked counts within only these IDs
	Summary *bool
}

GetContentCardsQuery is the query of GetContentCards.

type GetContentCommentsQuery added in v0.81.0

type GetContentCommentsQuery struct {
	// one version of the content item; the item itself by default
	Version string
	// only this language's comments; every language by default
	Language string
	// likes (most liked), best (Wilson lower bound) or newest (the default)
	Sort string
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetContentCommentsQuery is the query of GetContentComments.

type GetContentEntitiesQuery added in v0.93.0

type GetContentEntitiesQuery struct {
	// the language names, text and slugs resolve in, counts are scoped to and paths are prefixed with
	Language string
}

GetContentEntitiesQuery is the query of GetContentEntities.

type GetContentFavoriteQuery added in v0.81.0

type GetContentFavoriteQuery struct {
	// one version of the content item; the item itself by default
	Version string
}

GetContentFavoriteQuery is the query of GetContentFavorite.

type GetContentFiltersQuery added in v0.94.0

type GetContentFiltersQuery struct {
	// the language of labels and group names
	Language string
}

GetContentFiltersQuery is the query of GetContentFilters.

type GetContentQuery added in v0.81.0

type GetContentQuery struct {
	// the language to show text in; the site's first language, then any, when it has none
	Language string
	// a version id or code (the page's ?v=) to select when the viewer sees it live or edits it: its text, cover, body and verdict, beside every version; else the language's default
	V string
}

GetContentQuery is the query of GetContent.

type GetContentReactionQuery added in v0.81.0

type GetContentReactionQuery struct {
	// one version of the content item; the item itself by default
	Version string
}

GetContentReactionQuery is the query of GetContentReaction.

type GetContentReaderQuery added in v0.145.0

type GetContentReaderQuery struct {
	// a version id or code (the page's ?v=), opened when the viewer sees it live or edits it; else the language's default
	V string
	// the language whose default version opens; the site's first language, then any, when it has none
	Language string
}

GetContentReaderQuery is the query of GetContentReader.

type GetContentSimilarQuery added in v0.81.0

type GetContentSimilarQuery struct {
	// only this content kind
	Kind string
	// bounded public card hydration: 1-100 content ids, under all current visibility, domain and reader filters
	Ids []string
	// group ids every listed version is in; a position sort orders by the first
	Entities []string
	// primary channel ids: only content one of them owns
	ChannelId []string
	// user ids: only content one of them is credited on
	Creators []string
	// public (what anyone opens now), tier, group, ppv or group_ppv (what stays locked at that level): only content at one of them
	Access []string
	// configured tiers: only content locked behind one of them
	Tiers []string
	// version traits every listed version has
	Traits []string
	// name:value of one of the kind's filterable attributes; repeat for more
	Attribute []string
	// published on this day (YYYY-MM-DD) or month (YYYY-MM)
	ReleasedOn string
	// the IANA time zone of released_on and release dates; UTC by default
	Tz string
	// the reader's unseen (new to them: never opened or hidden), in_progress or completed contents; a signed-out reader's by its anonymous id
	ViewStatus string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// 12 by default, at most 50
	Limit int
	// lower-bound counts within considered candidates
	Summary *bool
}

GetContentSimilarQuery is the query of GetContentSimilar.

type GetContentVersionArchiveQuery added in v0.87.0

type GetContentVersionArchiveQuery struct {
	// the viewer the ticket is for
	For string
	// the bound account in this tenant
	Account string
	// signed tenant membership presence: true or false
	AccountSet string
	// the viewer subject kind
	Kind string
	// signed exact-transfer editor capability: true or false
	Editor string
	// signed configured token-tier claims as a JSON string array
	Claims string
	// the pages to mark, from 1: 3,5,7
	Mark string
	// the attachment file name
	Name string
	// true for a signed exact single-file transfer
	File string
	// the exact ordered source revision
	Revision string
	// the exact authorized ZIP page count
	Pages string
	// the download's ticket
	Ticket string
}

GetContentVersionArchiveQuery is the query of GetContentVersionArchive.

type GetContentVersionQuery added in v0.81.0

type GetContentVersionQuery struct {
	// the language to show text in; the site's first language, then any, when it has none
	Language string
}

GetContentVersionQuery is the query of GetContentVersion.

type GetContentsQuery added in v0.81.0

type GetContentsQuery struct {
	// only this content kind
	Kind string
	// bounded public card hydration: 1-100 content ids, under all current visibility, domain and reader filters
	Ids []string
	// group ids every listed version is in; a position sort orders by the first
	Entities []string
	// primary channel ids: only content one of them owns
	ChannelId []string
	// user ids: only content one of them is credited on
	Creators []string
	// public (what anyone opens now), tier, group, ppv or group_ppv (what stays locked at that level): only content at one of them
	Access []string
	// configured tiers: only content locked behind one of them
	Tiers []string
	// version traits every listed version has
	Traits []string
	// name:value of one of the kind's filterable attributes; repeat for more
	Attribute []string
	// published on this day (YYYY-MM-DD) or month (YYYY-MM)
	ReleasedOn string
	// the IANA time zone of released_on and release dates; UTC by default
	Tz string
	// the reader's unseen (new to them: never opened or hidden), in_progress or completed contents; a signed-out reader's by its anonymous id
	ViewStatus string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// newest, oldest, title, popular (needs kind; pages by cursor), top_rated, most_favorited, position or random; the kind's default, else newest
	Sort string
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// selection-wide total, filtered and locked counts on the first page or every numbered page
	Summary *bool
	// the popular sort's window of activity days: week (the default), 30d, 90d, year, all, month:YYYY-MM, year:YYYY or YYYY-MM-DD..YYYY-MM-DD (last day included)
	Window string
	// the previous page's next_cursor
	Cursor string
	// page size: 24 by default, at most 100
	Limit int
	// a numbered page from 1 instead of cursor; summary then comes with every page; page × limit is at most 10,000
	Page int
}

GetContentsQuery is the query of GetContents.

type GetEntitiesQuery added in v0.93.0

type GetEntitiesQuery struct {
	// only entities of this kind
	Kind string
	// only children of this entity
	Parent string
	// only entities scoped by this entity
	Scope string
	// only the entity with this slug
	Slug string
	// only sort names starting with this letter (a-z), or with anything else (#)
	Letter string
	// the language names, text and slugs resolve in, counts are scoped to and paths are prefixed with
	Language string
	// count contents of this kind; every kind by default
	ContentKind string
	// popular (the default with kind: its popularity on this site over window, then the entities without activity by count), name (the default without kind), count or newest
	Sort string
	// the popular sort's window: week (the default), 30d, 90d, year, all, month:YYYY-MM, year:YYYY or YYYY-MM-DD..YYYY-MM-DD
	Window string
	// the previous page's next_cursor
	Cursor string
	// a numbered page from 1 instead of cursor, with the total; page × limit is at most 10,000
	Page int
	// page size: 50 by default, at most 200
	Limit int
}

GetEntitiesQuery is the query of GetEntities.

type GetEntityMembersQuery added in v0.93.0

type GetEntityMembersQuery struct {
	// the previous page's next_cursor
	Cursor string
	// page size: 50 by default, at most 500
	Limit int
}

GetEntityMembersQuery is the query of GetEntityMembers.

type GetEntityQuery added in v0.93.0

type GetEntityQuery struct {
	// the language names, text and slugs resolve in, counts are scoped to and paths are prefixed with
	Language string
}

GetEntityQuery is the query of GetEntity.

type GetEventsQuery added in v0.116.0

type GetEventsQuery struct {
	// opaque continuation from the previous page
	After string
	// page size: 100 by default, at most 500
	Limit int
	// legacy comma-separated event types; ignored when type is provided
	Types []string
	// exact event types; repeat for multiple values and keep the same selection with a cursor
	Type []string
}

GetEventsQuery is the query of GetEvents.

type GetGlobalCommentBansQuery added in v0.81.0

type GetGlobalCommentBansQuery struct {
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetGlobalCommentBansQuery is the query of GetGlobalCommentBans.

type GetManageChannelQuery added in v0.131.0

type GetManageChannelQuery struct {
	// display language
	Language string
}

GetManageChannelQuery is the query of GetManageChannel.

type GetManageChannelsQuery added in v0.131.0

type GetManageChannelsQuery struct {
	// display language
	Language string
	// canonical channel slug
	Slug string
	// substring of a channel name or slug
	Q string
	// previous next_cursor
	Cursor string
	// maximum results, at most 200
	Limit int
	// name, count or newest
	Sort string
	// active or deleted
	State string
}

GetManageChannelsQuery is the query of GetManageChannels.

type GetManageCountQuery added in v0.104.0

type GetManageCountQuery struct {
	// draft, scheduled, published or deleted
	State string
	// only this primary channel's content, which the caller edits
	ChannelId string
	// only items whose own rule has this level: public, tier, group, ppv or group_ppv
	Access string
	// only items whose rule names this configured tier
	Tier string
	// only items whose title, description or body contains this text, ignoring case
	Q string
}

GetManageCountQuery is the query of GetManageCount.

type GetManageEntitiesMatchQuery added in v0.135.0

type GetManageEntitiesMatchQuery struct {
	// required: the entity kind
	Kind string
	// the entity the names are unique within; unscoped entities by default
	Scope string
	// match names in this language only; every language by default
	Language string
	// compare ContentKit's normalized forms, folding case, accents and whitespace; exact text by default
	Normalized *bool
	// required: 1-100 whole names; repeat for each
	Name []string
}

GetManageEntitiesMatchQuery is the query of GetManageEntitiesMatch.

type GetManageEntitiesQuery added in v0.97.0

type GetManageEntitiesQuery struct {
	// only these entity ids (at most 100), in every state; one page, without state, cursor or page
	Ids []string
	// active (the default) or deleted, the restorable ones
	State string
	// only entities of this kind
	Kind string
	// only children of this entity
	Parent string
	// only entities scoped by this entity
	Scope string
	// only the entity with this slug
	Slug string
	// match a canonical name, alias or slug; sorted by name, the exact matches come first
	Q string
	// only sort names starting with this letter
	Letter string
	// the language names, text and slugs resolve in, counts are scoped to and paths are prefixed with
	Language string
	// count contents of this kind
	ContentKind string
	// name (the default), count, newest or popular
	Sort string
	// the popular sort's window, as for the public listing
	Window string
	// the previous page's next_cursor
	Cursor string
	// page size: at most 200
	Limit int
}

GetManageEntitiesQuery is the query of GetManageEntities.

type GetManageEntityQuery added in v0.97.0

type GetManageEntityQuery struct {
	// the language names, text and slugs resolve in, counts are scoped to and paths are prefixed with
	Language string
}

GetManageEntityQuery is the query of GetManageEntity.

type GetManageKindQuery added in v0.93.0

type GetManageKindQuery struct {
	// draft, scheduled, published or deleted
	State string
	// only this primary channel's content, which the caller edits
	ChannelId string
	// only items whose own rule has this level: public, tier, group, ppv or group_ppv
	Access string
	// only items whose rule names this configured tier
	Tier string
	// only items whose title, description or body contains this text, ignoring case
	Q string
	// only the item with this content code (any spelling), in every state unless state narrows it
	Code string
	// only these content ids (at most 100), in every state unless state narrows it
	Ids []string
	// the language to show text in; the site's first language, then any, when it has none
	Language string
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetManageKindQuery is the query of GetManageKind.

type GetManageQuery added in v0.93.0

type GetManageQuery struct {
	// draft, scheduled, published (live) or deleted; every state but deleted by default
	State string
	// only this primary channel's content, which the caller edits
	ChannelId string
	// only items whose own rule has this level: public, tier, group, ppv or group_ppv
	Access string
	// only items whose rule names this configured tier
	Tier string
	// only items whose title, description or body contains this text, ignoring case
	Q string
	// only the item with this content code (any spelling), in every state unless state narrows it
	Code string
	// only these content ids (at most 100), in every state unless state narrows it
	Ids []string
	// the language to show text in; the site's first language, then any, when it has none
	Language string
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetManageQuery is the query of GetManage.

type GetManageSearchSuggestionsQuery added in v0.104.0

type GetManageSearchSuggestionsQuery struct {
	// the partial name
	Q string
	// configured content kinds; all only when include_contents is explicitly true
	ContentKinds []string
	// configured entity kinds; all only when include_entities is explicitly true
	EntityKinds []string
	// explicitly request authorized content targets
	IncludeContents *bool
	// explicitly request entity targets; requires entity-management authority
	IncludeEntities *bool
	// configured name language; normal text fallback applies
	DisplayLanguage string
	// per section: 8 by default, from 1 through 20
	Limit int
}

GetManageSearchSuggestionsQuery is the query of GetManageSearchSuggestions.

type GetMeChannelsQuery added in v0.131.0

type GetMeChannelsQuery struct {
	// display language
	Language string
	// canonical channel slug
	Slug string
	// substring of a channel name or slug
	Q string
	// previous next_cursor
	Cursor string
	// maximum results, at most 200
	Limit int
	// name, count or newest
	Sort string
}

GetMeChannelsQuery is the query of GetMeChannels.

type GetMeContinueQuery added in v0.141.0

type GetMeContinueQuery struct {
	// only this content kind
	Kind string
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// the previous page's next_cursor
	Cursor string
	// page size: 24 by default, at most 100
	Limit int
}

GetMeContinueQuery is the query of GetMeContinue.

type GetMeFavoritesQuery added in v0.81.0

type GetMeFavoritesQuery struct {
	// contents (the default) or channels
	Target string
	// only this content kind
	Kind string
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// the previous page's next_cursor
	Cursor string
	// page size: 24 by default, at most 100
	Limit int
	// a numbered page from 1 instead of cursor; summary then comes with every page; page × limit is at most 10,000
	Page int
	// this caller's matching content total, filtered and locked counts on the first page or every numbered page
	Summary *bool
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
}

GetMeFavoritesQuery is the query of GetMeFavorites.

type GetMeHistoryQuery added in v0.81.0

type GetMeHistoryQuery struct {
	// only this content kind
	Kind string
	// seen, in_progress or completed; any by default
	Status string
	// selection-wide total, filtered and locked counts on the first page or every numbered page
	Summary *bool
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// the previous page's next_cursor
	Cursor string
	// page size: 24 by default, at most 100
	Limit int
	// a numbered page from 1 instead of cursor; summary then comes with every page; page × limit is at most 10,000
	Page int
}

GetMeHistoryQuery is the query of GetMeHistory.

type GetMeLibraryQuery added in v0.81.0

type GetMeLibraryQuery struct {
	// title language
	Language string
	// previous next_cursor
	Cursor string
	// page size: 20 by default, at most 100
	Limit int
}

GetMeLibraryQuery is the query of GetMeLibrary.

type GetMeSearchesQuery added in v0.81.0

type GetMeSearchesQuery struct {
	// 10 by default, at most 100
	Limit int
}

GetMeSearchesQuery is the query of GetMeSearches.

type GetMediaHlsQuery added in v0.81.0

type GetMediaHlsQuery struct {
	// audio languages the master playlist keeps; empty keeps none
	Audio []string
	// subtitle languages the master playlist keeps; empty keeps none
	Subs []string
	// explicit administrative inspection; current authority is rechecked
	Editor bool
}

GetMediaHlsQuery is the query of GetMediaHls.

type GetMediaQuery added in v0.81.0

type GetMediaQuery struct {
	// only files under this path prefix, e.g. low-res/
	Prefix string
	// at most 64 exact paths to sign, without offset or limit; all authorized metadata remains listed
	Path []string
	// files to skip before the URLs start
	Offset int
	// files that get URLs
	Limit int
	// URLs carry their download names
	Download bool
	// editors: uploads with edits, failures, progress and editor views
	Editor bool
	// editors: whole-item processing counts only, without URLs, media grants or editor-view work; Accept: text/event-stream observes retained progress
	Status bool
	// SSE reconnect cursor; Last-Event-ID is also accepted. Retention expiry sends a resync snapshot
	After string
}

GetMediaQuery is the query of GetMedia.

type GetMediaVersionHlsQuery added in v0.81.0

type GetMediaVersionHlsQuery struct {
	// audio languages the master playlist keeps; empty keeps none
	Audio []string
	// subtitle languages the master playlist keeps; empty keeps none
	Subs []string
	// explicit administrative inspection; current authority is rechecked
	Editor bool
}

GetMediaVersionHlsQuery is the query of GetMediaVersionHls.

type GetMediaVersionQuery added in v0.81.0

type GetMediaVersionQuery struct {
	// only files under this path prefix, e.g. low-res/
	Prefix string
	// at most 64 exact paths to sign, without offset or limit; all authorized metadata remains listed
	Path []string
	// files to skip before the URLs start
	Offset int
	// files that get URLs
	Limit int
	// URLs carry their download names
	Download bool
	// editors: uploads with edits, failures, progress and editor views
	Editor bool
	// editors: whole-item processing counts only, without URLs, media grants or editor-view work; Accept: text/event-stream observes retained progress
	Status bool
	// SSE reconnect cursor; Last-Event-ID is also accepted. Retention expiry sends a resync snapshot
	After string
}

GetMediaVersionQuery is the query of GetMediaVersion.

type GetModerationHeldQuery added in v0.81.0

type GetModerationHeldQuery struct {
	// comment
	Kind string
	// the previous page's next
	Cursor string
	// page size: 20 by default, at most 100
	Limit int
}

GetModerationHeldQuery is the query of GetModerationHeld.

type GetModerationLocationRuleHistoryQuery added in v0.138.23

type GetModerationLocationRuleHistoryQuery struct {
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetModerationLocationRuleHistoryQuery is the query of GetModerationLocationRuleHistory.

type GetModerationLocationRulesCheckQuery added in v0.138.23

type GetModerationLocationRulesCheckQuery struct {
	// IPv4 or IPv6 address
	Ip string
}

GetModerationLocationRulesCheckQuery is the query of GetModerationLocationRulesCheck.

type GetModerationLocationRulesHistoryQuery added in v0.138.23

type GetModerationLocationRulesHistoryQuery struct {
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetModerationLocationRulesHistoryQuery is the query of GetModerationLocationRulesHistory.

type GetModerationLocationRulesQuery added in v0.138.23

type GetModerationLocationRulesQuery struct {
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetModerationLocationRulesQuery is the query of GetModerationLocationRules.

type GetPollsAdminQuery added in v0.81.0

type GetPollsAdminQuery struct {
	// only polls in this language
	Language string
	// only polls live in this month, YYYY-MM
	Month string
	// only polls live on this day, YYYY-MM-DD
	Date string
	// only live, scheduled, closed or inactive polls
	State string
	// only polls whose question contains this, ignoring case
	Q string
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetPollsAdminQuery is the query of GetPollsAdmin.

type GetPollsQuery added in v0.81.0

type GetPollsQuery struct {
	// only polls in this language
	Language string
	// only polls live in this month, YYYY-MM
	Month string
	// only polls live on this day, YYYY-MM-DD
	Date string
	// page size: 20 by default, at most 100
	Limit int
	// items to skip
	Offset int
}

GetPollsQuery is the query of GetPolls.

type GetRecommendationsQuery added in v0.81.0

type GetRecommendationsQuery struct {
	// only this content kind
	Kind string
	// bounded public card hydration: 1-100 content ids, under all current visibility, domain and reader filters
	Ids []string
	// group ids every listed version is in; a position sort orders by the first
	Entities []string
	// primary channel ids: only content one of them owns
	ChannelId []string
	// user ids: only content one of them is credited on
	Creators []string
	// public (what anyone opens now), tier, group, ppv or group_ppv (what stays locked at that level): only content at one of them
	Access []string
	// configured tiers: only content locked behind one of them
	Tiers []string
	// version traits every listed version has
	Traits []string
	// name:value of one of the kind's filterable attributes; repeat for more
	Attribute []string
	// published on this day (YYYY-MM-DD) or month (YYYY-MM)
	ReleasedOn string
	// the IANA time zone of released_on and release dates; UTC by default
	Tz string
	// the reader's unseen (new to them: never opened or hidden), in_progress or completed contents; a signed-out reader's by its anonymous id
	ViewStatus string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// 12 by default, at most 50
	Limit int
	// lower-bound counts within considered candidates
	Summary *bool
}

GetRecommendationsQuery is the query of GetRecommendations.

type GetReleaseDatesQuery added in v0.81.0

type GetReleaseDatesQuery struct {
	// month (the default) or day
	By string
	// only this content kind
	Kind string
	// bounded public card hydration: 1-100 content ids, under all current visibility, domain and reader filters
	Ids []string
	// group ids every listed version is in; a position sort orders by the first
	Entities []string
	// primary channel ids: only content one of them owns
	ChannelId []string
	// user ids: only content one of them is credited on
	Creators []string
	// public (what anyone opens now), tier, group, ppv or group_ppv (what stays locked at that level): only content at one of them
	Access []string
	// configured tiers: only content locked behind one of them
	Tiers []string
	// version traits every listed version has
	Traits []string
	// name:value of one of the kind's filterable attributes; repeat for more
	Attribute []string
	// published on this day (YYYY-MM-DD) or month (YYYY-MM)
	ReleasedOn string
	// the IANA time zone of released_on and release dates; UTC by default
	Tz string
	// the reader's unseen (new to them: never opened or hidden), in_progress or completed contents; a signed-out reader's by its anonymous id
	ViewStatus string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// the previous page's next_cursor
	Cursor string
	// 60 by default, at most 1000
	Limit int
}

GetReleaseDatesQuery is the query of GetReleaseDates.

type GetReleasesQuery added in v0.95.0

type GetReleasesQuery struct {
	// only this content kind
	Kind string
	// bounded public card hydration: 1-100 content ids, under all current visibility, domain and reader filters
	Ids []string
	// group ids every listed version is in; a position sort orders by the first
	Entities []string
	// primary channel ids: only content one of them owns
	ChannelId []string
	// user ids: only content one of them is credited on
	Creators []string
	// public (what anyone opens now), tier, group, ppv or group_ppv (what stays locked at that level): only content at one of them
	Access []string
	// configured tiers: only content locked behind one of them
	Tiers []string
	// version traits every listed version has
	Traits []string
	// name:value of one of the kind's filterable attributes; repeat for more
	Attribute []string
	// the reader's unseen (new to them: never opened or hidden), in_progress or completed contents; a signed-out reader's by its anonymous id
	ViewStatus string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// calendar days including end_date: 10 by default, from 1 through 31
	Days int
	// inclusive YYYY-MM-DD in time_zone; today by default; future dates are rejected
	EndDate string
	// IANA zone for calendar-day boundaries; UTC by default
	TimeZone string
}

GetReleasesQuery is the query of GetReleases.

type GetSearchQuery added in v0.81.0

type GetSearchQuery struct {
	// the query
	Q string
	// only this content kind
	Kind string
	// bounded public card hydration: 1-100 content ids, under all current visibility, domain and reader filters
	Ids []string
	// group ids every listed version is in; a position sort orders by the first
	Entities []string
	// primary channel ids: only content one of them owns
	ChannelId []string
	// user ids: only content one of them is credited on
	Creators []string
	// public (what anyone opens now), tier, group, ppv or group_ppv (what stays locked at that level): only content at one of them
	Access []string
	// configured tiers: only content locked behind one of them
	Tiers []string
	// version traits every listed version has
	Traits []string
	// name:value of one of the kind's filterable attributes; repeat for more
	Attribute []string
	// published on this day (YYYY-MM-DD) or month (YYYY-MM)
	ReleasedOn string
	// the IANA time zone of released_on and release dates; UTC by default
	Tz string
	// the reader's unseen (new to them: never opened or hidden), in_progress or completed contents; a signed-out reader's by its anonymous id
	ViewStatus string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// relevance (the default) or a list sort of every match
	Sort string
	// the group kinds cards name; every kind with a page by default
	CardEntities []string
	// selection-wide total, filtered and locked counts on the first page or every numbered page
	Summary *bool
	// false ranks the reader's results as anyone's
	Personalize *bool
	// the popular sort's window of activity days: week (the default), 30d, 90d, year, all, month:YYYY-MM, year:YYYY or YYYY-MM-DD..YYYY-MM-DD (last day included)
	Window string
	// the previous page's next_cursor
	Cursor string
	// page size: 24 by default, at most 100
	Limit int
	// a numbered page from 1 instead of cursor; summary then comes with every page; page × limit is at most 10,000
	Page int
}

GetSearchQuery is the query of GetSearch.

type GetSitemapContentsQuery added in v0.85.0

type GetSitemapContentsQuery struct {
	// the content kind; required
	Kind string
	// the previous page's next_cursor
	Cursor string
	// page size: 1000 by default, at most 10000
	Limit int
}

GetSitemapContentsQuery is the query of GetSitemapContents.

type GetSitemapEntitiesQuery added in v0.93.0

type GetSitemapEntitiesQuery struct {
	// the group kind; required
	Kind string
	// the previous page's next_cursor
	Cursor string
	// page size: 1000 by default, at most 10000
	Limit int
}

GetSitemapEntitiesQuery is the query of GetSitemapEntities.

type GetStatsActiveQuery added in v0.141.0

type GetStatsActiveQuery struct {
	// the last days, today included: 10 by default, at most 90
	Days int
}

GetStatsActiveQuery is the query of GetStatsActive.

type GetTypeaheadQuery added in v0.81.0

type GetTypeaheadQuery struct {
	// the partial query
	Q string
	// only contents of this kind
	Kind string
	// the group kinds suggested; every kind with a page by default
	EntityKinds []string
	// only content with a live version in this language
	Language string
	// the language of titles, group names and paths, and the preferred language of each card's version; language by default
	DisplayLanguage string
	// lock (the default: everything listed, locked cards marked) or hide (only what the reader opens)
	Mode string
	// per section: 8 by default, at most 20
	Limit int
}

GetTypeaheadQuery is the query of GetTypeahead.

type GetVersionQuery added in v0.114.0

type GetVersionQuery struct {
	// the language to show text in; the site's first language, then any, when it has none
	Language string
}

GetVersionQuery is the query of GetVersion.

type GetVersionsQuery added in v0.135.0

type GetVersionsQuery struct {
	// required: 1-100 version ids
	Ids []string
}

GetVersionsQuery is the query of GetVersions.

type InteractionsConfig added in v0.81.0

type InteractionsConfig struct {
	// Anonymous is what signed-out visitors may do; zero lets them only read.
	Anonymous content.Anonymous `yaml:"anonymous" json:"anonymous"`
	// CommentMaxLength is the longest comment in characters; 0 is the default.
	CommentMaxLength int `yaml:"comment_max_length" json:"comment_max_length"`
	// DuplicateWindow refuses identical comments within this duration; zero disables it.
	DuplicateWindow time.Duration `yaml:"duplicate_window" json:"duplicate_window"`
	// Limits are the per-actor rate limits, shared through Deps.Redis;
	// Engine.Client has none.
	Limits LimitsConfig `yaml:"limits" json:"limits"`
	// ModeratorTimeout bounds one moderation call (default 5s);
	// ModeratorCooldown is how long writes are held after it failed
	// repeatedly (default 30s).
	ModeratorTimeout  time.Duration `yaml:"moderator_timeout" json:"moderator_timeout"`
	ModeratorCooldown time.Duration `yaml:"moderator_cooldown" json:"moderator_cooldown"`
	// Feedback is when readers are asked why they liked, favorited or
	// disliked content; a kind it does not name is never asked about.
	Feedback discovery.FeedbackConfig `yaml:"feedback" json:"feedback"`
}

InteractionsConfig configures the content module.

type IssuanceConfig added in v0.81.0

type IssuanceConfig struct {
	PerHour          int  `yaml:"per_hour" json:"per_hour"`
	AnonymousPerHour int  `yaml:"anonymous_per_hour" json:"anonymous_per_hour"`
	Disabled         bool `yaml:"disabled" json:"disabled"`
}

IssuanceConfig is media.Issuance as data.

type JobsConfig added in v0.81.0

type JobsConfig struct {
	// MaxWorkers is the queue's concurrency; 0 is 2.
	MaxWorkers int `yaml:"max_workers" json:"max_workers"`
}

JobsConfig sizes the engine's own River queue.

type LimitsConfig added in v0.81.0

type LimitsConfig struct {
	Disabled        bool   `yaml:"disabled" json:"disabled"`
	Comment         []Rate `yaml:"comment" json:"comment"`
	CommentReaction []Rate `yaml:"comment_reaction" json:"comment_reaction"`
	Reaction        []Rate `yaml:"reaction" json:"reaction"`
	Favorite        []Rate `yaml:"favorite" json:"favorite"`
	PollVote        []Rate `yaml:"poll_vote" json:"poll_vote"`
	// AnonymousReaction counts the signed-out browsers reacting to one
	// target from one client address (default 10 per day).
	AnonymousReaction []Rate `yaml:"anonymous_reaction" json:"anonymous_reaction"`
}

LimitsConfig is content.Limits as data: nil rates take the defaults.

type MediaCommitError added in v0.125.0

type MediaCommitError struct {
	Commit media.CommitBody
	Err    error
}

MediaCommitError retains the exact batch whose result was not confirmed. When Err permits a retry, persist Commit and resend it with PostMediaUploadCommit; do not repeat the upload or assign a new operation ID. Err remains available through Unwrap. Commit contains file references and metadata, never signed storage URLs.

func (*MediaCommitError) Error added in v0.125.0

func (e *MediaCommitError) Error() string

func (*MediaCommitError) Unwrap added in v0.125.0

func (e *MediaCommitError) Unwrap() error

type MediaConfig added in v0.81.0

type MediaConfig struct {
	media.Config `yaml:",inline"`
	// WorkerSchema holds the media worker's queue (cmd/media-worker's
	// MEDIA_WORKER_SCHEMA); empty is Database.Schema plus "_media_worker".
	WorkerSchema string         `yaml:"worker_schema" json:"worker_schema"`
	Delivery     DeliveryConfig `yaml:"delivery" json:"delivery"`
	// ProcessOnUpload has the SDK commit each upload as soon as it lands.
	ProcessOnUpload bool `yaml:"process_on_upload" json:"process_on_upload"`
	// CommitLimit limits each uploader's commits; ReadLimit each viewer's
	// reads, never Engine.Client's. Zero takes media's defaults; Deps.Redis
	// shares them.
	CommitLimit RateLimitConfig `yaml:"commit_limit" json:"commit_limit"`
	ReadLimit   RateLimitConfig `yaml:"read_limit" json:"read_limit"`
	// Issuance limits the items each viewer opens per hour.
	Issuance IssuanceConfig `yaml:"issuance" json:"issuance"`
	// Downloads are the version download quotas (anonymous, user, tiers)
	// and how long a file download's URL lasts; Deps.Redis shares them.
	Downloads versions.Downloads `yaml:"downloads" json:"downloads"`
}

MediaConfig is the media registry (media.Config, rooted at the engine's Scope; content kinds' media are their versions', and each entity kind gains cover media, media.ForContent) and how ContentKit serves it.

type MediaFile added in v0.81.0

type MediaFile struct {
	// Path is its upload path ("originals/0001.png"); a named path's {name}
	// is chosen by the server.
	Path string
	Type string
	// Body is read twice: hashed, then sent.
	Body io.ReadSeeker
	// From instead copies this key of the item's bucket, outside
	// ContentKit's namespaces, server-side (root:import:write); Size, when
	// set, is checked against it.
	From string
	Size int64
	Meta map[string]any
	// Dir is a page's directory: the ID of one of the call's directories or
	// one the version has; "" the top level. The page is named by its
	// directory and name, so a re-sent page replaces itself, never another
	// directory's page of the same name.
	Dir string
}

MediaFile is one file IngestMedia uploads.

type MediaProgress added in v0.126.1

type MediaProgress struct {
	Event  string
	Cursor string
	Read   *media.ReadResult
}

MediaProgress is a current authorized status snapshot from the retained processing stream. Resync means the previous cursor fell outside retention. Heartbeats carry a cursor but no Read. Persist a cursor only after handling its observation; cursors are scoped to the server's selected event log.

type MigrationOptions added in v0.89.0

type MigrationOptions struct {
	// Scopes is the same app-bound provider used by Deps.Scopes. It is required
	// only when a configured fixed owner has auth_scope enabled. Migration
	// ensures those groups without changing their existing role assignments.
	Scopes entities.ScopeProvisioner
	// SkipQueues skips main River and media-worker queue migrations, matching
	// a host command's --skip-river option. Account/catalog migrations still run.
	SkipQueues bool
	// contains filtered or unexported fields
}

MigrationOptions controls the explicit migration command. Runtime startup validation is unaffected and still requires every configured schema.

type PatchContentFeedbackQuery added in v0.141.0

type PatchContentFeedbackQuery struct {
	// the language of entity names
	Language string
}

PatchContentFeedbackQuery is the query of PatchContentFeedback.

type PatchMeContentFiltersQuery added in v0.103.0

type PatchMeContentFiltersQuery struct {
	// the language of labels and group names
	Language string
}

PatchMeContentFiltersQuery is the query of PatchMeContentFilters.

type PermissionTarget added in v0.89.0

type PermissionTarget struct {
	Permission string
	ChannelID  string
}

PermissionTarget identifies an operation in an engine's fixed tenant/app. An empty ChannelID addresses app staff authority; a nonempty ChannelID addresses a channel's stored authorization scope. It is not an app selector.

type PostCodesAliasesQuery added in v0.83.0

type PostCodesAliasesQuery struct {
	// the language of the paths' prefix and slug; the site's default by default
	Lang string
}

PostCodesAliasesQuery is the query of PostCodesAliases.

type PostContentCommentsQuery added in v0.81.0

type PostContentCommentsQuery struct {
	// one version of the content item; the item itself by default
	Version string
}

PostContentCommentsQuery is the query of PostContentComments.

type PostContentDislikeQuery added in v0.81.0

type PostContentDislikeQuery struct {
	// one version of the content item; the item itself by default
	Version string
}

PostContentDislikeQuery is the query of PostContentDislike.

type PostContentFavoriteQuery added in v0.81.0

type PostContentFavoriteQuery struct {
	// one version of the content item; the item itself by default
	Version string
}

PostContentFavoriteQuery is the query of PostContentFavorite.

type PostContentFeedbackQuery added in v0.141.0

type PostContentFeedbackQuery struct {
	// the version the reaction is on
	Version string
	// the language of entity names
	Language string
}

PostContentFeedbackQuery is the query of PostContentFeedback.

type PostContentLikeQuery added in v0.81.0

type PostContentLikeQuery struct {
	// one version of the content item; the item itself by default
	Version string
}

PostContentLikeQuery is the query of PostContentLike.

type PostMeContentFiltersMergeQuery added in v0.141.0

type PostMeContentFiltersMergeQuery struct {
	// the language of labels and group names
	Language string
}

PostMeContentFiltersMergeQuery is the query of PostMeContentFiltersMerge.

type Probe added in v0.81.0

type Probe struct {
	// Name is stable for dashboards: contentkit_clickhouse,
	// contentkit_media_store, contentkit_redis, contentkit_moderator.
	Name string
	// Check returns nil while the dependency is usable; it honors ctx.
	Check func(context.Context) error
}

Probe checks one optional dependency.

type PutContentEntitiesQuery added in v0.93.0

type PutContentEntitiesQuery struct {
	// the language names, text and slugs resolve in, counts are scoped to and paths are prefixed with
	Language string
}

PutContentEntitiesQuery is the query of PutContentEntities.

type PutContentEntitiesSharedQuery added in v0.106.0

type PutContentEntitiesSharedQuery struct {
	// the language names, text and slugs resolve in, counts are scoped to and paths are prefixed with
	Language string
}

PutContentEntitiesSharedQuery is the query of PutContentEntitiesShared.

type PutContentVersionEntitiesQuery added in v0.106.0

type PutContentVersionEntitiesQuery struct {
	// the language names, text and slugs resolve in, counts are scoped to and paths are prefixed with
	Language string
}

PutContentVersionEntitiesQuery is the query of PutContentVersionEntities.

type Rate added in v0.81.0

type Rate struct {
	Count int           `yaml:"count" json:"count"`
	Per   time.Duration `yaml:"per" json:"per"`
}

Rate is Count actions per Per.

type RateLimitConfig added in v0.81.0

type RateLimitConfig struct {
	PerSecond float64 `yaml:"per_second" json:"per_second"`
	Burst     int     `yaml:"burst" json:"burst"`
	Disabled  bool    `yaml:"disabled" json:"disabled"`
}

RateLimitConfig is media.RateLimit as data.

type Reconciled added in v0.135.0

type Reconciled struct {
	// Facets: listing facets, current access snapshots and search-document
	// marks rebuilt.
	Facets int
	// Paths: decorative content paths re-derived from their path entities.
	Paths int
	// Releases: released versions that lack a required upload
	// (media.Upload.Required), whose release was woken to withdraw them.
	Releases int
}

Reconciled counts the content items Reconcile repaired.

type Reply added in v0.81.0

type Reply struct {
	Status int
	Header http.Header
	Body   []byte
}

Reply is a success a generated method leaves undecoded: a stream, or a route answering several body types (Status says which).

func (*Reply) Decode added in v0.81.0

func (r *Reply) Decode(v any) error

Decode decodes the JSON body into v.

type Route added in v0.81.0

type Route struct {
	Method  string
	Path    string
	Handler http.Handler
}

Route is one HTTP registration on the host's root router: the API's subtree. Path ends in "/" and holds every path beneath it; Method is empty for every method. The Handler routes within the selected groups itself.

type RouteGroups added in v0.81.0

type RouteGroups uint

RouteGroups is a set of route entities.

const (
	// ContentRoutes: the content model (/v1/kinds), content items and their
	// versions, catalog totals, config, comments, reactions, favorites, polls,
	// comment bans and moderation (/v1).
	ContentRoutes RouteGroups = 1 << iota
	// UploadRoutes: media uploads and commits (/v1/media/upload).
	UploadRoutes
	// MediaRoutes: media reads and HLS playlists (/v1/media), and versions'
	// reader plans, reader metadata, forks and downloads
	// (/v1/contents/{id}/versions/{vid}/...).
	MediaRoutes
	// CodeRoutes: content-code lookup (/v1/codes).
	CodeRoutes
	// EntityRoutes: entity listings, pages and writes, and content's
	// memberships (/v1/entities, /v1/contents/{id}/entities).
	EntityRoutes
	// DiscoveryRoutes: lists, search, typeahead, similar and recommended
	// contents, release dates, the reader's content filters and history,
	// signals and exposures (/v1/contents, /v1/search, /v1/me/history, ...).
	DiscoveryRoutes
	// ImportRoutes: the bulk import a legacy importer writes through
	// (/v1/import).
	ImportRoutes

	// AllRoutes is every route group.
	AllRoutes = ContentRoutes | UploadRoutes | MediaRoutes | CodeRoutes | EntityRoutes | DiscoveryRoutes | ImportRoutes
)

func ParseRouteGroups added in v0.81.0

func ParseRouteGroups(names []string) (RouteGroups, error)

ParseRouteGroups reads route group names ("content", "upload", "media", "codes", "entities", "discovery", "import" or "all"), as a server's configuration lists them.

type Routes added in v0.81.0

type Routes struct {
	// Prefix is where the API is mounted: "/api/contentkit" serves
	// /api/contentkit/v1/*. Empty is the root.
	Prefix string
	// Groups are the route groups served. Required.
	Groups RouteGroups
}

Routes selects the HTTP surface: the route groups under Prefix.

type Schemas added in v0.139.0

type Schemas struct {
	Catalog, River, Accounts, MediaWorker, AccountWorker string
}

Schemas are the PostgreSQL schemas an engine owns. Catalog and Accounts hold tables; River, MediaWorker and AccountWorker are River queues, each elected and worked on its own. An unconfigured queue is "".

type Scope added in v0.89.0

type Scope struct {
	TenantID TenantID `json:"tenant_id" yaml:"tenant_id"`
	AppID    AppID    `json:"app_id" yaml:"app_id"`
}

Scope pins a runtime to a business and one of its apps. It identifies a trusted deployment context; it does not grant a request any permissions.

func (Scope) Validate added in v0.89.0

func (s Scope) Validate() error

type SiteBlock added in v0.138.23

type SiteBlock struct {
	content.VisitorLocation
	Kind   string `json:"kind"`
	RuleID string `json:"rule_id"`
}

SiteBlock describes the location and entry kind that matched a whole-site rule.

type TenantAccountAuthorization added in v0.92.0

type TenantAccountAuthorization interface {
	ResolveTenantAccount(context.Context, Scope, auth.Verified) (accountID string, member bool, err error)
}

TenantAccountAuthorization separates audience membership from administrative authority. A nonmember returns ("", false, nil); it may still hold a root permission to administer the target. The account must already exist and be owned by scope.TenantID. Errors fail closed. Existing custom Authorization implementations retain their trusted ResolveActor-as-account contract until they opt into cross-tenant actors through this interface.

type TenantID added in v0.89.0

type TenantID uuid.UUID

TenantID identifies the business owning an account directory and its apps. It is distinct from an OpenRails merchant ID and from any app ID.

func NewTenantID added in v0.89.0

func NewTenantID() TenantID

NewTenantID and NewAppID generate IDs for provisioning. Generate once and persist them; runtime startup must not generate new ownership identities.

func ParseTenantID added in v0.89.0

func ParseTenantID(s string) (TenantID, error)

ParseTenantID accepts a nonzero canonical lowercase UUID.

func (TenantID) IsZero added in v0.89.0

func (id TenantID) IsZero() bool

func (TenantID) MarshalText added in v0.89.0

func (id TenantID) MarshalText() ([]byte, error)

func (TenantID) String added in v0.89.0

func (id TenantID) String() string

func (*TenantID) UnmarshalText added in v0.89.0

func (id *TenantID) UnmarshalText(text []byte) error

Directories

Path Synopsis
Package access is ContentKit's access model: the Actor; the key grammar (<tenant>:content:<id>, <tenant>:content:<id>/<version>, <tenant>:group:<id> and configured tiers); rules stored on content, versions and entities; the Gate deciding versions from one billing read per request, its listing Filter and SQL over content_facets; and the Billing dependency.
Package access is ContentKit's access model: the Actor; the key grammar (<tenant>:content:<id>, <tenant>:content:<id>/<version>, <tenant>:group:<id> and configured tiers); rules stored on content, versions and entities; the Gate deciding versions from one billing read per request, its listing Filter and SQL over content_facets; and the Billing dependency.
adapters
authkit module
openrails module
Package catalog is ContentKit's own content: content items (a gallery, a movie, a creator or blog post), their per-language text, creators, versions with their text and segments, the state machine (draft, published, scheduled, deleted), the listing projection (content_facets), the one visibility rule every read applies, the retained event log and the catalog totals.
Package catalog is ContentKit's own content: content items (a gallery, a movie, a creator or blog post), their per-language text, creators, versions with their text and segments, the state machine (draft, published, scheduled, deleted), the listing projection (content_facets), the one visibility rule every read applies, the retained event log and the catalog totals.
Package channels manages authoring homes and their public identity.
Package channels manages authoring homes and their public identity.
cmd
media-gateway command
Command media-gateway is the media gateway (media/gateway).
Command media-gateway is the media gateway (media/gateway).
media-worker command
Command media-worker is the stock media worker (media/worker.Main), which registers no master hooks.
Command media-worker is the stock media worker (media/worker.Main), which registers no master hooks.
Package content is ContentKit's interaction module: comments, reactions, favorites and polls over tenant-scoped content references, stored in the host schema's content_* interaction tables.
Package content is ContentKit's interaction module: comments, reactions, favorites and polls over tenant-scoped content references, stored in the host schema's content_* interaction tables.
Package contentref defines the reference vocabulary every ContentKit package and port shares: a tenant-scoped reference to content and the identity of a entity.
Package contentref defines the reference vocabulary every ContentKit package and port shares: a tenant-scoped reference to content and the identity of a entity.
Package contenturl gives content uniform URLs, /{lang}/{route}/{CODE}[/{slug}]: the page's language (every page has one, the default included), a short random code ContentKit assigns once per content record (unique per tenant across every kind), a decorative slug, and the host's route for the content kind.
Package contenturl gives content uniform URLs, /{lang}/{route}/{CODE}[/{slug}]: the page's language (every page has one, the default included), a short random code ContentKit assigns once per content record (unique per tenant across every kind), a decorative slug, and the host's route for the content kind.
Package entities is how content is grouped: tags, artists, series, characters, channels, playlists and featured rails.
Package entities is how content is grouped: tags, artists, series, characters, channels, playlists and featured rails.
Package importer is ContentKit's bulk import, POST /v1/import: how a legacy importer writes content, entities, interactions and reading.
Package importer is ContentKit's bulk import, POST /v1/import: how a legacy importer writes content, entities, interactions and reading.
internal
activitylog
Package activitylog stamps the rows the API logs to ClickHouse's activity log: the subject, the site, the access tier, the local UTC offset and the time, all from the request.
Package activitylog stamps the rows the API logs to ClickHouse's activity log: the subject, the site, the access tier, the local UTC offset and the time, all from the request.
analytics
Package analytics is the job that folds ClickHouse's activity log into PostgreSQL's reading state and history and rebuilds the daily rollups.
Package analytics is the job that folds ClickHouse's activity log into PostgreSQL's reading state and history and rebuilds the daily rollups.
boundaries
Package boundaries holds a test enforcing ContentKit's package layering from the module's dependency graph (go list; no compilation or services).
Package boundaries holds a test enforcing ContentKit's package layering from the module's dependency graph (go list; no compilation or services).
clientaddr
Package clientaddr resolves a request's client address behind trusted proxies, and the key anonymous limits and reactions count a client under.
Package clientaddr resolves a request's client address behind trusted proxies, and the key anonymous limits and reactions count a client under.
codes
Package codes writes the content-code registry (content_codes) for the packages that own content: contenturl for host content, groups and content for ContentKit's own records.
Package codes writes the content-code registry (content_codes) for the packages that own content: contenturl for host content, groups and content for ContentKit's own records.
contract
Package contract renders ContentKit's route catalog (internal/httpapi) and error-code registry as the files other tools read: api/openapi.json, the Go client's methods (client_gen.go), the browser SDK's generated route table, wire types and error codes, and docs/api/routes.md.
Package contract renders ContentKit's route catalog (internal/httpapi) and error-code registry as the files other tools read: api/openapi.json, the Go client's methods (client_gen.go), the browser SDK's generated route table, wire types and error codes, and docs/api/routes.md.
contract/gen command
Command gen writes the files generated from the route catalog (go generate ./internal/contract).
Command gen writes the files generated from the route catalog (go generate ./internal/contract).
domainpolicy
Package domainpolicy resolves and applies per-content-kind domain rules.
Package domainpolicy resolves and applies per-content-kind domain rules.
edition
Package edition is the one default-version rule: the version a reader of a language opens by default is the first live version by position serving that language, else the first live version (contentkit-ui defaultVersion).
Package edition is the one default-version rule: the version a reader of a language opens by default is the first live version by position serving that language, else the first live version (contentkit-ui defaultVersion).
endpoint
Package endpoint checks the URLs a credential is sent to.
Package endpoint checks the URLs a credential is sent to.
gate
Package gate builds ContentKit's route gates from the host's auth.
Package gate builds ContentKit's route gates from the host's auth.
httpapi
Package httpapi is ContentKit's HTTP surface as data.
Package httpapi is ContentKit's HTTP surface as data.
hub
Package hub is the engine's search and signal planes for one tenant: keyword search and typeahead, and the ClickHouse signal plane.
Package hub is the engine's search and signal planes for one tenant: keyword search and typeahead, and the ClickHouse signal plane.
jobhook
Package jobhook lets ContentKit's own white-box tests work the engine's jobs on a River client they configure (a queue subset, one worker).
Package jobhook lets ContentKit's own white-box tests work the engine's jobs on a River client they configure (a queue subset, one worker).
jobqueue
Package jobqueue defines app-owned queues and shared purge time bounds.
Package jobqueue defines app-owned queues and shared purge time bounds.
locationpolicy
Package locationpolicy applies request-local location exclusions.
Package locationpolicy applies request-local location exclusions.
media/image
Package image is the media worker's image producer (libvips, CGO): the Image presets' WebP files, the public presets' images, editor views, and the kinds' default public images.
Package image is the media worker's image producer (libvips, CGO): the Image presets' WebP files, the public presets' images, editor views, and the kinds' default public images.
media/master
Package master makes uploads' masters: it runs a kind's recipe (media.Kind.Master) of registered hooks over each image and video upload's original and records the result, a lossless object of its own, or the original itself when no hook changed it.
Package master makes uploads' masters: it runs a kind's recipe (media.Kind.Master) of registered hooks over each image and video upload's original and records the result, a lossless object of its own, or the original itself when no hook changed it.
media/scratch
Package scratch gives a media worker process a scratch directory of its own under a root other processes may share.
Package scratch gives a media worker process a scratch directory of its own under a root other processes may share.
media/video
Package video runs an item's video-family presets with ffmpeg: HLS (a byte-range fMP4 ladder with the source's audio and text tracks and a seek sprite), MP4 (a muxed H.264 file at one rung), Audio (an HLS track and an M4A) and Subtitles (clean WebVTT), and grabs the frames of uploads that declare Upload.Frames.
Package video runs an item's video-family presets with ffmpeg: HLS (a byte-range fMP4 ladder with the source's audio and text tracks and a seek sprite), MP4 (a muxed H.264 file at one rung), Audio (an HLS track and an M4A) and Subtitles (clean WebVTT), and grabs the frames of uploads that declare Upload.Frames.
media/workqueue
Package workqueue is the host's side of the media worker (media/worker): the River schema it drains in the host database, insert-only enqueueing and cancelling of its jobs, and processing progress for the read API.
Package workqueue is the host's side of the media worker (media/worker): the River schema it drains in the host database, insert-only enqueueing and cancelling of its jobs, and processing progress for the read API.
migrations
Package migrations owns ContentKit's PostgreSQL and ClickHouse migrations.
Package migrations owns ContentKit's PostgreSQL and ClickHouse migrations.
normalize
Package normalize cleans user query text before retrieval.
Package normalize cleans user query text before retrieval.
outcomevalue
Package outcomevalue is what each outcome of a read is worth: P(sequel), the probability that the person would read a sequel, remake or enhanced version, per segment and outcome, and q, its place from -1 to +1 around the segment's base rate.
Package outcomevalue is what each outcome of a read is worth: P(sequel), the probability that the person would read a sequel, remake or enhanced version, per segment and outcome, and q, its place from -1 to +1 around the segment's base rate.
pglock
Package pglock holds Postgres session advisory locks on direct sessions of their own, outside the holder's pool: the work may use every connection of that pool, which may be a transaction pooler.
Package pglock holds Postgres session advisory locks on direct sessions of their own, outside the holder's pool: the work may use every connection of that pool, which may be a transaction pooler.
pgtest
Package pgtest provisions disposable keyword-profile schemas on the CONTENTKIT_TEST_URL Postgres for integration tests.
Package pgtest provisions disposable keyword-profile schemas on the CONTENTKIT_TEST_URL Postgres for integration tests.
rankings
Package rankings computes popularity from ClickHouse's content_daily and caches the ranked lists in Redis (in process without it).
Package rankings computes popularity from ClickHouse's content_daily and caches the ranked lists in Redis (in process without it).
ratelimit
Package ratelimit admits events per key against one or more sliding windows ("at most Limit in any Per"), in process or shared through Redis (or Garnet).
Package ratelimit admits events per key against one or more sliding windows ("at most Limit in any Per"), in process or shared through Redis (or Garnet).
readerprefs
Package readerprefs carries shared app-scoped entity preferences.
Package readerprefs carries shared app-scoped entity preferences.
readingstore
Package readingstore is the per-person reading state, interaction history and identity links in PostgreSQL that the analytics job writes from ClickHouse's activity log, and the immediate writes beside it: hide, sign-in links, clearing history, anonymous expiry and erasure.
Package readingstore is the per-person reading state, interaction history and identity links in PostgreSQL that the analytics job writes from ClickHouse's activity log, and the immediate writes beside it: hide, sign-in links, clearing history, anonymous expiry and erasure.
resolve
Package resolve is how ContentKit's modules ask whether content exists, is visible, opens and is edited by a viewer.
Package resolve is how ContentKit's modules ask whether content exists, is visible, opens and is edited by a viewer.
search
Package search is ContentKit's keyword retrieval over content_search_documents: exact names and aliases, literal substrings, prefixes and bounded typos for every language, with eligibility applied inside every indexed route.
Package search is ContentKit's keyword retrieval over content_search_documents: exact names and aliases, literal substrings, prefixes and bounded typos for every language, with eligibility applied inside every indexed route.
signalstore
Package signalstore is ContentKit's ClickHouse activity log: the batched intake, the outcome query over it, the daily rollups and erasure.
Package signalstore is ContentKit's ClickHouse activity log: the batched intake, the outcome query over it, the daily rollups and erasure.
subject
Package subject names the person an activity row, reading state or recent search belongs to: the account id when signed in, otherwise an id derived from the browser's anonymous id.
Package subject names the person an activity row, reading state or recent search belongs to: the account id when signed in, otherwise an id derived from the browser's anonymous id.
subjectfence
Package subjectfence serializes every write that stores an account id with that account's permanent erasure.
Package subjectfence serializes every write that stores an account id with that account's permanent erasure.
uuidv7
Package uuidv7 mints the ids ContentKit stores as time-ordered UUIDv7s: random ones dated now, and deterministic ones for idempotency keys, dated at an instant their inputs fix.
Package uuidv7 mints the ids ContentKit stores as time-ordered UUIDv7s: random ones dated now, and deterministic ones for idempotency keys, dated at an instant their inputs fix.
versionid
Package versionid carries a version id between Go, where a content key's is "" for the work itself (contentref.ContentKey), and Postgres, where no version is NULL.
Package versionid carries a version id between Go, where a content key's is "" for the work itself (contentref.ContentKey), and Postgres, where no version is NULL.
worker
Package worker maintains one tenant's keyword documents: it expands deferred marks, drains the dirty queue and runs a bounded cursor backfill, building every document from ContentKit's own records through its Sources (the catalog's content, the groups').
Package worker maintains one tenant's keyword documents: it expands deferred marks, drains the dirty queue and runs a bounded cursor backfill, building every document from ContentKit's own records through its Sources (the catalog's content, the groups').
Package kinds is the site's content model as configuration: content kinds, entity kinds, tiers, restrictions and domain visibility policies.
Package kinds is the site's content model as configuration: content kinds, entity kinds, tiers, restrictions and domain visibility policies.
Package media stores application media in a private bucket.
Package media stores application media in a private bucket.
avatar
Package avatar provides a user-avatar kind for ContentKit media registries.
Package avatar provides a user-avatar kind for ContentKit media registries.
gateway
Package gateway serves each media host's bucket: one app's, since the bucket is the tenancy boundary.
Package gateway serves each media host's bucket: one app's, since the bucket is the tenancy boundary.
layout
Package layout defines media object keys, dependency-free so the media gateway can classify paths without importing the media runtime.
Package layout defines media object keys, dependency-free so the media gateway can classify paths without importing the media runtime.
s3
Package s3 implements media.Store over aws-sdk-go-v2 for Ceph RGW (production) and MinIO (tests).
Package s3 implements media.Store over aws-sdk-go-v2 for Ceph RGW (production) and MinIO (tests).
token
Package token signs and verifies media access tokens, shared by the host signer and the media gateway so the format cannot drift:
Package token signs and verifies media access tokens, shared by the host signer and the media gateway so the format cannot drift:
versions
Package versions publishes content versions and binds their optional media.
Package versions publishes content versions and binds their optional media.
worker
Package worker is the media worker: the one process that places uploads and runs every producer, from the host's worker River schema (Config.Schema) in its database: staged uploads hashed and placed at their blobs, the kinds' master recipes (media.Kind.Master, with the host's Config.Hooks), images, public presets and editor views (libvips), and HLS, subtitles and frames (ffmpeg).
Package worker is the media worker: the one process that places uploads and runs every producer, from the host's worker River schema (Config.Schema) in its database: staged uploads hashed and placed at their blobs, the kinds' master recipes (media.Kind.Master, with the host's Config.Hooks), images, public presets and editor views (libvips), and HLS, subtitles and frames (ffmpeg).
server module
Package signal is the public surface of ContentKit's ClickHouse activity log: the connection it needs, its options and its errors.
Package signal is the public surface of ContentKit's ClickHouse activity log: the connection it needs, its options and its errors.

Jump to

Keyboard shortcuts

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