api

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	BaseURL  string
	Auth     string
	AuthType string
	Headers  map[string]string
	Spec     string
	// contains filtered or unexported fields
}

func NewSession

func NewSession(cfg *config.API, opts ...SessionOption) (*Session, error)

func (*Session) Delete

func (s *Session) Delete(path string) (string, error)

func (*Session) Get

func (s *Session) Get(path string) (string, error)

func (*Session) Interactive

func (s *Session) Interactive() error

func (*Session) Post

func (s *Session) Post(path, body string) (string, error)

func (*Session) Put

func (s *Session) Put(path, body string) (string, error)

func (*Session) Request

func (s *Session) Request(method, path, body string, extra map[string]string) (string, error)

type SessionOption added in v0.19.0

type SessionOption func(*Session)

func WithJqFilter added in v0.19.0

func WithJqFilter(filter string) SessionOption

WithJqFilter sets a jq filter for the session.

type Spec added in v0.25.0

type Spec struct {
	Title     string         `json:"title"`
	Version   string         `json:"version"`
	Endpoints []SpecEndpoint `json:"endpoints"`
}

Spec represents a parsed OpenAPI specification.

func ParseSpec added in v0.25.0

func ParseSpec(path string) (*Spec, error)

ParseSpec reads and parses an OpenAPI/Swagger spec file (YAML or JSON). Returns a structured Spec with all endpoints extracted.

func (*Spec) EndpointsByTag added in v0.25.0

func (s *Spec) EndpointsByTag() map[string][]SpecEndpoint

EndpointsByTag groups endpoints by their first tag.

func (*Spec) FindEndpoint added in v0.25.0

func (s *Spec) FindEndpoint(method, path string) *SpecEndpoint

FindEndpoint searches for an endpoint matching the given method and path. Path matching supports both exact match and parameterized paths like /users/{id}.

type SpecEndpoint added in v0.25.0

type SpecEndpoint struct {
	Method      string   `json:"method"`
	Path        string   `json:"path"`
	Summary     string   `json:"summary,omitempty"`
	OperationID string   `json:"operation_id,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

SpecEndpoint represents a single API endpoint parsed from an OpenAPI spec.

Jump to

Keyboard shortcuts

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