openapi_client

package
v0.1.111 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentName = "openapi_client"
	RequestPort   = "request"
	ResponsePort  = "response"
	ErrorPort     = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

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

APIClient represents an OpenAPI 3.x HTTP client

func NewAPIClient

func NewAPIClient(ctx context.Context, specification string, baseURL string, options ...ClientOption) (*APIClient, error)

NewAPIClient creates a new API client from OpenAPI 3.x specification

func (*APIClient) Call

func (c *APIClient) Call(ctx context.Context, operationID string, params *RequestParams) (*APIResponse, error)

Call makes an API call using the operation ID from the OpenAPI spec

type APIResponse

type APIResponse struct {
	StatusCode int
	Headers    http.Header
	Body       []byte
}

APIResponse wraps the HTTP response

func (*APIResponse) UnmarshalResponse

func (r *APIResponse) UnmarshalResponse(target interface{}) error

UnmarshalResponse unmarshals the response body into the given target

type ClientOption

type ClientOption func(*APIClient)

ClientOption allows customizing the API client

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

WithHTTPClient sets a custom HTTP client

func WithHeader

func WithHeader(key, value string) ClientOption

WithHeader adds a default header to all requests

type Component

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

func (*Component) GetInfo

func (h *Component) GetInfo() module.ComponentInfo

func (*Component) Handle

func (h *Component) Handle(ctx context.Context, handler module.Handler, port string, msg interface{}) any

func (*Component) Instance

func (h *Component) Instance() module.Component

func (*Component) Ports

func (h *Component) Ports() []module.Port

type Context

type Context any

type EnabledResponses

type EnabledResponses struct {
	MultiEnum
}

EnabledResponses special type which can carry its value and possible options for enum values

type Enum

type Enum struct {
	Value        string
	Options      []string
	OptionLabels []string
}

Enum special type which can carry its value and possible options for enum values

func (Enum) JSONSchema

func (r Enum) JSONSchema() (jsonschema.Schema, error)

func (Enum) MarshalJSON

func (r Enum) MarshalJSON() ([]byte, error)

MarshalJSON treat like underlying Value string

func (*Enum) UnmarshalJSON

func (r *Enum) UnmarshalJSON(data []byte) error

UnmarshalJSON treat like underlying Value string

type Error

type Error struct {
	Context Context `json:"context"`
	Error   string  `json:"error"`
}

type MultiEnum

type MultiEnum struct {
	Value        []string
	Options      []string
	OptionLabels []string
}

MultiEnum special type which can carry its value and possible options for enum values

func (MultiEnum) JSONSchema

func (r MultiEnum) JSONSchema() (jsonschema.Schema, error)

func (MultiEnum) MarshalJSON

func (r MultiEnum) MarshalJSON() ([]byte, error)

MarshalJSON treat like underlying Value string

func (*MultiEnum) UnmarshalJSON

func (r *MultiEnum) UnmarshalJSON(data []byte) error

UnmarshalJSON treat like underlying Value string

type MultiError

type MultiError struct {
	Errors []error
}

func (MultiError) Error

func (m MultiError) Error() string

type OperationName

type OperationName struct {
	Enum
}

OperationName special type which can carry its value and possible options for enum values

type Request

type Request struct {
	Context Context    `json:"context" configurable:"true" title:"Context" description:"Arbitrary message to be send alongside with encoded message"`
	Request RequestMsg `json:"request" required:"true" title:"Request message" description:""`
}

type RequestMsg

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

func (RequestMsg) JSONSchema

func (r RequestMsg) JSONSchema() (jsonschema.Schema, error)

type RequestParams

type RequestParams struct {
	Path   map[string]string
	Query  url.Values
	Header http.Header
	Body   interface{}
}

RequestParams holds parameters for an API request

type Response

type Response struct {
	Context  Context     `json:"context"`
	Response ResponseMsg `json:"response"`
}

type ResponseMsg

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

func (ResponseMsg) JSONSchema

func (r ResponseMsg) JSONSchema() (jsonschema.Schema, error)

type Settings

type Settings struct {
	OperationName    OperationName    `json:"operationName" tab:"Request" title:"Operation" description:"Operation name"`
	EnabledResponses EnabledResponses `` /* 143-byte string literal not displayed */
	Specification    string           `` /* 138-byte string literal not displayed */
	EnableErrorPort  bool             `` /* 147-byte string literal not displayed */
}

Jump to

Keyboard shortcuts

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