callout

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRequest added in v0.18.2

type BaseRequest struct {
	Operation  string    `json:"operation,omitempty"`
	EntityType string    `json:"entity_type,omitempty"`
	EntityID   string    `json:"entity_id,omitempty"`
	CallerID   string    `json:"caller_id,omitempty"`
	CallerType string    `json:"caller_type,omitempty"`
	DomainID   string    `json:"domain_id,omitempty"`
	Time       time.Time `json:"time,omitempty"`
}

Can be used in the implementation of callout service with structured payload.

type Callout

type Callout interface {
	Callout(ctx context.Context, req Request) error
}

Callout send a request to an external service.

func New

func New(cfg Config) (Callout, error)

New creates a new instance of Callout.

type Config

type Config struct {
	URLs            []string      `env:"URLS"             envDefault:"" envSeparator:","`
	Method          string        `env:"METHOD"           envDefault:"POST"`
	TLSVerification bool          `env:"TLS_VERIFICATION" envDefault:"true"`
	Timeout         time.Duration `env:"TIMEOUT"          envDefault:"10s"`
	CACert          string        `env:"CA_CERT"          envDefault:""`
	Cert            string        `env:"CERT"             envDefault:""`
	Key             string        `env:"KEY"              envDefault:""`
	Operations      []string      `env:"OPERATIONS"       envDefault:"" envSeparator:","`
}

type Request added in v0.18.2

type Request struct {
	BaseRequest
	Payload map[string]any `json:"payload,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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