Documentation
¶
Index ¶
- Constants
- Variables
- func Addon() gowdk.Addon
- func DecodeJSON[T any](request *http.Request) (T, error)
- func Error(status int, code string, message string) (response.Response, error)
- func JSON(status int, value any) (response.Response, error)
- func NoContent() response.Response
- func QueryBool(request *http.Request, name string) (bool, bool, error)
- func QueryInt(request *http.Request, name string) (int, bool, error)
- func QueryInt64(request *http.Request, name string) (int64, bool, error)
- func QueryString(request *http.Request, name string) (string, bool)
- func QueryStrings(request *http.Request, name string) []string
- type ErrorBody
- type ErrorInfo
- type Handler
- type Registry
Constants ¶
View Source
const ImportPath = "github.com/cssbruno/gowdk/addons/api"
ImportPath is the canonical Go import path for the API addon.
Variables ¶
View Source
var ( // ErrNilRequest reports that a helper was called without an HTTP request. ErrNilRequest = errors.New("api request is nil") // ErrUnsupportedContentType reports a non-JSON request content type. ErrUnsupportedContentType = errors.New("unsupported API content type") // ErrMultipleJSONValues reports a JSON request body with trailing values. ErrMultipleJSONValues = errors.New("multiple JSON values in API request body") )
Functions ¶
func DecodeJSON ¶ added in v0.5.0
DecodeJSON decodes a JSON request body into T. Unknown object fields are rejected so handler inputs stay explicit.
func QueryInt64 ¶ added in v0.5.0
QueryInt64 returns the first query value for name as an int64.
func QueryString ¶ added in v0.5.0
QueryString returns the first query value for name.
Types ¶
Click to show internal directories.
Click to hide internal directories.