output

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitGeneral           = 1
	ExitInvalidInput      = 2
	ExitAuthOrConfig      = 3
	ExitNotFound          = 4
	ExitTelegram          = 5
	ExitLocalIO           = 6
	ExitMutationReconcile = 7
)

Variables

This section is empty.

Functions

func ExitCodeFor

func ExitCodeFor(code string) int

func SanitizeTerminal

func SanitizeTerminal(value string) string

Types

type Envelope

type Envelope struct {
	SchemaVersion string `json:"schema_version"`
	Meta          Meta   `json:"meta"`
	Data          any    `json:"data"`
}

func NewEnvelope

func NewEnvelope(meta Meta, data any) Envelope

type ErrorBody

type ErrorBody struct {
	Code                 string `json:"code"`
	Message              string `json:"message"`
	ExitCode             int    `json:"exit_code"`
	Outcome              string `json:"outcome,omitempty"`
	RetrySafe            *bool  `json:"retry_safe,omitempty"`
	ReconciliationHandle string `json:"reconciliation_handle,omitempty"`
	Guidance             string `json:"guidance,omitempty"`
	RetryAfterSeconds    int    `json:"retry_after_seconds,omitempty"`
	TelegramCode         int    `json:"telegram_code,omitempty"`
	TelegramType         string `json:"telegram_type,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	SchemaVersion string    `json:"schema_version"`
	Meta          *Meta     `json:"meta,omitempty"`
	Error         ErrorBody `json:"error"`
}

func ErrorFrom

func ErrorFrom(err error) ErrorResponse

type Format

type Format string
const (
	SchemaVersion = "tele/v1"

	Human Format = "human"
	JSON  Format = "json"
	JSONL Format = "jsonl"
)

type Meta

type Meta struct {
	Command     string         `json:"command"`
	TeleVersion string         `json:"tele_version"`
	Profile     string         `json:"profile"`
	AccountID   int64          `json:"account_id,omitempty"`
	PeerRef     string         `json:"peer_ref,omitempty"`
	FetchedAt   string         `json:"fetched_at"`
	Limit       int            `json:"limit,omitempty"`
	SideEffects []string       `json:"side_effects,omitempty"`
	Retrieval   *RetrievalMeta `json:"retrieval,omitempty"`
}

func NewMeta

func NewMeta(profile string) Meta

type Record

type Record struct {
	SchemaVersion string     `json:"schema_version"`
	Type          string     `json:"type"`
	Meta          *Meta      `json:"meta,omitempty"`
	Data          any        `json:"data,omitempty"`
	Error         *ErrorBody `json:"error,omitempty"`
}

func DataRecord

func DataRecord(data any) Record

func ErrorRecord

func ErrorRecord(response ErrorResponse) Record

func ErrorRecordFrom

func ErrorRecordFrom(err error) Record

func MetaRecord

func MetaRecord(meta Meta) Record

type RetrievalMeta

type RetrievalMeta struct {
	RequestedCount int    `json:"requested_count"`
	ReturnedCount  int    `json:"returned_count"`
	Complete       *bool  `json:"complete"`
	Truncated      bool   `json:"truncated"`
	NextCursor     string `json:"next_cursor,omitempty"`
	InputCursor    string `json:"input_cursor,omitempty"`
	ServerTotal    *int   `json:"server_total,omitempty"`
	Pages          int    `json:"pages"`
}

type Writer

type Writer struct {
	Out    io.Writer
	Err    io.Writer
	Format Format
	Quiet  bool
}

func (Writer) Info

func (w Writer) Info(format string, args ...any)

func (Writer) JSON

func (w Writer) JSON(v any) error

func (Writer) JSONL

func (w Writer) JSONL(items []any) error

func (Writer) Print

func (w Writer) Print(v any) error

func (Writer) Warn

func (w Writer) Warn(format string, args ...any)

Jump to

Keyboard shortcuts

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