MarshalJSON (events/types.go)

voiceblender · internal/events/types.go · go · MIT
voice, Voice / Speech

Go struct with custom MarshalJSON to flatten event envelope and data into a single JSON object.

// Source: https://github.com/VoiceBlender/voiceblender | License: MIT | Copyright 2026 Messageroute Ltd
// Provided via justclaw.it.com; keep this notice with the code.
package events

import (
	"encoding/json"
	"time"
)

type EventType string

const (
	LegRinging       EventType = "leg.ringing"
	LegConnected     EventType = "leg.connected"
	LegDisconnected  EventType = "leg.disconnected"
	LegJoinedRoom    EventType = "leg.joined_room"
	LegLeftRoom      EventType = "leg.left_room"
	LegEarlyMedia    EventType = "leg.early_media"
	LegMuted         EventType = "leg.muted"
	LegUnmuted       EventType = "leg.unmuted"
	LegDeaf          EventType = "leg.deaf"
	LegUndeaf        EventType = "leg.undeaf"
	LegHold          EventType = "leg.hold"
	LegUnhold        EventType = "leg.unhold"
	LegCommand

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key