Documentation ¶
Index ¶
- Variables
- func AddQueryParameters(baseURL string, queryParams map[string]string) string
- func AsigServer(e *echo.Echo, cs []Controller) error
- func BasicAuth(username, password string) string
- 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)
- func NewNetClient(timeout int) *http.Client
- func TokenHeaders(token string) map[string]string
- type Browser
- type Client
- func (c *Client) MakeRequest(req *http.Request) (*http.Response, error)
- func (c *Client) Send(request Request) (*Response, error)
- func (c *Client) SendByte(req Request) ([]byte, int, error)
- func (c *Client) SendByteV2(req Request) ([]byte, map[string][]string, int, error)
- func (c *Client) SendNative(req Request) (*Response, int, error)
- 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
func MakeRequest ¶
MakeRequest : obtiene la respuesta de una peticion
func NewNetClient ¶ added in v1.7.8
NewNetClient : crea una instancia de http client
func TokenHeaders ¶ added in v1.8.5
TokenHeaders : autentificacion por medio de token bearer
Types ¶
type Client ¶
Client : cliente http
func (*Client) MakeRequest ¶
MakeRequest : envia la peticion de un servicio con un cliente por defecto
func (*Client) SendByteV2 ¶ added in v1.9.6
SendRequest : envia una peticion de una api rest con headers response return: body headers code error
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"` /*CertFile : certificado ssl*/ CertFile string `ini:"certfile"` /*KeyFile : llave del certificado ssl*/ KeyFile string `ini:"keyfile"` /*DirSSL : carpeta donde esta el certificado*/ DirSSL string `ini:"dirssl"` /*Env : carga todas las variables en variables de entorno*/ Env bool `ini:"env"` }
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) PathCert ¶ added in v1.7.8
func (p *ConfigServer) PathCert() string
PathCert : recupera el path del certificado
func (*ConfigServer) PathKey ¶ added in v1.7.8
func (p *ConfigServer) PathKey() string
PathKey : recupera el path de la llave
func (*ConfigServer) StarServer ¶ added in v1.7.8
func (p *ConfigServer) StarServer(e *echo.Echo)
StarServer : inicia el servicio echo .
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 MapMsjPet ¶
MapMsjPet : maneja el envio de mensajes con peticiones echo
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