models

package
v0.38.0-util Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2025 License: AGPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	SubscribeAction         = "subscribe"
	UnsubscribeAction       = "unsubscribe"
	ListSubscriptionsAction = "list_subscription"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountStatusesResponse

type AccountStatusesResponse struct {
	BlockID       string                     `json:"blockID"`
	Height        string                     `json:"height"`
	AccountEvents map[string]flow.EventsList `json:"account_events"`
	MessageIndex  uint64                     `json:"message_index"`
}

AccountStatusesResponse is the response message for 'events' topic.

type Arguments

type Arguments map[string]interface{}

type BaseMessageRequest

type BaseMessageRequest struct {
	Action          string `json:"action"`     // subscribe, unsubscribe or list_subscriptions
	ClientMessageID string `json:"message_id"` // ClientMessageID is a uuid generated by client to identify request/response uniquely
}

BaseMessageRequest represents a base structure for incoming messages.

type BaseMessageResponse

type BaseMessageResponse struct {
	SubscriptionID  string       `json:"subscription_id"`
	ClientMessageID string       `json:"message_id,omitempty"` // ClientMessageID may be empty in case we send msg by ourselves (e.g. error occurred)
	Success         bool         `json:"success"`
	Error           ErrorMessage `json:"error,omitempty"`
}

BaseMessageResponse represents a base structure for outgoing messages.

type BlockDigestMessageResponse

type BlockDigestMessageResponse struct {
	// The sealed or finalized block digest according to the block status
	// in the request.
	Block *flow.BlockDigest `json:"block_digest"`
}

BlockDigestMessageResponse is the response message for 'block_digests' topic.

type BlockHeaderMessageResponse

type BlockHeaderMessageResponse struct {
	// The sealed or finalized block headers according to the block status
	// in the request.
	Header *flow.Header `json:"header"`
}

BlockHeaderMessageResponse is the response message for 'block_headers' topic.

type BlockMessageResponse

type BlockMessageResponse struct {
	// The sealed or finalized blocks according to the block status
	// in the request.
	Block *flow.Block `json:"block"`
}

BlockMessageResponse is the response message for 'blocks' topic.

type ErrorMessage

type ErrorMessage struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Action  string `json:"action,omitempty"`
}

type EventResponse

type EventResponse struct {
	BlockId        string       `json:"block_id"`
	BlockHeight    string       `json:"block_height"`
	BlockTimestamp time.Time    `json:"block_timestamp"`
	Events         []flow.Event `json:"events"`
	MessageIndex   uint64       `json:"message_index"`
}

EventResponse is the response message for 'events' topic.

type ListSubscriptionsMessageRequest

type ListSubscriptionsMessageRequest struct {
	BaseMessageRequest
}

ListSubscriptionsMessageRequest represents a request to list active subscriptions.

type ListSubscriptionsMessageResponse

type ListSubscriptionsMessageResponse struct {
	ClientMessageID string               `json:"message_id"`
	Success         bool                 `json:"success"`
	Error           ErrorMessage         `json:"error,omitempty"`
	Subscriptions   []*SubscriptionEntry `json:"subscriptions,omitempty"`
}

ListSubscriptionsMessageResponse is the structure used to respond to list_subscriptions requests. It contains a list of active subscriptions for the current WebSocket connection.

type SubscribeMessageRequest

type SubscribeMessageRequest struct {
	BaseMessageRequest
	Topic     string    `json:"topic"`     // Topic to subscribe to
	Arguments Arguments `json:"arguments"` // Additional arguments for subscription
}

SubscribeMessageRequest represents a request to subscribe to a topic.

type SubscribeMessageResponse

type SubscribeMessageResponse struct {
	BaseMessageResponse
}

SubscribeMessageResponse represents the response to a subscription request.

type SubscriptionEntry

type SubscriptionEntry struct {
	Topic string `json:"topic,omitempty"` // Topic of the subscription
	ID    string `json:"id,omitempty"`    // Unique subscription ID
}

SubscriptionEntry represents an active subscription entry.

type TransactionStatusesResponse

type TransactionStatusesResponse struct {
	TransactionResult *access.TransactionResult `json:"transaction_result"`
	MessageIndex      uint64                    `json:"message_index"`
}

TransactionStatusesResponse is the response message for 'events' topic.

type UnsubscribeMessageRequest

type UnsubscribeMessageRequest struct {
	BaseMessageRequest
	SubscriptionID string `json:"id"`
}

UnsubscribeMessageRequest represents a request to unsubscribe from a topic.

type UnsubscribeMessageResponse

type UnsubscribeMessageResponse struct {
	BaseMessageResponse
}

UnsubscribeMessageResponse represents the response to an unsubscription request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL