77 lines
2.9 KiB
Go
77 lines
2.9 KiB
Go
|
package conduit
|
||
|
|
||
|
import "time"
|
||
|
|
||
|
type ConduitData struct {
|
||
|
// Conduit ID.
|
||
|
ID string `json:"id"`
|
||
|
|
||
|
// Number of shards associated with this conduit.
|
||
|
ShardCount int `json:"shard_count"`
|
||
|
}
|
||
|
|
||
|
type Shard struct {
|
||
|
// Shard ID.
|
||
|
ID string `json:"id"`
|
||
|
|
||
|
// The shard status. The subscriber receives events only for enabled shards
|
||
|
Status Status `json:"status"`
|
||
|
|
||
|
// The transport details used to send the notifications.
|
||
|
Transport *Transport `json:"transport"`
|
||
|
}
|
||
|
|
||
|
type Status string
|
||
|
|
||
|
const (
|
||
|
// enabled — The shard is enabled.
|
||
|
StatusEnabled Status = "enabled"
|
||
|
|
||
|
// webhook_callback_verification_pending — The shard is pending verification of the specified callback URL.
|
||
|
StatusWebhookCallbackVerificationPending Status = "webhook_callback_verification_pending"
|
||
|
|
||
|
// webhook_callback_verification_failed — The specified callback URL failed verification.
|
||
|
StatusWebhookCallbackVerificationFailed Status = "webhook_callback_verification_failed"
|
||
|
|
||
|
// notification_failures_exceeded — The notification delivery failure rate was too high.
|
||
|
NotificationFailuresExceeded Status = "notification_failures_exceeded"
|
||
|
|
||
|
// websocket_disconnected — The client closed the connection.
|
||
|
WebsocketDisconnected Status = "websocket_disconnected"
|
||
|
|
||
|
// websocket_failed_ping_pong — The client failed to respond to a ping message.
|
||
|
WebsocketFailedPingPong Status = "websocket_failed_ping_pong"
|
||
|
|
||
|
// websocket_received_inbound_traffic — The client sent a non-pong message.
|
||
|
// Clients may only send pong messages (and only in response to a ping message).
|
||
|
WebsocketReceivedInboundTraffic Status = "websocket_received_inbound_traffic"
|
||
|
|
||
|
// websocket_connection_unused — The client failed to subscribe to events within the required time.
|
||
|
WebsocketConnectionUnused Status = "websocket_connection_unused"
|
||
|
|
||
|
// websocket_internal_error — The Twitch WebSocket server experienced an unexpected error.
|
||
|
WebsocketInternalError Status = "websocket_internal_error"
|
||
|
|
||
|
// websocket_network_timeout — The Twitch WebSocket server timed out writing the message to the client.
|
||
|
WebsocketNetworkTimeout Status = "websocket_network_timeout"
|
||
|
|
||
|
// websocket_network_error — The Twitch WebSocket server experienced a network error writing the message to the client.
|
||
|
WebsocketnetworkError Status = "websocket_network_error"
|
||
|
)
|
||
|
|
||
|
type Transport struct {
|
||
|
// The transport method. Possible values are:
|
||
|
//
|
||
|
// webhook, websocket
|
||
|
Method string `json:"method"`
|
||
|
|
||
|
// The callback URL where the notifications are sent. Included only if method is set to webhook.
|
||
|
Callback *string `json:"callback,omitempty"`
|
||
|
|
||
|
// The UTC date and time that the WebSocket connection was established. Included only if method is set to websocket.
|
||
|
ConnectedAt *time.Time `json:"connected_at,omitempty"`
|
||
|
|
||
|
// The UTC date and time that the WebSocket connection was lost. Included only if method is set to websocket.
|
||
|
DisconnectedAt *time.Time `json:"disconnected_at,omitempty"`
|
||
|
}
|