Documentation ¶
Index ¶
- Variables
- func GetDataFromURL(url string) ([]byte, error)
- func GetNodeIdFromPath(c *gin.Context, nodeIdKey string) (id ukama.NodeID, isValid bool)
- func GetUuidFromPath(c *gin.Context, uuidKey string) (id uuid.UUID, isValid bool)
- func NewFizzRouter(httpConfig *HttpConfig, srvName string, srvVersion string, isDebug bool, ...) *fizz.Fizz
- func SendErrorResponseFromGet(c *gin.Context, entityType string, err error)
- func ThrowError(c *gin.Context, status int, message string, details string, err error)
- type ErrorMessage
- type ErrorResponse
- type ExtJson
- type HttpConfig
- type HttpError
- type PingResponse
- type RestClient
Constants ¶
This section is empty.
Variables ¶
View Source
var SESSION_KEY = "ukama_session"
Functions ¶
func GetDataFromURL ¶
HTTP req to GET data from URL, Returns byte array
func GetNodeIdFromPath ¶
GetNodeIdFromPath extracts nodeId from url parameter with nodeIdKey name and returns the value as NodeId object in case of parsing error or missing parameter it will use context to return error message and http.StatusBadRequest code
func GetUuidFromPath ¶
func NewFizzRouter ¶
Types ¶
type ErrorMessage ¶
type ErrorResponse ¶
type ErrorResponse struct {
Err string `json:"error,omitempty"`
}
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
type ExtJson ¶
type ExtJson struct { Data interface{} Indent bool }
func (ExtJson) Render ¶
func (r ExtJson) Render(w http.ResponseWriter) (err error)
Render (JSON) writes data with custom ContentType.
func (ExtJson) WriteContentType ¶
func (r ExtJson) WriteContentType(w http.ResponseWriter)
writeContentType (JSON) writes JSON ContentType.
type HttpConfig ¶
type HttpConfig struct { Port int `default:"8080"` Cors cors.Config `default:"{\"AllowOrigins\": [\"http://localhost\", \"https://localhost\", \"*\"]}"` }
func DefaultHTTPConfig ¶
func DefaultHTTPConfig() HttpConfig
Use this if you don't use github.com/num30/config
type PingResponse ¶
type RestClient ¶
func NewRestClient ¶
func NewRestClient(path string, debug bool) (*RestClient, error)
func NewRestClientWithClient ¶
func NewRestyClient ¶
func NewRestyClient(url *url.URL, debug bool) *RestClient
Source Files ¶
Click to show internal directories.
Click to hide internal directories.