formica

package module
v0.0.0-...-4e644ab Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// PayloadName defines the name of the Formica payload.
	PayloadName = "formica"
)
View Source
const (
	// PluginName contains the human-readable name of the plugin.
	PluginName = "formica"
)

Variables

View Source
var (
	// Plugin is the "plugin" instance of the formica application.
	Plugin *node.Plugin
)
View Source
var Type = payload.NewType(payloadType, PayloadName)

Type represents the identifier which addresses the chat payload type.

Functions

func SendFormicaBlock

func SendFormicaBlock(c echo.Context) error

SendFormicaBlock sends a formica message.

Types

type BlockReceivedEvent

type BlockReceivedEvent struct {
	Purpose   uint32
	Data      string
	Block     string
	Timestamp time.Time
	BlockID   string
}

Event defines the information passed when a formica event fires.

type Events

type Events struct {
	BlockReceived *event.Event[*BlockReceivedEvent]
}

Events define events occurring within a formica payload.

type Formica

type Formica struct {
	*Events
}

Formica manages Formica messages happening over the Tangle.

func NewFormica

func NewFormica() *Formica

NewFormica creates a new formica.

type Payload

type Payload struct {
	model.Immutable[Payload, *Payload, payloadModel] `serix:"0"`
}

Payload represents the chat payload type.

func NewPayload

func NewPayload(purpose uint32, data string, block string) *Payload

NewPayload creates a new chat payload.

func (*Payload) Block

func (p *Payload) Block() string

Block returns the block contents.

func (*Payload) Data

func (p *Payload) Data() string

Data returns a recipient of the message.

func (*Payload) Purpose

func (p *Payload) Purpose() uint32

Purpose returns an author of the message.

func (*Payload) Type

func (p *Payload) Type() payload.Type

Type returns the type of the Payload.

type Request

type Request struct {
	Purpose uint32 `json:"purpose"`
	Data    string `json:"data"`
	Block   string `json:"block"`
}

Request defines the formica block to send.

type Response

type Response struct {
	BlockID string `json:"blockID,omitempty"`
	Error   string `json:"error,omitempty"`
}

Response contains the ID of the block sent.

Jump to

Keyboard shortcuts

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