view socket/types.go @ 12:aaf85ae1f942

add very simple html template
author Dennis C. M. <dennis@denniscm.com>
date Thu, 20 Mar 2025 11:12:21 +0000
parents e9df3bb010f4
children
line wrap: on
line source

package socket

type MetadataMsg struct {
	Metadata struct {
		MsgId        string `json:"message_id"`
		MsgType      string `json:"message_type"`
		MsgTimeStamp string `json:"message_timestamp"`
	} `json:"metadata"`
}

type WelcomeMsg struct {
	Metadata struct {
		MsgId        string `json:"message_id"`
		MsgType      string `json:"message_type"`
		MsgTimeStamp string `json:"message_timestamp"`
	} `json:"metadata"`

	Payload struct {
		Session struct {
			Id                   string `json:"id"`
			Status               string `json:"status"`
			ConnectedAt          string `json:"connected_at"`
			KeepaliveTimeoutSecs int    `json:"keepalive_timeout_seconds"`
			ReconnectUrl         string `json:"reconnect_url"`
		} `json:"session"`
	} `json:"payload"`
}

type KeealiveMsg struct {
	Metadata struct {
		MsgId        string `json:"message_id"`
		MsgType      string `json:"message_type"`
		MsgTimeStamp string `json:"message_timestamp"`
	} `json:"metadata"`

	Payload struct {
	} `json:"payload"`
}

type ReconnectMsg struct {
	WelcomeMsg
}

type MetadataEvent struct {
	Metadata struct {
		MsgId        string `json:"message_id"`
		MsgType      string `json:"message_type"`
		MsgTimeStamp string `json:"message_timestamp"`
		SubType      string `json:"subscription_type"`
		SubVersion   string `json:"subscription_version"`
	} `json:"metadata"`
}

type ChannelChatMsgEvent struct {
	Metadata MetadataEvent `json:"metadata"`

	Payload struct {
		Sub struct {
			Id      string `json:"id"`
			Status  string `json:"status"`
			Type    string `json:"type"`
			Version string `json:"version"`

			Condition struct {
				BroadcasterUserId string `json:"broadcaster_user_id"`
				UserId            string `json:"user_id"`
			} `json:"condition"`

			Transport struct {
				Method    string `json:"method"`
				SessionId string `json:"session_id"`
			} `json:"transport"`

			CreatedAt string `json:"created_at"`
			Cost      int    `json:"cost"`
		} `json:"subscription"`

		Event struct {
			BroadcasterUserId    string `json:"broadcaster_user_id"`
			BroadcasterUserLogin string `json:"broadcaster_user_login"`
			BroadcasterUserName  string `json:"broadcaster_user_name"`
			ChatterUserId        string `json:"chatter_user_id"`
			ChatterUserLogin     string `json:"chatter_user_login"`
			ChatterUserName      string `json:"chatter_user_name"`
			MsgId                string `json:"message_id"`

			Msg struct {
				Text string `json:"text"`

				Fragments []struct {
					Type      string `json:"type"`
					Text      string `json:"text"`
					Cheermote string `json:"cheermote"`
					Emote     string `json:"emote"`
					Mention   string `json:"mention"`
				} `json:"fragments"`
			} `json:"message"`

			Color string `json:"color"`

			Badges []struct {
				SetId string `json:"set_id"`
				Id    string `json:"id"`
				Info  string `json:"info"`
			} `json:"badges"`

			MsgType                     string `json:"message_type"`
			Cheer                       string `json:"cheer"`
			Reply                       string `json:"reply"`
			ChannelPointsCustomRewardId string `json:"channel_points_custom_reward_id"`
			SourceBroadcasterUserId     string `json:"source_broadcaster_user_id"`
			SourceBroadcasterUserLogin  string `json:"source_broadcaster_user_login"`
			SourceBroadcasterUserName   string `json:"source_broadcaster_user_name"`
			SourceMessageId             string `json:"source_message_id"`
			SourceBadges                string `json:"source_badges"`
		} `json:"event"`
	} `json:"payload"`
}