Skip to content

Rating event payloads

Rating events describe a rating record for one user, entity, and normalized aspect. They use the common ExtensionEvent envelope and add a nested value under Data["entity"].

C# lookupJSON notationRuntime typeContract
Data["entity"]data.entityDictionary<string, object?>Rating-specific payload object.
Data["entity"]["userId"]data.entity.userIdintCove user identifier that owns the rating.
Data["entity"]["aspect"]data.entity.aspectstringNormalized rating aspect; the default is overall.
Data["entity"]["value"]data.entity.valueint?Written rating value, or null when deleted.

EntityType identifies the rated entity kind and EntityId identifies that entity. Currently supported rating mutations can publish video, image, gallery, performer, studio, group, or tag as EntityType.

CanonicalEventTypeEventTypePublished whenvalue
rating.createdrating.createdA user writes an aspect that has no existing rating record.int
rating.updatedrating.updatedA user writes an aspect that already has a rating record.int
rating.deletedrating.deletedA user clears an aspect that has a rating record.null

Clearing an aspect without an existing rating is a no-op and does not publish an event.

{
"eventType": "rating.created",
"canonicalEventType": "rating.created",
"entityType": "video",
"entityId": 42,
"data": {
"entity": {
"userId": 7,
"aspect": "overall",
"value": 4
}
}
}
{
"eventType": "rating.updated",
"canonicalEventType": "rating.updated",
"entityType": "video",
"entityId": 42,
"data": {
"entity": {
"userId": 7,
"aspect": "overall",
"value": 5
}
}
}
{
"eventType": "rating.deleted",
"canonicalEventType": "rating.deleted",
"entityType": "video",
"entityId": 42,
"data": {
"entity": {
"userId": 7,
"aspect": "overall",
"value": null
}
}
}

The nested runtime value is an object, so a direct IEventExtension implementation should validate its type and fields:

if (evt.Data?.GetValueOrDefault("entity") is Dictionary<string, object?> rating)
{
var userId = rating.GetValueOrDefault("userId");
var aspect = rating.GetValueOrDefault("aspect");
var value = rating.GetValueOrDefault("value");
}

Handlers should use the user and aspect together when maintaining derived rating state. EntityId alone is not a unique rating identity.