handler

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPersonaTag               = errors.New("persona tag is required")
	ErrWrongNamespace             = errors.New("incorrect namespace")
	ErrSystemTransactionRequired  = errors.New("system transaction required")
	ErrSystemTransactionForbidden = errors.New("system transaction forbidden")
)

Functions

func GetDebugState

func GetDebugState(provider servertypes.Provider) func(*fiber.Ctx) error

GetDebugState godoc

@Summary Retrieves a list of all entities in the game state @Description Retrieves a list of all entities in the game state @Produce application/json @Success 200 {object} DebugStateResponse "List of all entities" @Router /debug/state [post]

func GetHealth

func GetHealth() func(c *fiber.Ctx) error

GetHealth godoc

@Summary      Retrieves the status of the server and game loop
@Description  Retrieves the status of the server and game loop
@Produce      application/json
@Success      200  {object}  GetHealthResponse  "Server and game loop status"
@Router       /health [get]

func GetReceipts

func GetReceipts(wCtx engine.Context) func(*fiber.Ctx) error

GetReceipts godoc

@Summary      Retrieves all transaction receipts
@Description  Retrieves all transaction receipts
@Accept       application/json
@Produce      application/json
@Param        ListTxReceiptsRequest  body      ListTxReceiptsRequest  true  "Query body"
@Success      200                    {object}  ListTxReceiptsResponse "List of receipts"
@Failure      400                    {string}  string                 "Invalid request body"
@Router       /query/receipts/list [post]

func GetWorld

func GetWorld(
	components []types.ComponentMetadata, messages []types.Message,
	queries []engine.Query, namespace string,
) func(*fiber.Ctx) error

GetWorld godoc

@Summary      Retrieves details of the game world
@Description  Contains the registered components, messages, queries, and namespace
@Accept       application/json
@Produce      application/json
@Success      200  {object}  GetWorldResponse  "Details of the game world"
@Failure      400  {string}  string            "Invalid request parameters"
@Router       /world [get]

func PostCQL

func PostCQL(provider servertypes.Provider) func(*fiber.Ctx) error

PostCQL godoc

@Summary      Executes a CQL (Cardinal Query Language) query
@Description  Executes a CQL (Cardinal Query Language) query
@Accept       application/json
@Produce      application/json
@Param        cql  body      CQLQueryRequest   true  "CQL query to be executed"
@Success      200  {object}  CQLQueryResponse  "Results of the executed CQL query"
@Failure      400  {string}  string            "Invalid request parameters"
@Router       /cql [post]

func PostGameQuery

func PostGameQuery(queries map[string]map[string]engine.Query, wCtx engine.Context) func(*fiber.Ctx) error

NOTE: duplication for cleaner swagger docs PostQuery godoc

@Summary      Executes a query
@Description  Executes a query
@Accept       application/json
@Produce      application/json
@Param        queryName   path      string  true  "Name of a registered query"
@Param        queryBody   body      object  true  "Query to be executed"
@Success      200         {object}  object  "Results of the executed query"
@Failure      400         {string}  string  "Invalid request parameters"
@Router       /query/game/{queryName} [post]

func PostGameTransaction

func PostGameTransaction(
	provider servertypes.Provider, msgs map[string]map[string]types.Message, disableSigVerification bool,
) func(*fiber.Ctx) error

NOTE: duplication for cleaner swagger docs PostTransaction godoc

@Summary      Submits a transaction
@Description  Submits a transaction
@Accept       application/json
@Produce      application/json
@Param        txName  path      string                   true  "Name of a registered message"
@Param        txBody  body      Transaction              true  "Transaction details & message to be submitted"
@Success      200     {object}  PostTransactionResponse  "Transaction hash and tick"
@Failure      400     {string}  string                   "Invalid request parameter"
@Router       /tx/game/{txName} [post]

func PostPersonaTransaction

func PostPersonaTransaction(
	provider servertypes.Provider, msgs map[string]map[string]types.Message, disableSigVerification bool,
) func(*fiber.Ctx) error

NOTE: duplication for cleaner swagger docs PostTransaction godoc

