Documentation
¶
Index ¶
- Constants
- Variables
- func ErrorResponseJSON(w http.ResponseWriter, httpCode int, internalCode int, err error)
- func ExtractTokenFromRequest(r *http.Request) (string, error)
- func GetAuthorizationTokenFromRequestHeader(r *http.Request, prefix string) string
- func GetDeviceTypeFromRequestHeaders(r *http.Request) string
- func GetLimitAndOffsetFromPageNumber(page, limit int) (int, int)
- func GetLimitAndOffsetFromRequest(r *http.Request) (int, int)
- func GetPagingInt32FromPageNumber(page, limit int) (int32, int32)
- func GetPagingInt32FromRequest(r *http.Request) (int32, int32)
- func GetPagingInt64FromPageNumber(page, limit int) (int64, int64)
- func GetPagingInt64FromRequest(r *http.Request) (int64, int64)
- func GetRequestAuthorFootprint(r *http.Request) string
- func GetRequestCookieStringValue(r *http.Request, cookieName string) (string, error)
- func GetRequestIPAddress(r *http.Request) string
- func GetTokenIdFromRequestCookie(r *http.Request) string
- func HTTPTokenHandler(handler http.Handler) http.Handler
- func PerformHTTPRequestUrl(host, url string, args map[string]string) string
- func ResponseJSON(w http.ResponseWriter, v interface{})
- func SendSlackHook(url, channel, username, message string) error
- func SetCookieName(name string)
- func SetHttpCookieValue(w http.ResponseWriter, domain, cookieName, value string, expireTime time.Time)
- func SuccessfulResultMap() map[string]interface{}
- type ApiError
- type CreatedObjectId
- type GatewayInterceptor
- type HTTPInterceptor
- func (i *HTTPInterceptor) ErrorResponseJSON(ctx context.Context, w http.ResponseWriter, statusCode, internalCode int, ...)
- func (i *HTTPInterceptor) ResponseJSON(ctx context.Context, w http.ResponseWriter, payload interface{})
- func (i *HTTPInterceptor) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type ListResult
- type Response
- type ResultAdditionalFields
- type Router
Constants ¶
View Source
const ( PrefixBearer = "Bearer " ContextToken = "access_token" )
Variables ¶
View Source
var CookieName = "session"
Functions ¶
func ErrorResponseJSON ¶
func ErrorResponseJSON(w http.ResponseWriter, httpCode int, internalCode int, err error)
Sends error http response
func ExtractTokenFromRequest ¶ added in v0.4.0
func GetDeviceTypeFromRequestHeaders ¶
GetDeviceTypeFromRequestHeaders
func GetRequestCookieStringValue ¶
GetRequestCookieStringValue
func GetRequestIPAddress ¶
func GetTokenIdFromRequestCookie ¶ added in v0.4.0
func PerformHTTPRequestUrl ¶
func SendSlackHook ¶
func SetCookieName ¶ added in v0.4.0
func SetCookieName(name string)
func SetHttpCookieValue ¶
func SetHttpCookieValue(w http.ResponseWriter, domain, cookieName, value string, expireTime time.Time)
SetHttpCookieValue
func SuccessfulResultMap ¶
func SuccessfulResultMap() map[string]interface{}
Types ¶
type ApiError ¶
type ApiError struct {
HttpStatus int `json:"http_status,omitempty"`
ErrorCode int `json:"code"`
Message interface{} `json:"message"`
Timestamp interface{} `json:"timestamp"`
}
func NewApiError ¶
type CreatedObjectId ¶
type CreatedObjectId struct {
Id interface{} `json:"id,omitempty" yaml:"id,omitempty"`
UUID interface{} `json:"uuid,omitempty" yaml:"uuid,omitempty"`
}
type GatewayInterceptor ¶
type GatewayInterceptor struct {
Mux *runtime.ServeMux
Tracer opentracing.Tracer
Logger *zap.SugaredLogger
}
func (*GatewayInterceptor) ServeHTTP ¶
func (i *GatewayInterceptor) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTPInterceptor ¶
type HTTPInterceptor struct {
Router Router
Tracer opentracing.Tracer
Logger *zap.SugaredLogger
}
HTTPInterceptor
func (*HTTPInterceptor) ErrorResponseJSON ¶ added in v0.2.0
func (i *HTTPInterceptor) ErrorResponseJSON(ctx context.Context, w http.ResponseWriter, statusCode, internalCode int, err error)
ErrorResponseJSON
func (*HTTPInterceptor) ResponseJSON ¶ added in v0.2.0
func (i *HTTPInterceptor) ResponseJSON(ctx context.Context, w http.ResponseWriter, payload interface{})
ResponseJSON
func (*HTTPInterceptor) ServeHTTP ¶
func (i *HTTPInterceptor) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP
type ListResult ¶
type Response ¶ added in v0.1.3
type Response struct {
Success bool `json:"success" yaml:"success"`
Timestamp interface{} `json:"timestamp,omitempty" yaml:"timestamp,omitempty" `
Message interface{} `json:"message,omitempty" yaml:"message,omitempty"`
Data interface{} `json:"data,omitempty" yaml:"data,omitempty"`
CreatedObjectId
RequestStatus *ApiError `json:"request_status" yaml:"request_status,omitempty"`
}
func SuccessfulResult ¶
func SuccessfulResult() Response
type ResultAdditionalFields ¶
type ResultAdditionalFields map[string]interface{}
Click to show internal directories.
Click to hide internal directories.