http

package
v0.1.118 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 24 Imported by: 0

README

HTTP plugin

  • Client
  • Server

Documentation

Index

Constants

View Source
const (
	ClientComponent    = "http_client"
	ClientRequestPort  = "request"
	ClientResponsePort = "response"
	ClientErrorPort    = "error"
)
View Source
const (
	HeaderContentType   = "Content-Type"
	MIMEApplicationJSON = "application/json"
	MIMEApplicationXML  = "application/xml"
	MIMETextXML         = "text/xml"
	MimeTextPlain       = "text/plain"
	MIMETextHTML        = "text/html"
	MIMEApplicationForm = "application/x-www-form-urlencoded"
	MIMEMultipartForm   = "multipart/form-data"
)
View Source
const (
	ServerComponent    string = "http_server"
	ServerResponsePort        = "response"
	ServerRequestPort         = "request"
	ServerStartPort           = "start"
	ServerStopPort            = "stop"
	ServerStatusPort          = "status"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func (*Client) GetInfo

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

func (*Client) Handle

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

func (*Client) Instance

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

func (*Client) Ports

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

type ClientError

type ClientError struct {
	Context  ClientRequestContext   `json:"context" configurable:"true" required:"true" title:"Context" description:"Message to be sent further"`
	Request  ClientRequestRequest   `json:"request" required:"true"`
	Response ClientResponseResponse `json:"response"`
	Error    string                 `json:"error" required:"true"`
}

type ClientRequest

type ClientRequest struct {
	Context ClientRequestContext `json:"context,omitempty" configurable:"true" title:"Context" description:"Message to be sent further"`
	Request ClientRequestRequest `json:"request" title:"Request" required:"true" description:"HTTP Request"`
}

type ClientRequestContext

type ClientRequestContext any

type ClientRequestRequest

type ClientRequestRequest struct {
	Method  string `` /* 137-byte string literal not displayed */
	Timeout int    `json:"timeout" required:"true" title:"Request Timeout" colSpan:"col-span-6"`

	URL                 string      `json:"url" required:"true" title:"URL" format:"uri"`
	ContentType         ContentType `json:"contentType" title:"Request Content Type" required:"true"`
	Headers             []Header    `json:"headers" required:"true" title:"Headers"`
	Body                any         `json:"body" configurable:"true" title:"Request Body"`
	ResponseContentType ContentType `json:"responseContentType,omitempty" title:"Response Content Type" description:"Override response content type"`
}

type ClientRequestSettings

type ClientRequestSettings struct {
	EnableErrorPort bool `` /* 137-byte string literal not displayed */
}

type ClientResponse

type ClientResponse struct {
	Context  ClientRequestContext   `json:"context" configurable:"true" required:"true" title:"Context" description:"Message to be sent further"`
	Request  ClientRequestRequest   `json:"request" title:"Request" required:"true" description:"HTTP Request"`
	Response ClientResponseResponse `json:"response" title:"Response" required:"true" description:"HTTP Response"`
}

type ClientResponseResponse

type ClientResponseResponse struct {
	Headers    []Header `json:"headers" required:"true" title:"Headers"`
	Status     string   `json:"status"`
	StatusCode int      `json:"statusCode"`
	Body       any      `json:"response" required:"true" title:"Body"`
}

type ContentType

type ContentType string

func (ContentType) JSONSchema

func (c ContentType) JSONSchema() (jsonschema.Schema, error)
type Header struct {
	Key   string `json:"key" required:"true" title:"Key" colSpan:"col-span-6"`
	Value string `json:"value" required:"true" title:"Value" colSpan:"col-span-6"`
}

type Server

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

func (*Server) GetInfo

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

func (*Server) Handle

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

func (*Server) Instance

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

func (*Server) Ports

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

type ServerRequest

type ServerRequest struct {
	Context       ServerStartContext `json:"context"`
	RequestID     string             `json:"requestID" required:"true"`
	RequestURI    string             `json:"requestURI" required:"true"`
	RequestParams url.Values         `json:"requestParams" required:"true"`
	Host          string             `json:"host" required:"true"`
	Method        string             `json:"method" required:"true" title:"Method" enum:"GET,POST,PATCH,PUT,DELETE" enumTitles:"GET,POST,PATCH,PUT,DELETE"`
	RealIP        string             `json:"realIP"`
	Headers       []Header           `json:"headers,omitempty"`
	Body          any                `json:"body"`
	Scheme        string             `json:"scheme"`
}

type ServerResponse

type ServerResponse struct {
	RequestID   string             `` /* 143-byte string literal not displayed */
	StatusCode  int                `` /* 139-byte string literal not displayed */
	ContentType ContentType        `json:"contentType" required:"true"`
	Headers     []Header           `json:"headers"  title:"Response headers"`
	Body        ServerResponseBody `json:"body" title:"Response body" configurable:"true"`
}

type ServerResponseBody

type ServerResponseBody any

type ServerSettings

type ServerSettings struct {
	EnableStatusPort bool `` /* 127-byte string literal not displayed */
	EnableStopPort   bool `json:"enableStopPort" required:"true" title:"Enable stop port" description:"Stop port allows you to stop the server"`
	EnableStartPort  bool `json:"enableStartPort" required:"true" title:"Enable start port" description:"Start port allows you to start the server"`
}

type ServerStart

type ServerStart struct {
	Context      ServerStartContext `json:"context" configurable:"true" title:"Context" description:"Start context"`
	AutoHostName bool               `json:"autoHostName" title:"Automatically generate hostname" description:"Use cluster auto subdomain setup if any."`
	Hostnames    []string           `json:"hostnames" title:"Hostnames" required:"false" description:"List of virtual host this server should be bound to."` //requiredWhen:"['kind', 'equal', 'enum 1']"
	ReadTimeout  int                ``                                                                                                                       /* 215-byte string literal not displayed */
	WriteTimeout int                ``                                                                                                                       /* 204-byte string literal not displayed */
}

type ServerStartContext

type ServerStartContext any

type ServerStartControl

type ServerStartControl struct {
	Status string `json:"status" title:"Status" readonly:"true"`
	Start  bool   `json:"start" format:"button" title:"Start" required:"true" description:"Start HTTP server"`
}

type ServerStatus

type ServerStatus struct {
	Context    ServerStartContext `json:"context" title:"Context"`
	ListenAddr []string           `json:"listenAddr" title:"Listen Address" readonly:"true"`
	IsRunning  bool               `json:"isRunning" title:"Is running" readonly:"true"`
}

type ServerStop

type ServerStop struct {
}

type ServerStopControl

type ServerStopControl struct {
	Stop       bool     `json:"stop" format:"button" title:"Stop" required:"true" description:"Stop HTTP server"`
	Status     string   `json:"status" title:"Status" readonly:"true"`
	ListenAddr []string `json:"listenAddr" title:"Listen Address" readonly:"true"`
}

Jump to

Keyboard shortcuts

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