config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Auth added in v0.4.0

type Auth struct {
	Basic *BasicAuth `json:"basic,omitempty"`
}

type BasicAuth added in v0.4.0

type BasicAuth struct {
	User     string `json:"user,omitempty"`
	Password string `json:"password,omitempty"`
}

type Client added in v0.4.0

type Client struct {
	HTTP *HTTPClient `json:"http,omitempty"`
	GRPC *GRPCClient `json:"grpc,omitempty"`
}

type Config

type Config struct {
	Services []Service
}

func Load

func Load() (sc *Config, err error)

type DigOutput added in v0.4.0

type DigOutput struct {
	Query string `json:"query,omitempty"`
}

type Endpoint

type Endpoint struct {
	Schema      string         `json:"$schema,omitempty"`
	Name        string         `json:"name,omitempty"`
	Comment     string         `json:"comment,omitempty"`
	Title       string         `json:"title,omitempty"`
	Source      string         `json:"source,omitempty"`
	Description string         `json:"description,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
	Headers     Header         `json:"headers,omitempty"`
	Form        Form           `json:"form,omitempty"`
	Links       []Link         `json:"links,omitempty"`
	Body        any            `json:"body,omitempty"`
	RawBody     any            `json:"rawBody,omitempty"`
	Vars        map[string]any `json:"vars,omitempty"`
	Auth        *Auth          `json:"auth,omitempty"`
	Output      []Output       `json:"output,omitempty"`
}

type File added in v0.4.0

type File struct {
	Schema string `json:"$schema,omitempty"`

	*Service

	Services []Service `json:"services,omitempty"`
	// contains filtered or unexported fields
}

func LoadFile added in v0.4.0

func LoadFile(f fs.FS, filename string) (*File, error)

LoadFile loads the given file from the file system and name

func (*File) Name added in v0.4.0

func (f *File) Name() string

func (*File) SetName added in v0.4.0

func (f *File) SetName(name string)

type Form added in v0.4.0

type Form map[string][]string

Form represents the key-value pairs in an encoded form.

func (Form) MarshalJSON added in v0.4.0

func (f Form) MarshalJSON() ([]byte, error)

func (*Form) UnmarshalJSON added in v0.4.0

func (f *Form) UnmarshalJSON(d []byte) error

type GRPCClient added in v0.4.0

type GRPCClient struct {
	DisableReflection bool   `json:"disableReflection,omitzero"`
	ProtoSet          string `json:"protoset,omitempty"`
	Plaintext         bool   `json:"plaintext,omitzero"`
}

type HTTPClient added in v0.4.0

type HTTPClient struct {
}
type Header map[string][]string

Header represents the key-value pairs in an HTTP header.

func (Header) MarshalJSON added in v0.4.0

func (h Header) MarshalJSON() ([]byte, error)

func (*Header) UnmarshalJSON

func (h *Header) UnmarshalJSON(d []byte) error

type JMESPathOutput added in v0.4.0

type JMESPathOutput struct {
	Query string `json:"query,omitempty"`
}

type JSONOutput added in v0.4.0

type JSONOutput struct {
	Pretty bool `json:"pretty,omitempty"`
}
type Link struct {
	HRef       string `json:"href,omitempty"`
	HRefLang   string `json:"hrefLang,omitempty"`
	Audience   string `json:"audience,omitempty"`
	Rel        string `json:"rel,omitempty"`
	Title      string `json:"title,omitempty"`
	Type       string `json:"type,omitempty"`
	IsTemplate bool   `json:"isTemplate,omitempty"`
}

type Output added in v0.4.0

type Output struct {
	Name            string          `json:"name,omitempty"`
	Comment         string          `json:"comment,omitempty"`
	Title           string          `json:"title,omitempty"`
	Description     string          `json:"description,omitempty"`
	Links           []Link          `json:"links,omitempty"`
	IncludeMetadata bool            `json:"includeMetadata,omitzero"`
	Template        *TemplateOutput `json:"template,omitempty"`
	JMESPath        *JMESPathOutput `json:"jmespath,omitempty"`
	XPath           *XPathOutput    `json:"xpath,omitempty"`
	Dig             *DigOutput      `json:"dig,omitempty"`
	JSON            *JSONOutput     `json:"json,omitempty"`
	XML             *XMLOutput      `json:"xml,omitempty"`
	YAML            *YAMLOutput     `json:"yaml,omitempty"`
}

type Resource

type Resource struct {
	Schema      string         `json:"$schema,omitempty"`
	Name        string         `json:"name,omitempty"`
	Comment     string         `json:"comment,omitempty"`
	Source      string         `json:"source,omitempty"`
	Title       string         `json:"title,omitempty"`
	Description string         `json:"description,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
	Resources   []Resource     `json:"resources,omitempty"`
	URI         string         `json:"uri,omitempty"`
	Headers     Header         `json:"headers,omitempty"`
	Form        Form           `json:"form,omitempty"`
	Links       []Link         `json:"links,omitempty"`
	Get         *Endpoint      `json:"get,omitempty"`
	Put         *Endpoint      `json:"put,omitempty"`
	Post        *Endpoint      `json:"post,omitempty"`
	Delete      *Endpoint      `json:"delete,omitempty"`
	Options     *Endpoint      `json:"options,omitempty"`
	Head        *Endpoint      `json:"head,omitempty"`
	Trace       *Endpoint      `json:"trace,omitempty"`
	Patch       *Endpoint      `json:"patch,omitempty"`
	Query       *Endpoint      `json:"query,omitempty"`
	Body        any            `json:"body,omitempty"`
	RawBody     any            `json:"rawBody,omitempty"`
	Vars        map[string]any `json:"vars,omitempty"`
	Auth        *Auth          `json:"auth,omitempty"`
	Output      []Output       `json:"output,omitempty"`
}

