ReferenceEvents Catalog
Météo — résultat
Auto-généré par
scripts/gen-events-catalog.tsdepuis le schéma Zod canonique danspackages/shared/src/events/widget-data-events.ts. Ne pas éditer ce fichier à la main — modifier la source puis relancerbun run gen:events.
Topic
weather:result- Famille : Weather
- Bloc d'origine : BLOC-06
- Discriminant :
kind: "weather:result"
Description
Publié après l'appel d'outil getCurrentWeather ou après le tap utilisateur sur la card météo. La tablette rend une carte avec ville, température, condition, conseil court.
Schéma JSON
{
"$ref": "#/definitions/weather-result",
"definitions": {
"weather-result": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "weather:result"
},
"result": {
"type": "object",
"properties": {
"city": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"temperature": {
"type": "number"
},
"condition": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"advice": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"city",
"temperature",
"condition",
"advice"
],
"additionalProperties": false
}
},
"required": [
"kind",
"result"
],
"additionalProperties": false
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}Import TypeScript
import {
WeatherResultEventSchema,
type WeatherResultEvent,
} from "@kohami/shared";Parsing côté tablette
import { WeatherResultEventSchema } from "@kohami/shared";
room.on(RoomEvent.DataReceived, (payload, _participant, _kind, topic) => {
if (topic !== "weather:result") return;
const raw = new TextDecoder().decode(payload);
const event = WeatherResultEventSchema.parse(JSON.parse(raw));
// ... handle event
});