Documentation
¶
Overview ¶
Package events is the event contract of a gawk deployment (R51, docs/52).
Every event gawk emits — on the R50 NATS bus and in a webhook — is a CloudEvents 1.0 event in the JSON structured format (D1), whose `data` is described by one JSON Schema 2020-12 file per event type (D2, `schema/`), listed in one AsyncAPI 3.0 catalogue (D3, `asyncapi.yaml`). This package holds the envelope type, the Go form of every `data` shape, the type constants, the one encoder, and the embedded schema files, so that the relay (the bus producer), gawk-admin (the webhook producer, projector and server of the documents) and any third module import one definition rather than restating it — the `wire` posture (CLAUDE.md: reuse, never mirror).
It is deliberately public, and deliberately small: no CloudEvents SDK, no validator, no protocol binding. Producers marshal typed structs; the tests in this package prove the structs match the schemas (D7), and the schemas are what a consumer codes against.
The rules a new event type has to follow are in docs/52 D6; the tests here enforce them. Adding a type means, in one PR: a `Type*` constant here, its Data struct in data.go, `schema/<type>.json`, `testdata/vectors/<type>.json` plus its fixture in fixtures_test.go, and a message in `asyncapi.yaml` — under the `webhook` channel too if it may reach a webhook. `go test` names whatever is missing.
Index ¶
- Constants
- Variables
- func BusID(pod string, seq uint64) string
- func IsType(t string) bool
- func Marshal(ev Event) ([]byte, error)
- func ModerationRowTypes() []string
- func ModerationType(rowType string) (string, bool)
- func Name(t string) string
- func Schema(t string) ([]byte, error)
- func SchemaByFile(name string) (data []byte, ok bool)
- func SchemaFile(t string) string
- func SchemaFiles() ([]string, error)
- func SchemaID(t string) string
- func Scope(t string) string
- func SensitiveProperties(t string) ([]string, error)
- func SourceRelay(pod string) string
- func Types() []string
- func Vector(t string) ([]byte, error)
- type BanCreatedData
- type BanExpiredData
- type BanRemovedData
- type BroadcastEndedData
- type BroadcastKilledData
- type BroadcastPublisherAwayData
- type BroadcastPublisherBackData
- type BroadcastStartedData
- type BroadcastViewersData
- type ContentFlagRaisedData
- type ContentFlagRemindedData
- type ContentFlagResolvedData
- type ContentFlagScores
- type ContentFlagWindow
- type Delivery
- type Event
- type PopCreatedData
- type PopDeletedData
- type PopRepairedData
- type PopRevokedData
- type PopUpdatedData
- type RoomAttachedData
- type RoomAttachmentUpdatedData
- type RoomClosedData
- type RoomCreatedData
- type RoomDetachedData
- type RoomEndedData
- type RoomHomeChangedData
- type RoomOpenedData
- type RoomParticipantJoinedData
- type RoomParticipantLeftData
- type RoomParticipantUpdatedData
- type RoomScreeningChangedData
- type RoomSecretRotatedData
- type WebhookTestData
Constants ¶
const ( // EnforcementPending is the only enforcement value: present when the // Kubernetes object that would MAKE a moderation event true had not been // written when the event was recorded, absent when record and // enforcement agree (gawk-admin's store.EnforcementState). EnforcementPending = "pending" // Room kinds. RoomKindStatic = "static" RoomKindDynamic = "dynamic" // Client kinds — the JSON spelling of wire.RoomClient*. ClientKindWebViewer = "web-viewer" ClientKindWebBroadcaster = "web-broadcaster" ClientKindNative = "native" // Broadcast roles — the R17 vocabulary /statusz uses. RoleOrigin = "origin" RoleEdge = "edge" // Why a broadcast ended. BroadcastEndedGC = "gc" BroadcastEndedKilled = "killed" BroadcastEndedReplaced = "replaced" // BroadcastEndedStopped: the broadcaster stopped on purpose and the // relay ended the broadcast without a grace (R78, docs/79 D10). BroadcastEndedStopped = "stopped" // Why a room closed. RoomClosedGrace = "grace" RoomClosedCreator = "creator" RoomClosedOperator = "operator" // Why a participant left. Only the first is somebody leaving: the other // three are the room happening TO them, and a consumer that announces // departures wants to tell them apart. ParticipantLeft = "left" // ParticipantLeftTimeout: the control session stopped keeping up and was // evicted (wire close 4001, non-terminal — a fresh session restores it). ParticipantLeftTimeout = "timeout" // ParticipantLeftRoomEnded: the room ended under them. It follows a // room.closed for the same room. ParticipantLeftRoomEnded = "room_ended" // ParticipantLeftHomeMoved: the room moved to another pod and they are // reconnecting there. It follows a room.home_changed published by the NEW // home, and the joins that follow carry rejoin: true — nobody left. ParticipantLeftHomeMoved = "home_moved" // How a content flag ended (R40, docs/71 D9). Every flag ends in exactly // one of them, carried by content_flag.resolved. ContentFlagResolutionCleared = "cleared" ContentFlagResolutionDismissed = "dismissed" ContentFlagResolutionKilled = "killed" ContentFlagResolutionAutoKilled = "auto_killed" ContentFlagResolutionEnded = "ended" // The state of a flag's signal when it is re-paged (docs/71 D9): live // while the sampler keeps reporting the window tripped, unknown once it // has gone quiet for longer than the portal's stale-after. A silent // sampler is not evidence of a clean broadcast, so both re-page. ContentFlagSignalLive = "live" ContentFlagSignalUnknown = "unknown" // A room's screening (docs/71 D11): exempt from the sampler, or screened // like every other broadcast. RoomScreeningExempt = "exempt" RoomScreeningScreened = "screened" )
Closed vocabularies. Consumers are told (asyncapi.yaml) to treat an unknown value as unknown, because a vocabulary may grow additively (D6 b).
const ( // SpecVersion is the CloudEvents specification version. SpecVersion = "1.0" // ContentType is the media type of an event on the wire — the JSON // structured format — on both channels. It is the `Content-Type` of a // webhook delivery and the NATS `Content-Type` header. ContentType = "application/cloudevents+json" // DataContentType is the media type of `data`. Always JSON: `data` is a // JSON value inside the envelope, never a base64 blob. DataContentType = "application/json" // SourceAdmin is the `source` of every portal-originated event. SourceAdmin = "/gawk/admin" // TypePrefix is the reverse-DNS namespace every type starts with (D6 a). TypePrefix = "fi.ioio.gawk." // SchemaIDBase is the `$id` prefix of every data schema, and the prefix // of every event's `dataschema` (D2). It is an IDENTIFIER, not a promise // of a URL: the schema resolves in this package, in the repository at // the release tag, and on every gawk-admin deployment at // /api/v1/schemas/events/<type>.json. Making the literal URL resolve on // the project site is deferred (docs/52 §2, Rejected). SchemaIDBase = "https://gawk.ioio.fi/schemas/events/" )
The CloudEvents attributes every event carries verbatim (D1).
const ( // Moderation events: portal-originated, one per moderation_events row // (R39, R42). Their `source` is SourceAdmin and their `id` is a UUIDv5 // over the row (docs/52 D1). ModerationType maps the row's short type to // these. TypeBroadcastKilled = TypePrefix + "broadcast.killed" TypeBanCreated = TypePrefix + "ban.created" TypeBanExpired = TypePrefix + "ban.expired" TypeBanRemoved = TypePrefix + "ban.removed" TypeContentFlagRaised = TypePrefix + "content_flag.raised" // R40 (docs/71 D16): a flag nobody has acknowledged is re-paged, and // every flag ends in exactly one resolution. Both are moderation rows, // so a webhook with no filter receives them as it receives `raised`. TypeContentFlagReminded = TypePrefix + "content_flag.reminded" TypeContentFlagResolved = TypePrefix + "content_flag.resolved" TypeRoomCreated = TypePrefix + "room.created" TypeRoomEnded = TypePrefix + "room.ended" TypeRoomSecretRotated = TypePrefix + "room.secret_rotated" TypeRoomScreeningChanged = TypePrefix + "room.screening_changed" // R74 (docs/76 §7.2): an operator's changes to a PoP relay. They name // the PoP and nothing else about it: never an address, a pairing // string or a credential. TypePopCreated = TypePrefix + "pop.created" TypePopUpdated = TypePrefix + "pop.updated" TypePopRepaired = TypePrefix + "pop.repaired" TypePopRevoked = TypePrefix + "pop.revoked" TypePopDeleted = TypePrefix + "pop.deleted" // TypeContentFlagObserved is R40's calibration signal (docs/71 D16, // D19): what a sampler in `observe` mode would have flagged. It is // portal-originated like the moderation types but deliberately NOT a // moderation row — ModerationType does not know it — because it pages // nobody unless a webhook names it in its filter: a fresh install in // observe mode must not ring the pager it already has. TypeContentFlagObserved = TypePrefix + "content_flag.observed" // Bus events: relay-published from the fan-out points docs/51 D3 names // (R50 wires the producers; the types and schemas are fixed here first). // Their `source` is SourceRelay(pod) and their `id` is BusID(pod, seq). // // The room lifecycle types are `opened` / `closed`, deliberately NOT // `created` / `ended`: those are the moderation row types above, and one // string meaning two payload shapes is the docs/51 D3 finding this // package exists to prevent (D6 e). TypeBroadcastStarted = TypePrefix + "broadcast.started" TypeBroadcastPublisherAway = TypePrefix + "broadcast.publisher_away" TypeBroadcastPublisherBack = TypePrefix + "broadcast.publisher_back" TypeBroadcastEnded = TypePrefix + "broadcast.ended" TypeBroadcastViewers = TypePrefix + "broadcast.viewers" TypeRoomOpened = TypePrefix + "room.opened" TypeRoomClosed = TypePrefix + "room.closed" TypeRoomAttached = TypePrefix + "room.attached" TypeRoomDetached = TypePrefix + "room.detached" TypeRoomAttachmentUpdated = TypePrefix + "room.attachment_updated" TypeRoomHomeChanged = TypePrefix + "room.home_changed" TypeRoomParticipantJoined = TypePrefix + "room.participant_joined" TypeRoomParticipantLeft = TypePrefix + "room.participant_left" TypeRoomParticipantUpdated = TypePrefix + "room.participant_updated" // TypeWebhookTest is the synthetic event POST /webhooks/{name}/test // sends (docs/52 D5). Webhook-only: it is never on the bus and never a // stored row, because a test send is not a moderation action. TypeWebhookTest = TypePrefix + "webhook.test" )
Event types. `fi.ioio.gawk.<scope>.<event>`; the NATS subject's last token is `<event>` (D6 a). One constant per schema file, per vector and per AsyncAPI message — the D7 tests hold the four sets equal.
A type is never versioned until a `v2` exists (docs/52 §2, Rejected): additive change keeps the type, an incompatible change is a new `….v2` type beside the deprecated old one.
const CommonSchemaFile = "common.json"
CommonSchemaFile is the shared-definitions file every data schema `$ref`s.
const SchemaDir = "schema"
SchemaDir is the directory inside Schemas.
const VectorDir = "testdata/vectors"
VectorDir is the directory inside Vectors.
Variables ¶
var AsyncAPI []byte
AsyncAPI is the catalogue: every channel, every message, and the rules a consumer reads (D3). gawk-admin serves it bundled at /api/v1/asyncapi.json.
var CloudEventsSchema []byte
CloudEventsSchema is the CloudEvents project's own JSON Schema for the JSON format's envelope (cloudevents/spec, `cloudevents/formats/cloudevents.json` at commit 7bd28f7, 2021-11-04, Apache-2.0), vendored so the D7 tests can say "this is a CloudEvent" rather than "this looks like one". Not used by any production path.
var Schemas embed.FS
Schemas holds every data schema (`schema/<type>.json`) and the shared definitions they `$ref` (`schema/common.json`). gawk-admin serves them; the D7 tests validate every vector against them.
var Vectors embed.FS
Vectors holds the golden vectors (`testdata/vectors/<type>.json`): one fully-populated example event per type, with fictional identifiers. They are the examples a consumer can test a parser against, and what gawk-admin's D7 tests project and validate; the tests in this package hold each one byte-identical to its Go fixture.
Functions ¶
func BusID ¶
BusID is the `id` of a relay-published event: `<pod>:<seq>` (docs/51 D3), the JetStream dedup key and gawk-admin's forever dedup key. A per-pod monotonic seq needs no coordination; the random start offset docs/51 requires is the producer's job, not this function's.
func Marshal ¶
Marshal renders an event to the exact bytes that go on the wire — and, for a webhook, the exact bytes that are signed.
It is the one encoder. HTML escaping is off: `summary`, `reason`, `nickname` and `label` are human text that ends up in a push notification or a dashboard, and a consumer forwarding a field verbatim should show "spam & abuse" rather than the default encoder's "spam & abuse". The encoder's trailing newline is stripped so the signed material is the JSON value itself. Time is normalised to UTC so two producers render one instant one way.
func ModerationRowTypes ¶
func ModerationRowTypes() []string
ModerationRowTypes returns every row type ModerationType knows, sorted.
func ModerationType ¶
ModerationType maps a moderation_events row type to its CloudEvents type. ok is false for a row type this contract does not know, which a producer must treat as a bug rather than invent a type for.
func Name ¶
Name returns the `<event>` segment of a type — the NATS subject's last token (D6 a) — or "" when t is not shaped like one of ours. A versioned type keeps its suffix: `participant_joined.v2`.
func Schema ¶
Schema returns the data schema of a type, or an error for a type that has none — which for a type in Types() is a broken build the D7 tests catch.
func SchemaByFile ¶
SchemaByFile returns an embedded schema by its file name (`<type>.json` or CommonSchemaFile). ok is false for a name that is not a schema — the answer gawk-admin's serving route turns into a 404.
func SchemaFile ¶
SchemaFile is the file name of a type's data schema inside Schemas and the last path segment of its `$id` and of gawk-admin's serving route.
func SchemaFiles ¶
SchemaFiles lists every embedded schema file name, sorted.
func SchemaID ¶
SchemaID is the `$id` of a type's data schema and the `dataschema` of every event of that type (D2).
func Scope ¶
Scope returns the `<scope>` segment of a type (`broadcast`, `room`, …), or "" when t is not shaped like one of ours.
func SensitiveProperties ¶
SensitiveProperties returns the `data` property names a type's schema marks `x-gawk-sensitive: true`: the ones that carry a raw broadcast ID or a room code.
Since D9 the mark is a WARNING, not a filter. Both channels carry these properties — a webhook delivery is no longer projected free of them — and the mark is what tells a consumer, in the document it codes against, that the value is a joinable secret and that a delivery of this event must go somewhere its readers are allowed to join. The marks are read from the schema file rather than a Go list so that the document and the code cannot disagree about which properties those are.
func SourceRelay ¶
SourceRelay is the `source` of an event published by the named relay pod.
func Types ¶
func Types() []string
Types returns every event type this contract defines, in catalogue order.
A function returning a fresh slice rather than an exported slice variable: a package-level slice is writable by any importer, and this list is what the D7 tests hold the schema files, the vectors and the catalogue to.
Types ¶
type BanCreatedData ¶
type BanCreatedData struct {
Actor string `json:"actor"`
BroadcastKey string `json:"broadcastKey,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
Reason string `json:"reason,omitempty"`
Enforcement string `json:"enforcement,omitempty"`
Delivery
}
BanCreatedData is `fi.ioio.gawk.ban.created`. A ban on a publisher IP has no broadcast identity at all; the IP is never in any event.
type BanExpiredData ¶
type BanExpiredData struct {
Actor string `json:"actor"`
BroadcastKey string `json:"broadcastKey,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
Reason string `json:"reason,omitempty"`
Enforcement string `json:"enforcement,omitempty"`
Delivery
}
BanExpiredData is `fi.ioio.gawk.ban.expired`.
type BanRemovedData ¶
type BanRemovedData struct {
Actor string `json:"actor"`
BroadcastKey string `json:"broadcastKey,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
Reason string `json:"reason,omitempty"`
Enforcement string `json:"enforcement,omitempty"`
Delivery
}
BanRemovedData is `fi.ioio.gawk.ban.removed`.
type BroadcastEndedData ¶
type BroadcastEndedData struct {
BroadcastID string `json:"broadcastId,omitempty"`
BroadcastKey string `json:"broadcastKey"`
// Reason is BroadcastEndedGC, BroadcastEndedKilled,
// BroadcastEndedReplaced or BroadcastEndedStopped.
Reason string `json:"reason"`
// Pop: as on BroadcastStartedData.
Pop string `json:"pop,omitempty"`
Delivery
}
BroadcastEndedData is `fi.ioio.gawk.broadcast.ended`.
type BroadcastKilledData ¶
type BroadcastKilledData struct {
// Actor is who did it: an operator's identity, or `system`.
Actor string `json:"actor"`
// BroadcastKey is the HMAC'd key of the broadcast.
BroadcastKey string `json:"broadcastKey,omitempty"`
// BroadcastID is the raw, joinable ID. Sensitive (D9): delivered.
BroadcastID string `json:"broadcastId,omitempty"`
// Reason is the operator's free text.
Reason string `json:"reason,omitempty"`
// Enforcement is EnforcementPending or absent.
Enforcement string `json:"enforcement,omitempty"`
Delivery
}
BroadcastKilledData is `fi.ioio.gawk.broadcast.killed`.
type BroadcastPublisherAwayData ¶
type BroadcastPublisherAwayData struct {
BroadcastID string `json:"broadcastId,omitempty"`
BroadcastKey string `json:"broadcastKey"`
// Pop: as on BroadcastStartedData.
Pop string `json:"pop,omitempty"`
Delivery
}
BroadcastPublisherAwayData is `fi.ioio.gawk.broadcast.publisher_away`: the publisher stalled and viewers are being held on the keepalive.
type BroadcastPublisherBackData ¶
type BroadcastPublisherBackData struct {
BroadcastID string `json:"broadcastId,omitempty"`
BroadcastKey string `json:"broadcastKey"`
// Pop: as on BroadcastStartedData.
Pop string `json:"pop,omitempty"`
Delivery
}
BroadcastPublisherBackData is `fi.ioio.gawk.broadcast.publisher_back`.
type BroadcastStartedData ¶
type BroadcastStartedData struct {
BroadcastID string `json:"broadcastId,omitempty"`
BroadcastKey string `json:"broadcastKey"`
// Role is RoleOrigin or RoleEdge — which side of the R17 cascade this
// pod plays for the broadcast.
Role string `json:"role"`
// StartedAt is RFC 3339 UTC.
StartedAt string `json:"startedAt"`
// Pop names the R74 PoP relay the broadcast is published through
// (docs/76), absent for a broadcast published at home. A name, never an
// address: no event carries a publisher or venue IP.
Pop string `json:"pop,omitempty"`
Delivery
}
BroadcastStartedData is `fi.ioio.gawk.broadcast.started`.
type BroadcastViewersData ¶
type BroadcastViewersData struct {
BroadcastID string `json:"broadcastId,omitempty"`
BroadcastKey string `json:"broadcastKey"`
Role string `json:"role"`
ViewersLocal int `json:"viewersLocal"`
ViewersGlobal int `json:"viewersGlobal"`
// Pop: as on BroadcastStartedData.
Pop string `json:"pop,omitempty"`
Delivery
}
BroadcastViewersData is `fi.ioio.gawk.broadcast.viewers`, coalesced to at most one per broadcast per interval and only on change. Published by both roles: the origin knows the global count, each edge its own local one.
type ContentFlagRaisedData ¶
type ContentFlagRaisedData struct {
// Actor is the sampler's service identity.
Actor string `json:"actor"`
BroadcastKey string `json:"broadcastKey,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
Reason string `json:"reason,omitempty"`
// FlagID identifies the flag in the portal; reminded and resolved carry
// the same number.
FlagID int64 `json:"flagId,omitempty"`
SamplerID string `json:"samplerId,omitempty"`
Window *ContentFlagWindow `json:"window,omitempty"`
Scores *ContentFlagScores `json:"scores,omitempty"`
// Labels are the detector labels that fired in the window.
Labels []string `json:"labels,omitempty"`
// ReturnedAfterReview is true when an operator acknowledged or dismissed
// an earlier flag on this broadcast and the signal came back (R70,
// docs/72 D4): the strongest evidence a flag can carry, there for a
// pager to route at a higher priority. Never set on an observed flag.
ReturnedAfterReview bool `json:"returnedAfterReview,omitempty"`
Delivery
}
ContentFlagRaisedData is `fi.ioio.gawk.content_flag.raised`: a sampler's window tripped on a broadcast and a flag was raised (R40, docs/71 D9). The webhook IS the page. `fi.ioio.gawk.content_flag.observed` carries the same shape for a sampler in observe mode, which pages nobody unless asked.
Scores and metadata only — never a frame, never a thumbnail (docs/71 D8). The four R40 fields are additive to the shape docs/42 §4.11 reserved.
type ContentFlagRemindedData ¶ added in v0.33.0
type ContentFlagRemindedData struct {
// Actor is `system`: the portal re-pages on its own.
Actor string `json:"actor"`
BroadcastKey string `json:"broadcastKey,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
FlagID int64 `json:"flagId,omitempty"`
// RaisedAt is when the flag was raised, RFC 3339 UTC.
RaisedAt string `json:"raisedAt,omitempty"`
// Reminder counts this flag's reminders, 1 for the first.
Reminder int `json:"reminder"`
// Signal is ContentFlagSignalLive or ContentFlagSignalUnknown.
Signal string `json:"signal"`
Delivery
}
ContentFlagRemindedData is `fi.ioio.gawk.content_flag.reminded`: a flag is still open — nobody has acknowledged it — and its signal is live or unknown (docs/71 D9). Sent every -content-flag-repage until someone acts.
type ContentFlagResolvedData ¶ added in v0.33.0
type ContentFlagResolvedData struct {
// Actor is the operator, the sampler's identity for a clear, or
// `system` (`system:content-flag` for an automatic kill).
Actor string `json:"actor"`
BroadcastKey string `json:"broadcastKey,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
FlagID int64 `json:"flagId,omitempty"`
// Resolution is one of the ContentFlagResolution* values.
Resolution string `json:"resolution"`
// Reason qualifies it: `deadline` or `policy` for an automatic kill.
Reason string `json:"reason,omitempty"`
Delivery
}
ContentFlagResolvedData is `fi.ioio.gawk.content_flag.resolved`: a flag ended, by the sampler clearing it, an operator dismissing it or killing the broadcast, an automatic kill, or the publisher session ending (docs/71 D9).
type ContentFlagScores ¶ added in v0.33.0
ContentFlagScores are the window's highest and mean sample score, 0–1.
type ContentFlagWindow ¶ added in v0.33.0
type ContentFlagWindow struct {
// Start and End are RFC 3339 UTC.
Start string `json:"start"`
End string `json:"end"`
Samples int `json:"samples"`
FlaggedSamples int `json:"flaggedSamples"`
}
ContentFlagWindow is the sampler's window when the flag was raised.
type Delivery ¶
type Delivery struct {
// Summary is the one human sentence docs/42 §4.10 promises every
// receiver, so a webhook-to-push bridge (ntfy) needs no templating.
Summary string `json:"summary,omitempty"`
// PortalURL is the deep link into the portal — filtered by the HMAC'd
// key, because that is what the portal's own routes take. It carries no
// capability either way: acting requires logging in.
PortalURL string `json:"portalUrl,omitempty"`
}
Delivery holds the two delivery-added properties every data schema declares optional (D4): a producer leaves them empty; gawk-admin fills them when it posts a webhook.
type Event ¶
type Event struct {
SpecVersion string `json:"specversion"`
// ID is unique per Source: BusID on the bus, a UUIDv5 over the row for
// a portal-originated event, a fresh UUID for a test send. A re-sent
// duplicate — a webhook retry — carries the SAME id, which is what makes
// it a receiver's idempotency key.
ID string `json:"id"`
Source string `json:"source"`
Type string `json:"type"`
// Subject is the raw broadcast ID or room code the event is about, in
// cleartext, and absent for an event that is about neither (D9). It is
// what a consumer routes and renders on — the string a person typed to
// join — while the HMAC'd key stays in `data` beside it for the portal
// links that are keyed by it. The NATS subject's key token is still the
// HMAC'd one: that string shows up in bus monitoring, which is not the
// event.
Subject string `json:"subject,omitempty"`
// Time is when the occurrence happened. Marshal renders it in UTC.
Time time.Time `json:"time"`
DataContentType string `json:"datacontenttype"`
DataSchema string `json:"dataschema"`
// Data is the typed payload: one of the structs in data.go, or — after
// gawk-admin's webhook projection — a map of the surviving properties.
Data any `json:"data"`
}
Event is the CloudEvents 1.0 envelope (D1), in the attribute order the JSON format's examples use. It has no extension attributes, on purpose: an extension is a forever commitment; anything an event has to say belongs in Data, under a schema.
type PopCreatedData ¶ added in v0.36.0
type PopCreatedData struct {
Actor string `json:"actor"`
// Pop is the Pop resource's name, a DNS label.
Pop string `json:"pop"`
// DisplayName is the PoP's name as shown to people.
DisplayName string `json:"displayName,omitempty"`
Delivery
}
PopCreatedData is `fi.ioio.gawk.pop.created`: an operator created a PoP relay (R74, docs/76 §7.2). Like every pop.* type it names the PoP and nothing else about it: no address, pairing string or credential.
type PopDeletedData ¶ added in v0.36.0
type PopDeletedData struct {
Actor string `json:"actor"`
Pop string `json:"pop"`
DisplayName string `json:"displayName,omitempty"`
Delivery
}
PopDeletedData is `fi.ioio.gawk.pop.deleted`: an operator deleted a PoP and, with it, its party wall.
type PopRepairedData ¶ added in v0.36.0
type PopRepairedData struct {
Actor string `json:"actor"`
Pop string `json:"pop"`
DisplayName string `json:"displayName,omitempty"`
Delivery
}
PopRepairedData is `fi.ioio.gawk.pop.repaired`: an operator minted a new pairing string, which refuses the credential paired under the old one.
type PopRevokedData ¶ added in v0.36.0
type PopRevokedData struct {
Actor string `json:"actor"`
Pop string `json:"pop"`
DisplayName string `json:"displayName,omitempty"`
Delivery
}
PopRevokedData is `fi.ioio.gawk.pop.revoked`: an operator revoked a PoP, which ends its link and its outside copies.
type PopUpdatedData ¶ added in v0.36.0
type PopUpdatedData struct {
Actor string `json:"actor"`
Pop string `json:"pop"`
DisplayName string `json:"displayName,omitempty"`
Delivery
}
PopUpdatedData is `fi.ioio.gawk.pop.updated`: an operator edited a PoP's name, expiry, budgets, limits or guest settings.
type RoomAttachedData ¶
type RoomAttachedData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
BroadcastKey string `json:"broadcastKey"`
// Label is the tile's free text.
Label string `json:"label,omitempty"`
Delivery
}
RoomAttachedData is `fi.ioio.gawk.room.attached`: a broadcast joined a room's tiles.
type RoomAttachmentUpdatedData ¶
type RoomAttachmentUpdatedData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
BroadcastKey string `json:"broadcastKey"`
Live bool `json:"live"`
Viewers int `json:"viewers"`
Delivery
}
RoomAttachmentUpdatedData is `fi.ioio.gawk.room.attachment_updated`, coalesced like BroadcastViewersData.
type RoomClosedData ¶
type RoomClosedData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
// Kind is RoomKindStatic or RoomKindDynamic, as room.opened carries it.
// gawk-admin's room.ended row has always named the kind, and the sentence
// it renders says it ("a dynamic room ended"), so an end that did not
// carry it would read worse than the poll it replaced.
Kind string `json:"kind,omitempty"`
// Reason is RoomClosedGrace, RoomClosedCreator or RoomClosedOperator.
Reason string `json:"reason"`
Delivery
}
RoomClosedData is `fi.ioio.gawk.room.closed`.
type RoomCreatedData ¶
type RoomCreatedData struct {
Actor string `json:"actor"`
// RoomKey is the fleet's HMAC'd handle for the room (docs/44 D16).
// Absent until a pod has homed the room.
RoomKey string `json:"roomKey,omitempty"`
// RoomCode is the joinable code. Sensitive (D9): delivered.
RoomCode string `json:"roomCode,omitempty"`
// DisplayCode is the code as shown to people: a static room's slug with
// its configured casing, a dynamic room's code in upper case. Sensitive:
// joinable, exactly like RoomCode, whose normalisation it undoes.
DisplayCode string `json:"displayCode,omitempty"`
// Kind is RoomKindStatic or RoomKindDynamic.
Kind string `json:"kind,omitempty"`
Delivery
}
RoomCreatedData is `fi.ioio.gawk.room.created`: an operator created a static room in the portal.
type RoomDetachedData ¶
type RoomDetachedData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
BroadcastID string `json:"broadcastId,omitempty"`
BroadcastKey string `json:"broadcastKey"`
Label string `json:"label,omitempty"`
Delivery
}
RoomDetachedData is `fi.ioio.gawk.room.detached`.
type RoomEndedData ¶
type RoomEndedData struct {
Actor string `json:"actor"`
RoomKey string `json:"roomKey,omitempty"`
RoomCode string `json:"roomCode,omitempty"`
DisplayCode string `json:"displayCode,omitempty"`
Kind string `json:"kind,omitempty"`
Reason string `json:"reason,omitempty"`
Delivery
}
RoomEndedData is `fi.ioio.gawk.room.ended`: a room ended, by an operator (Actor is their identity) or by the relay on its own (Actor `system`, and Reason says why once R50's bus feeds this row).
type RoomHomeChangedData ¶
type RoomHomeChangedData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
Kind string `json:"kind,omitempty"`
// PreviousPod is the pod that held the home lease before this one, as the
// Room CR recorded it. Absent when the lease was already released or the
// record is gone.
PreviousPod string `json:"previousPod,omitempty"`
Delivery
}
RoomHomeChangedData is `fi.ioio.gawk.room.home_changed`: this pod adopted a room that another pod was serving (docs/44 §4.5's re-home).
It is published by the NEW home, so the CloudEvent's `source` names it — and that is deliberately the only place the new pod's name appears, because a second copy in `data` could disagree with it. PreviousPod names the other end when the CR still records it.
The new home is the one publisher that can be relied on here: a pod that loses a room because it is being deleted may publish nothing at all, so a consumer tracking where a room lives should follow this event rather than the departures on the old side.
type RoomOpenedData ¶
type RoomOpenedData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
Kind string `json:"kind"`
CreatedAt string `json:"createdAt"`
Delivery
}
RoomOpenedData is `fi.ioio.gawk.room.opened`: the home pod took a room live — a dynamic room's birth, or a static room's first attach.
type RoomParticipantJoinedData ¶
type RoomParticipantJoinedData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
// ParticipantID is the room-scoped id the roster uses (wire
// Participant.id). Not a join capability.
ParticipantID int `json:"participantId"`
Nickname string `json:"nickname,omitempty"`
ClientKind string `json:"clientKind"`
Streaming bool `json:"streaming"`
Speaking bool `json:"speaking"`
// Rejoin is true when the same participant resumed within the rejoin
// window rather than arriving fresh (docs/50 D6's filter token).
Rejoin bool `json:"rejoin"`
Delivery
}
RoomParticipantJoinedData is `fi.ioio.gawk.room.participant_joined`.
type RoomParticipantLeftData ¶
type RoomParticipantLeftData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
ParticipantID int `json:"participantId"`
Nickname string `json:"nickname,omitempty"`
ClientKind string `json:"clientKind"`
// Reason is one of the ParticipantLeft* values. Absent means the plain
// one: treat an unknown value as unknown, and an absent one as `left`.
//
// It exists because three of the four are not departures at all — the
// room ended, the room moved, the session was evicted — and a consumer
// that announced "tuhis left" for a pod rollout would be lying.
Reason string `json:"reason,omitempty"`
Delivery
}
RoomParticipantLeftData is `fi.ioio.gawk.room.participant_left`.
type RoomParticipantUpdatedData ¶
type RoomParticipantUpdatedData struct {
RoomCode string `json:"roomCode,omitempty"`
RoomKey string `json:"roomKey"`
DisplayCode string `json:"displayCode,omitempty"`
ParticipantID int `json:"participantId"`
Nickname string `json:"nickname,omitempty"`
ClientKind string `json:"clientKind"`
Streaming bool `json:"streaming"`
Speaking bool `json:"speaking"`
Delivery
}
RoomParticipantUpdatedData is `fi.ioio.gawk.room.participant_updated`: a nickname, streaming or speaking change.
type RoomScreeningChangedData ¶ added in v0.33.0
type RoomScreeningChangedData struct {
Actor string `json:"actor"`
RoomKey string `json:"roomKey,omitempty"`
RoomCode string `json:"roomCode,omitempty"`
DisplayCode string `json:"displayCode,omitempty"`
Kind string `json:"kind,omitempty"`
// Screening is RoomScreeningExempt or RoomScreeningScreened: the value
// after the change.
Screening string `json:"screening"`
Delivery
}
RoomScreeningChangedData is `fi.ioio.gawk.room.screening_changed`: an operator exempted a static room from content screening, or put it back (docs/71 D11). Its audit trail is this event.
type RoomSecretRotatedData ¶
type RoomSecretRotatedData struct {
Actor string `json:"actor"`
RoomKey string `json:"roomKey,omitempty"`
RoomCode string `json:"roomCode,omitempty"`
DisplayCode string `json:"displayCode,omitempty"`
Kind string `json:"kind,omitempty"`
Delivery
}
RoomSecretRotatedData is `fi.ioio.gawk.room.secret_rotated`.
type WebhookTestData ¶
type WebhookTestData struct {
Delivery
}
WebhookTestData is `fi.ioio.gawk.webhook.test`: nothing but the two delivery properties, because a test has nothing to say about any broadcast and must not invent any.