Documentation
¶
Index ¶
Constants ¶
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 ¶
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
type EnabledResponses ¶
type EnabledResponses struct {
MultiEnum
}
EnabledResponses special type which can carry its value and possible options for enum values
type Enum ¶
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 ¶
MarshalJSON treat like underlying Value string
func (*Enum) UnmarshalJSON ¶
UnmarshalJSON treat like underlying Value string
type MultiEnum ¶
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 ¶
MarshalJSON treat like underlying Value string
func (*MultiEnum) UnmarshalJSON ¶
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 */
}