client

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: LGPL-2.1 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizeAgent

func AuthorizeAgent(
	payload entities.ClientPayload, ctx *context.Context,
) (*models.AuthorizationEvent, error)

Validate and Process the authorization request

Validate and Process the authorization request

func CreateEvent

func CreateEvent[S *models.EventInterface](payload entities.ClientPayload, ctx *context.Context) (model S, err error)

func GetAccountAuthorizations

func GetAccountAuthorizations(auth *entities.Authorization) (*[]models.AuthorizationState, error)

func GetAccountSubscriptions

func GetAccountSubscriptions(payload entities.ClientPayload) (*[]models.TopicState, error)

func GetAuthorizationEventById

func GetAuthorizationEventById(id string) (*models.AuthorizationEvent, error)

func GetBlockStats

func GetBlockStats() (*[]models.BlockStat, error)

func GetEvent

func GetEvent(eventId string, eventType int) (model interface{}, err error)

func GetMainStats

func GetMainStats() (*entities.MainStat, error)

func GetMessageEventById

func GetMessageEventById(id string) (*models.MessageEvent, error)

func GetMessages

func GetMessages(topicId string) (*[]models.MessageState, error)

func GetSubEventById

func GetSubEventById(id string) (*models.SubscriptionEvent, error)

func GetSubnetByHash

func GetSubnetByHash(hash string) (*models.SubnetState, error)

func GetSubnetById

func GetSubnetById(id string) (*models.SubnetState, error)

func GetSubnetEventById

func GetSubnetEventById(id string) (*models.SubnetEvent, error)

func GetSubnetEvents

func GetSubnetEvents() (*[]models.SubnetEvent, error)

func GetSubnets

func GetSubnets(item models.SubnetState) (*[]models.SubnetState, error)

func GetSubscription

func GetSubscription(id string) (*models.SubscriptionState, error)

func GetSubscriptions

func GetSubscriptions(payload entities.Subscription) (*[]models.SubscriptionState, error)

func GetTopic

func GetTopic(where models.TopicState) (*models.TopicState, error)

func GetTopicByHash

func GetTopicByHash(hash string) (*models.TopicState, error)

func GetTopicById

func GetTopicById(id string) (*models.TopicState, error)

func GetTopicEventById

func GetTopicEventById(id string) (*models.TopicEvent, error)

func GetTopicEvents

func GetTopicEvents() (*[]models.TopicEvent, error)

func GetTopics

func GetTopics() (*[]models.TopicState, error)

func GetWalletByHash

func GetWalletByHash(hash string) (*models.WalletState, error)

func GetWalletById

func GetWalletById(id string) (*models.WalletState, error)

func GetWalletEvents

func GetWalletEvents() (*[]models.WalletEvent, error)

func GetWallets

func GetWallets() (*[]models.WalletState, error)

func SyncAgent

func SyncAgent(req *entities.SyncRequest, clientPayload *entities.ClientPayload) (entities.SyncResponse, error)

func SyncAgent(req *entities.SyncRequest, clientPayload *entities.ClientPayload) (entities.SyncResponse, error) {

func SyncRequest

func SyncRequest(payload *entities.ClientPayload) entities.SyncResponse

func ValidateClientPayload

func ValidateClientPayload(
	payload *entities.ClientPayload,
	strictAuth bool,
) (*models.AuthorizationState, *entities.DeviceString, error)

func ValidateMessagePayload

func ValidateMessagePayload(payload entities.ClientPayload, currentAuthState *models.AuthorizationState) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)

func ValidateSubnetPayload

func ValidateSubnetPayload(payload entities.ClientPayload, authState *models.AuthorizationState, ctx *context.Context) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)
	incomingSubnetC, ok := (*mainCtx).Value(constants.IncomingSubnetEventChId).(*chan *entities.Event)
	if !ok {
		logger.Errorf("incomingSubnetC closed")
		return
	}
	for {
		event, ok :=  <-*incomingSubnetC
		if !ok {
			logger.Fatal("incomingSubnetC closed for read")
			return
		}
		go service.HandleNewPubSubSubnetEvent(event, ctx)
	}
}

func ValidateSubscriptionPayload

func ValidateSubscriptionPayload(payload entities.ClientPayload, authState *models.AuthorizationState) (
	assocPrevEvent *entities.EventPath,
	assocAuthEvent *entities.EventPath,
	err error,
)

func ValidateTopicPayload

func ValidateTopicPayload(payload entities.ClientPayload, authState *models.AuthorizationState) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)
	incomingTopicC, ok := (*mainCtx).Value(constants.IncomingTopicEventChId).(*chan *entities.Event)
	if !ok {
		logger.Errorf("incomingTopicC closed")
		return
	}
	for {
		event, ok :=  <-*incomingTopicC
		if !ok {
			logger.Fatal("incomingTopicC closed for read")
			return
		}
		go service.HandleNewPubSubTopicEvent(event, ctx)
	}
}

func ValidateWalletPayload

func ValidateWalletPayload(payload entities.ClientPayload, authState *models.AuthorizationState) (assocPrevEvent *entities.EventPath, assocAuthEvent *entities.EventPath, err error)
	incomingWalletC, ok := (*mainCtx).Value(constants.IncomingWalletEventChId).(*chan *entities.Event)
	if !ok {
		logger.Errorf("incomingWalletC closed")
		return
	}
	for {
		event, ok :=  <-*incomingWalletC
		if !ok {
			logger.Fatal("incomingWalletC closed for read")
			return
		}
		go service.HandleNewPubSubWalletEvent(event, ctx)
	}
}

Types

type Flag

type Flag string

type MessageService

type MessageService struct {
	Ctx context.Context
	Cfg configs.MainConfiguration
}

func NewMessageService

func NewMessageService(mainCtx *context.Context) *MessageService

Jump to

Keyboard shortcuts

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