output

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedFormat = errors.New("unsupported format")

Functions

This section is empty.

Types

type Format

type Format string
const (
	Text Format = "text"
	JSON Format = "json"
	RAW  Format = "raw"
)

type JSONOutput

type JSONOutput struct {
	// contains filtered or unexported fields
}

func NewJSONOutput

func NewJSONOutput() *JSONOutput

func NewRawOutput

func NewRawOutput() *JSONOutput

func (*JSONOutput) MessageState

func (o *JSONOutput) MessageState(src smsgateway.MessageState) (string, error)

func (*JSONOutput) Success added in v1.1.0

func (o *JSONOutput) Success() (string, error)

func (*JSONOutput) Webhook added in v1.1.0

func (o *JSONOutput) Webhook(src smsgateway.Webhook) (string, error)

func (*JSONOutput) Webhooks added in v1.1.0

func (o *JSONOutput) Webhooks(src []smsgateway.Webhook) (string, error)

type Renderer

type Renderer interface {
	MessageState(src smsgateway.MessageState) (string, error)
	Webhook(src smsgateway.Webhook) (string, error)
	Webhooks(src []smsgateway.Webhook) (string, error)
	Success() (string, error)
}

func New

func New(format Format) (Renderer, error)

type TextOutput

type TextOutput struct {
}

func NewTextOutput

func NewTextOutput() *TextOutput

func (*TextOutput) MessageState

func (*TextOutput) MessageState(src smsgateway.MessageState) (string, error)

func (*TextOutput) Success added in v1.1.0

func (*TextOutput) Success() (string, error)

Success returns a string indicating success.

func (*TextOutput) Webhook added in v1.1.0

func (*TextOutput) Webhook(src smsgateway.Webhook) (string, error)

Webhook formats a single smsgateway.Webhook into a string representation. The output includes the ID, Event, and URL of the webhook.

func (*TextOutput) Webhooks added in v1.1.0

func (o *TextOutput) Webhooks(src []smsgateway.Webhook) (string, error)

Webhooks formats a slice of smsgateway.Webhook into a single string representation. Each webhook's string representation is separated by "---". Returns the formatted string and any error encountered during formatting.

Jump to

Keyboard shortcuts

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