Documentation ¶
Index ¶
- Variables
- func Configure(config Config)
- func EchoMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func GinMiddleware(c *gin.Context)
- func Middleware(next http.Handler) http.Handler
- func MiddlewareController(r *http.Request) *controller
- func NewCaptureWriter(origResW http.ResponseWriter, maxBuffer int) *captureWriter
- type Config
- type Speakeasy
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAPIKeyMissing is returned when the API Key is not provided at configuration time. ErrAPIKeyMissing = errors.New("API key is required") // ErrAPIIdMissing is returned when the Api ID is not provided at configuration time. ErrApiIDMissing = errors.New("ApiID is required") // ErrApiIDMalformed is returned when the Api ID is invalid. ErrApiIDMalformed = errors.New("ApiID is malformed") // ErrVersionIDMissing is returned when the Version ID is not provided at configuration time. ErrVersionIDMissing = errors.New("VersionID is required") // ErrVersionIDMalformed is returned when the Version ID is invalid. ErrVersionIDMalformed = errors.New("VersionID is malformed") )
Functions ¶
func Configure ¶
func Configure(config Config)
Configure allows you to configure the default instance of the Speakeasy SDK. Use this if you will use the same API Key for all connected APIs.
func EchoMiddleware ¶ added in v0.0.3
func EchoMiddleware(next echo.HandlerFunc) echo.HandlerFunc
EchoMiddleware setups up the default SDK instance to start capturing requests from the echo http framework.
func GinMiddleware ¶ added in v0.0.3
GinMiddleware setups up the default SDK instance to start capturing requests from the gin http framework.
func Middleware ¶ added in v0.0.1
Middleware setups up the default SDK instance to start capturing requests from routers that support http.Handlers. Currently only gorilla/mux, go-chi/chi routers and the http.DefaultServerMux are supported for automatically capturing path hints. Otherwise path hints can be supplied by a handler through the speakeasy MiddlewareController.
func MiddlewareController ¶ added in v0.0.3
MiddlewareController will return the speakeasy middleware controller from the current request, if the current request is monitored by the speakeasy middleware.
func NewCaptureWriter ¶ added in v0.0.3
func NewCaptureWriter(origResW http.ResponseWriter, maxBuffer int) *captureWriter
Types ¶
type Config ¶
type Config struct { // APIKey is the API Key obtained from the Speakeasy platform for capturing requests to a particular workspace. APIKey string // ApiID is the ID of the Api to associate any requests captured by this instance of the SDK to. ApiID string // VersionID is the ID of the Api Version to associate any requests captured by this instance of the SDK to. VersionID string GRPCDialer func() func(context.Context, string) (net.Conn, error) }
Config provides configuration for the Speakeasy SDK.
type Speakeasy ¶ added in v1.1.0
type Speakeasy struct {
// contains filtered or unexported fields
}
Speakeasy is the concrete type for the Speakeasy SDK. Don't instantiate this directly, use Configure() or New() instead.
func New ¶ added in v0.0.1
New creates a new instance of the Speakeasy SDK. This allows you to create multiple instances of the SDK for specifying different API Keys for different APIs.
func (*Speakeasy) EchoMiddleware ¶ added in v1.1.0
func (s *Speakeasy) EchoMiddleware(next echo.HandlerFunc) echo.HandlerFunc
EchoMiddleware setups the current instance of the SDK to start capturing requests from the echo http framework.
func (*Speakeasy) GinMiddleware ¶ added in v1.1.0
GinMiddleware setups the current instance of the SDK to start capturing requests from the gin http framework.
func (*Speakeasy) Middleware ¶ added in v1.1.0
Middleware setups the current instance of the SDK to start capturing requests from routers that support http.Handlers. Currently only gorilla/mux, go-chi/chi routers and the http.DefaultServerMux are supported for automatically capturing path hints. Otherwise path hints can be supplied by a handler through the speakeasy MiddlewareController.