server

package
v0.0.0-...-583a8e8 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenerateExampleRequest

type GenerateExampleRequest struct {
	MessageType string                    `json:"messageType"`
	Options     descriptor.ExampleOptions `json:"options"`
}

GenerateExampleRequest represents the request body for example generation.

type GenerateExampleResponse

type GenerateExampleResponse struct {
	ExampleJSON string `json:"exampleJson"`
	Error       string `json:"error,omitempty"`
}

GenerateExampleResponse represents the response for example generation.

type Server

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

func New

func New(registry *descriptor.Registry) (*Server, error)

func NewWithTheme

func NewWithTheme(registry *descriptor.Registry, themeConfig *theme.Theme, cfg *config.Config) (*Server, error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler

func (*Server) SetRegistry

func (s *Server) SetRegistry(registry *descriptor.Registry)

SetRegistry atomically updates the registry and rebuilds the search index

type TryItError

type TryItError struct {
	// Code is the error code.
	Code int `json:"code"`

	// Message is the error message.
	Message string `json:"message"`

	// Details contains additional error information.
	Details []string `json:"details,omitempty"`
}

TryItError represents error details in the Try It response.

type TryItRequest

type TryItRequest struct {
	// Environment is the name of the configured environment to invoke against.
	Environment string `json:"environment"`

	// Method is the fully-qualified method name (e.g., "echo.v1.EchoService/Echo").
	Method string `json:"method"`

	// Transport is the RPC transport to use (connect, grpc, or grpc-web).
	// If empty, uses the environment's default transport.
	Transport string `json:"transport,omitempty"`

	// Headers are additional headers to include with the request.
	Headers map[string]string `json:"headers,omitempty"`

	// Body is the JSON request body.
	Body string `json:"body"`
}

TryItRequest represents the JSON request body for the /api/tryit/invoke endpoint.

type TryItResponse

type TryItResponse struct {
	// Success indicates whether the invocation succeeded.
	Success bool `json:"success"`

	// Status is the HTTP status code or gRPC status code.
	Status int `json:"status"`

	// StatusText is a human-readable status description.
	StatusText string `json:"statusText"`

	// Headers are the response headers (with sensitive values redacted).
	Headers map[string][]string `json:"headers,omitempty"`

	// Body is the response body as JSON.
	Body string `json:"body,omitempty"`

	// Latency is the request duration in milliseconds.
	LatencyMs int64 `json:"latencyMs"`

	// Error contains error details if the invocation failed.
	Error *TryItError `json:"error,omitempty"`
}

TryItResponse represents the JSON response for the /api/tryit/invoke endpoint.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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