Documentation
¶
Overview ¶
Package apimodels provides models for HTTP api
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIContext ¶
type APIContext struct {
Configuration *configuration.APIConfiguration
Trazability Trazability
Request Request
Response Response
Database *sql.DB
}
type Endpoint ¶
type Endpoint struct {
Path string `json:"path,omitempty"`
Method HTTPMethod `json:"method,omitempty"`
RequestMimeType MimeType `json:"requestMimeType,omitempty"`
ResponseMimeType MimeType `json:"responseMimeType,omitempty"`
Listener EndpointListener `json:"-"`
IsMultipartForm bool `json:"containsFiles,omitempty"`
Secured bool `json:"secured,omitempty"`
Database bool `json:"-"`
}
type EndpointListener ¶
type EndpointListener func(context *APIContext) (*Response, *verrors.APIError)
type HTTPHeaders ¶
type HTTPHeaders string
const ( HeaderContentType HTTPHeaders = "Content-Type" HeaderAccept HTTPHeaders = "Accept" HeaderAuthorization HTTPHeaders = "Authorization" HeaderUserAgent HTTPHeaders = "User-Agent" HeaderContentLength HTTPHeaders = "Content-Length" HeaderContentEncoding HTTPHeaders = "Content-Encoding" HeaderContentDisposition HTTPHeaders = "Content-Disposition" HeaderContentTransferEncoding HTTPHeaders = "Content-Transfer-Encoding" HeaderContentLanguage HTTPHeaders = "Content-Language" )
type HTTPMethod ¶
type HTTPMethod int
const ( GetMethod HTTPMethod = iota PostMethod PutMethod DeleteMethod PatchMethod OptionsMethod HeadMethod TraceMethod )
type MimeType ¶
type MimeType string
const ( MimeApplicationJSON MimeType = "application/json" MimeApplicationXML MimeType = "application/xml" MimeApplicationYaml MimeType = "application/yaml" MimeApplicationForm MimeType = "application/x-www-form-urlencoded" MimeApplicationOctetStream MimeType = "application/octet-stream" MimeTextPlain MimeType = "text/plain" MimeTextHTML MimeType = "text/html" )
type Request ¶
type Request struct {
Authorization string `json:"authorization,omitempty"`
IP string `json:"ip,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
Params map[string]string `json:"params,omitempty"`
Body any `json:"body,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Files map[string][]*multipart.FileHeader `json:"files,omitempty"`
}
type Trazability ¶
Click to show internal directories.
Click to hide internal directories.