Documentation
¶
Index ¶
- Variables
- func AddQueryParameters(baseURL string, queryParams map[string]string) string
- func AsigServer(e *echo.Echo, cs []Controller) error
- func BuildRequestObject(request Request) (*http.Request, error)
- func ExtKey(c echo.Context) string
- func JSONSend(data StDataEnv, e echo.Context) error
- func MakeRequest(req *http.Request) (*http.Response, error)
- type Browser
- type Client
- type ConfigServer
- type Controller
- type HTTPPet
- type HTTPTip
- type MapMsjPet
- type Request
- type Response
- type RestError
- type StDataEnv
- type StInfoPet
- type StInfoReq
- type StMsjPet
- type UserAgent
Constants ¶
This section is empty.
Variables ¶
var ( /*DefaultClient : cliente http con parametros default*/ DefaultClient = &Client{HTTPClient: &http.Client{}} )
Functions ¶
func AddQueryParameters ¶
AddQueryParameters : agrega los parametros para un param querie
func AsigServer ¶
func AsigServer(e *echo.Echo, cs []Controller) error
AsigServer : asigna peticiones a una instancia ECHO
func BuildRequestObject ¶
BuildRequestObject : Contruccion de objeto http
Types ¶
type Client ¶
Client : cliente http
func (*Client) MakeRequest ¶
MakeRequest : envia la peticion de un servicio con un cliente por defecto
type ConfigServer ¶
type ConfigServer struct {
/*Ipser : sirve para cuando este en modo produccion coloque la ip asignada al server*/
Ipser string `ini:"ipser"`
/*Debug : modo debug para el proyecto*/
Debug bool `ini:"debug"`
/*Local : habilita el modo local del servicio*/
Local bool `ini:"local"`
/*Puerto : Coloca el puerto del servicio*/
Puerto int `ini:"puerto"`
/*Protocol : protocolo del servicio*/
Protocol string `ini:"protocol"`
}
ConfigServer : configuraciones del servicio generales
func (*ConfigServer) LoadIni ¶
func (p *ConfigServer) LoadIni(path string) error
LoadIni : leer el archivo de configuracion del servicio esta debe ser server
func (*ConfigServer) Valid ¶
func (p *ConfigServer) Valid() error
Valid : valida la estructa y la configura para el servicio
type Controller ¶
type Controller struct {
Pets []HTTPPet
}
Controller : estructura para crear Controladores
type HTTPTip ¶
type HTTPTip string
HTTPTip : especifica el tipo de peticion a elaborar
const ( /*POST : peticion http POST*/ POST HTTPTip = "POST" /*GET : peticion http GET*/ GET HTTPTip = "GET" /*PUT : peticion http PUT*/ PUT HTTPTip = "PUT" /*DELETE : peticion http DELETE*/ DELETE HTTPTip = "DELETE" /*HTTP : protocolo http*/ HTTP = "http" /*HTTPS : protocolo https*/ HTTPS = "https" )
type Request ¶
type Request struct {
Method HTTPTip
BaseURL string
Headers map[string]string
QueryParams map[string]string
Body []byte
}
Request : estructara para tener los datos del servicio
type Response ¶
Response : estructura para cargar la respuesta del servidor
func BuildResponse ¶
BuildResponse : construccion de una respuesta
type RestError ¶
type RestError struct {
Response *Response
}
RestError : Obtiene una respuesta incorrecta al lado del servidor
type StDataEnv ¶
type StDataEnv struct {
Code int `json:"code"`
Error string `json:"msj"`
Data interface{} `json:"data"`
}
StDataEnv : Envio de datos generico
func (*StDataEnv) ResultCodeJSON ¶
ResultCodeJSON : envia un json de los resultado del api rest pero asignando el codigo
func (*StDataEnv) ResultFullJSON ¶
ResultFullJSON : envia un json de los resultado del api rest pero asignando el codigo la data y el mensaje
type StInfoReq ¶
type StInfoReq struct {
HostOrig string `json:"host"`
IPRemote string `json:"ip"`
Browser string `json:"browser"`
SystemOI string `json:"oi"`
UserAgent string `json:"useragent"`
}
StInfoReq : Obtiene datos generales del request