type Server

type Server struct {
	Schema      string         `json:"$schema,omitempty"`
	Name        string         `json:"name"`
	Comment     string         `json:"comment,omitempty"`
	Source      string         `json:"source,omitempty"`
	Description string         `json:"description,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
	Title       string         `json:"title,omitempty"`
	BaseURL     string         `json:"baseUrl"`
	Headers     Header         `json:"headers,omitempty"`
	Links       []Link         `json:"links,omitempty"`
	Vars        map[string]any `json:"vars,omitempty"`
	Auth        *Auth          `json:"auth,omitempty"`
	Output      []Output       `json:"output,omitempty"`
}

type Service

type Service struct {
	Schema      string         `json:"$schema,omitempty"`
	Name        string         `json:"name"`
	Comment     string         `json:"comment,omitempty"`
	Source      string         `json:"source,omitempty"`
	Title       string         `json:"title,omitempty"`
	Description string         `json:"description,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
	Servers     []Server       `json:"servers,omitempty"`
	Resources   []Resource     `json:"resources,omitempty"`
	Links       []Link         `json:"links,omitempty"`
	Vars        map[string]any `json:"vars,omitempty"`
	Client      *Client        `json:"client,omitempty"`
	Auth        *Auth          `json:"auth,omitempty"`
	Output      []Output       `json:"output,omitempty"`
}

func Builtin added in v0.4.0

func Builtin(name string) Service

func Builtins added in v0.4.0

func Builtins() []Service

func ExampleHTTPBinorg

func ExampleHTTPBinorg() Service

type TemplateOutput added in v0.4.0

type TemplateOutput struct {
	Text string `json:"text,omitempty"`
	File string `json:"file,omitempty"`
}

type XMLOutput added in v0.4.0

type XMLOutput struct {
	Pretty bool `json:"pretty,omitempty"`
}

type XPathOutput added in v0.4.0

type XPathOutput struct {
	Query string `json:"query,omitempty"`
}

type YAMLOutput added in v0.4.0

type YAMLOutput struct {
}

Jump to

Keyboard shortcuts

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