@Summary      Creates a persona
@Description  Creates a persona
@Accept       application/json
@Produce      application/json
@Param        txBody  body      Transaction              true  "Transaction details & message to be submitted"
@Success      200     {object}  PostTransactionResponse  "Transaction hash and tick"
@Failure      400     {string}  string                   "Invalid request parameter"
@Router       /tx/persona/create-persona [post]

func PostQuery

func PostQuery(queries map[string]map[string]engine.Query, wCtx engine.Context) func(*fiber.Ctx) error

PostQuery godoc

@Summary      Executes a query
@Description  Executes a query
@Accept       application/json
@Produce      application/json
@Param        queryGroup  path      string  true  "Query group"
@Param        queryName   path      string  true  "Name of a registered query"
@Param        queryBody   body      object  true  "Query to be executed"
@Success      200         {object}  object  "Results of the executed query"
@Failure      400         {string}  string  "Invalid request parameters"
@Router       /query/{queryGroup}/{queryName} [post]

func PostTransaction

func PostTransaction(
	provider servertypes.Provider, msgs map[string]map[string]types.Message, disableSigVerification bool,
) func(*fiber.Ctx) error

PostTransaction godoc

@Summary      Submits a transaction
@Description  Submits a transaction
@Accept       application/json
@Produce      application/json
@Param        txGroup  path      string                   true  "Message group"
@Param        txName   path      string                   true  "Name of a registered message"
@Param        txBody   body      Transaction              true  "Transaction details & message to be submitted"
@Success      200      {object}  PostTransactionResponse  "Transaction hash and tick"
@Failure      400      {string}  string                   "Invalid request parameter"
@Router       /tx/{txGroup}/{txName} [post]

func WebSocketEvents

func WebSocketEvents() func(c *fiber.Ctx) error

WebSocketEvents godoc

@Summary      Establishes a new websocket connection to retrieve system events
@Description  Establishes a new websocket connection to retrieve system events
@Produce      application/json
@Success      101  {string}  string  "Switch protocol to ws"
@Router       /events [get]

func WebSocketUpgrader

func WebSocketUpgrader(c *fiber.Ctx) error

Types

type CQLQueryRequest

type CQLQueryRequest struct {
	CQL string
}

type CQLQueryResponse

type CQLQueryResponse struct {
	Results []cqlData `json:"results"`
}

type DebugStateRequest

type DebugStateRequest struct{}

type DebugStateResponse

type DebugStateResponse []debugStateElement

type FieldDetail

type FieldDetail struct {
	Name   string         `json:"name"`   // name of the message or query
	Fields map[string]any `json:"fields"` // variable name and type
	URL    string         `json:"url,omitempty"`
}

type GetHealthResponse

type GetHealthResponse struct {
	IsServerRunning   bool `json:"isServerRunning"`
	IsGameLoopRunning bool `json:"isGameLoopRunning"`
}

type GetWorldResponse

type GetWorldResponse struct {
	Namespace  string        `json:"namespace"`
	Components []FieldDetail `json:"components"` // list of component names
	Messages   []FieldDetail `json:"messages"`
	Queries    []FieldDetail `json:"queries"`
}

type ListTxReceiptsRequest

type ListTxReceiptsRequest struct {
	StartTick uint64 `json:"startTick" mapstructure:"startTick"`
}

type ListTxReceiptsResponse

type ListTxReceiptsResponse struct {
	StartTick uint64         `json:"startTick"`
	EndTick   uint64         `json:"endTick"`
	Receipts  []ReceiptEntry `json:"receipts"`
}

ListTxReceiptsResponse returns the transaction receipts for the given range of ticks. The interval is closed on StartTick and open on EndTick: i.e. [StartTick, EndTick) Meaning StartTick is included and EndTick is not. To iterate over all ticks in the future, use the returned EndTick as the StartTick in the next request. If StartTick == EndTick, the receipts list will be empty.

type PostTransactionResponse

type PostTransactionResponse struct {
	TxHash string
	Tick   uint64
}

PostTransactionResponse is the HTTP response for a successful transaction submission

type ReceiptEntry

type ReceiptEntry struct {
	TxHash string   `json:"txHash"`
	Tick   uint64   `json:"tick"`
	Result any      `json:"result"`
	Errors []string `json:"errors"`
}

ReceiptEntry represents a single transaction receipt. It contains an ID, a result, and a list of errors.

type Transaction

type Transaction = sign.Transaction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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