Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyOption ¶
type ApplyOption func(*applyOptions)
func WithApplyData ¶
func WithApplyData(data []byte) ApplyOption
func WithApplyObject ¶
func WithApplyObject(object hz.Objecter) ApplyOption
type Client ¶
Client is an HTTP client for interacting with a Horizon server.
It is intended for CLIs and other tooling for end users. If you are building a service or controller, use the hz.Client instead which uses a NATS directly, and not the HTTP API.
func (*Client) Apply ¶
func (c *Client) Apply( ctx context.Context, opts ...ApplyOption, ) (hz.ApplyOpResult, error)
type Config ¶
type Config struct { CurrentContext string `json:"currentContext"` Contexts []Context `json:"contexts"` }
Config represents the configuration file for the Horizon CLI. It contains a list of context and the current context.
type Context ¶
type Context struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` Session *string `json:"session,omitempty"` }
Context represents a Horizon context. It contains the name, URL and session for a Horizon server.
func (*Context) Validate ¶
func (c *Context) Validate(opts ...ValidateOption) error
Validate validates the context based on the given validation options.
type ContextOption ¶
type ContextOption func(*contextOptions)
func WithContextByName ¶
func WithContextByName(name string) ContextOption
WithContextByName returns a ContextOption that sets the context to the one with the given name.
func WithContextCurrent ¶
func WithContextCurrent(b bool) ContextOption
WithContextCurrent returns a ContextOption that sets the context to the current context based on the given bool.
func WithContextTryName ¶
func WithContextTryName(name *string) ContextOption
WithContextTryName returns a ContextOption that sets the context name to the given string, if it is not nil nor empty. If the given string is nil or empty, it does nothing.
func WithContextValidate ¶
func WithContextValidate(opts ...ValidateOption) ContextOption
WithContextValidate returns a ContextOption that sets the context validation options to the given ValidateOptions.
type DeleteOption ¶
type DeleteOption func(*deleteOptions)
func WithDeleteData ¶
func WithDeleteData(data []byte) DeleteOption
func WithDeleteKey ¶
func WithDeleteKey(key hz.ObjectKeyer) DeleteOption
type ListOption ¶
type ListOption func(*getOptions)
func WithListKey ¶
func WithListKey(key hz.ObjectKey) ListOption
func WithListResponseGenericObject ¶
func WithListResponseGenericObject( resp *hz.GenericObjectList, ) ListOption
func WithListResponseWriter ¶
func WithListResponseWriter(w io.Writer) ListOption
type ValidateOption ¶
type ValidateOption func(*validateOptions)
func WithValidateSession ¶
func WithValidateSession(b bool) ValidateOption
WithValidateSession returns a ValidateOption that sets the session validation to the given bool.