Documentation
¶
Index ¶
- Constants
- func GeContentTypeStr(value ContentType) string
- func GetMethodStr(value TMethod) string
- func NewAuth2() *auth2
- func NewProxy() *proxy
- type AuthorizationType
- type ClientAuth
- type Content
- type ContentBinary
- type ContentFile
- type ContentFormField
- type ContentText
- type ContentTransferEncoding
- type ContentType
- type EncType
- type Fields
- type Header
- type IWebsocket
- type ListContentBinary
- type ListContentFile
- type ListContentFormField
- type ListContentText
- type Params
- type Request
- func (H *Request) AddContentBin(name string, filename string, value []byte)
- func (H *Request) AddContentText(Name string, value *ST.Strings)
- func (H *Request) AddFormField(fieldName string, fieldValue string)
- func (H *Request) AddFormFieldContext(fieldName string, fieldValue string, contentType string)
- func (H *Request) AddSubmitFile(key string, filename string, contentType string, content []byte)
- func (H *Request) AddSubmitFile2(key string, filename string, contentType string, content []byte, ...)
- func (H *Request) CopyBody(value []byte)
- type Response
- type Status
- type TCert
- type THttp
- func (H *THttp) Conectar() error
- func (H *THttp) ConvertBodyInStruct(value any) error
- func (H *THttp) Desconectar() error
- func (H *THttp) EnviarBinario(messageType int, data []byte) error
- func (H *THttp) EnviarBinarioTypeBinaryMessage(data []byte) error
- func (H *THttp) EnviarTextTypeTextMessage(data []byte) error
- func (H *THttp) EnviarTexto(messageType int, data string) error
- func (H *THttp) Free()
- func (H *THttp) GetAuthorizationType() AuthorizationType
- func (H *THttp) GetFullURL() (string, error)
- func (H *THttp) GetMetodo() TMethod
- func (H *THttp) GetMetodoStr() string
- func (H *THttp) GetUrl() string
- func (H *THttp) GetUrlFinal() string
- func (H *THttp) IsConect() bool
- func (H *THttp) Send() (RES *Response, err error)
- func (H *THttp) SetAuthorizationType(value AuthorizationType) error
- func (H *THttp) SetMetodo(value TMethod) error
- func (H *THttp) SetMetodoStr(value string) error
- func (H *THttp) SetUrl(value string) error
- type TMethod
- type TTransport
- type TokenResponse
- type Varibles
- func (v *Varibles) Add(key string, value string)
- func (v *Varibles) Clear()
- func (v *Varibles) Count() int
- func (v *Varibles) Del(key string)
- func (v *Varibles) Exist(key string) bool
- func (v *Varibles) Get(key string) string
- func (v *Varibles) Keys() []string
- func (v *Varibles) Set(key string, value string)
- func (v *Varibles) ToMap() map[string]string
- func (v *Varibles) Values() []string
- type WebSocket
- type Writer
- func (w *Writer) Boundary() string
- func (w *Writer) Close() error
- func (w *Writer) CreateFormField(fieldname string) (io.Writer, error)
- func (w *Writer) CreateFormFile(fieldname string, filename string) (io.Writer, error)
- func (w *Writer) CreateFormFile2(fieldname string, filename string, contenttype string) (io.Writer, error)
- func (w *Writer) CreateFormFile3(fieldname string, contenttype string) (io.Writer, error)
- func (w *Writer) CreateFormFile4(fieldname string, filename string, contenttype string, ...) (io.Writer, error)
- func (w *Writer) CreatePart(header textproto.MIMEHeader) (io.Writer, error)
- func (w *Writer) FormDataContentType() string
- func (w *Writer) SetBoundary(boundary string) error
- func (w *Writer) WriteField(fieldname, value string) error
Constants ¶
const ( MSG_DISCONECT = "Perca de Conexão..." MSG_RECONECTANDO = "Reconectando..." MSG_RECONECTADO = "Reconectado..." MSG_CONECTADO = "Conectado..." )
const ( // ContentTransferEncoding7Bit is the 7bit encoding ContentTransferEncodingNull = 0 // ContentTransferEncoding7Bit is the 7bit encoding ContentTransferEncoding7Bit = 1 // ContentTransferEncoding8Bit is the 8bit encoding ContentTransferEncoding8Bit = 2 // ContentTransferEncodingBinary is the binary encoding ContentTransferEncodingBinary = 3 // ContentTransferEncodingBase64 is the base64 encoding ContentTransferEncodingBase64 = 4 // ContentTransferEncodingQuotedPrintable is the quoted-printable encoding ContentTransferEncodingQuotedPrintable = 5 )
Variables ¶
This section is empty.
Functions ¶
func GeContentTypeStr ¶
func GeContentTypeStr(value ContentType) string
func GetMethodStr ¶
Types ¶
type AuthorizationType ¶
type AuthorizationType int
const ( AT_AutoDetect AuthorizationType = iota AT_Basic AT_Bearer AT_Auth2 AT_Nenhum )
type ClientAuth ¶
type ClientAuth int
const ( CA_SendBasicAuthHeader ClientAuth = iota CA_SendClientCredentialsInBody )
type ContentBinary ¶
type ContentFile ¶
type ContentFile struct {
Key string
FileName string
ContentType string
ContentTransferEncoding ContentTransferEncoding
Content []byte
}
type ContentFormField ¶
type ContentText ¶
type ContentTransferEncoding ¶ added in v1.0.91
type ContentTransferEncoding int
type ContentType ¶
type ContentType int
const ( CT_NONE ContentType = 0 CT_TEXT ContentType = 1 CT_JAVASCRIPT ContentType = 2 CT_JSON ContentType = 3 CT_HTML ContentType = 4 CT_XML ContentType = 5 CT_MULTIPART_FORM_DATA ContentType = 6 CT_X_WWW_FORM_URLENCODED ContentType = 7 CT_BINARY ContentType = 8 CT_SOAPXML ContentType = 9 CT_PDF ContentType = 10 CT_ZIP ContentType = 11 CT_PNG ContentType = 12 CT_JPEG ContentType = 13 CT_GIF ContentType = 14 CT_SVGXML ContentType = 15 CT_MPEG ContentType = 16 CT_OGG ContentType = 17 CT_MP4 ContentType = 18 CT_WEBM ContentType = 19 CT_CSS ContentType = 20 CT_CSV ContentType = 21 CT_TSV ContentType = 22 CT_YAML ContentType = 23 CT_TAR ContentType = 24 CT_RTF ContentType = 25 CT_WAV ContentType = 26 CT_FLAC ContentType = 27 CT_AVI ContentType = 28 CT_MOV ContentType = 29 CT_BMP ContentType = 30 CT_WEBP ContentType = 31 CT_TIFF ContentType = 32 CT_EOT ContentType = 33 CT_TTF ContentType = 34 CT_WOFF ContentType = 35 CT_WOFF2 ContentType = 36 )
func GetContentTypeFromString ¶
func GetContentTypeFromString(str string) ContentType
type Header ¶
type Header struct {
Accept string
AcceptCharset string
AcceptEncoding string
AcceptLanguage string
Authorization string
Charset string
ContentType string
ContentLength string
ContentEncoding string
ContentVersion string
ContentLocation string
ExtraFields Fields
}
func (*Header) GetAllFields ¶
type IWebsocket ¶
type ListContentBinary ¶
type ListContentBinary []*ContentBinary
func NewListContentBinary ¶
func NewListContentBinary() ListContentBinary
func (*ListContentBinary) Add ¶
func (L *ListContentBinary) Add(name string, fileName string, value []byte)
func (*ListContentBinary) Clear ¶
func (L *ListContentBinary) Clear()
type ListContentFile ¶
type ListContentFile []*ContentFile
func NewListContentFile ¶
func NewListContentFile() ListContentFile
func (*ListContentFile) Add ¶
func (L *ListContentFile) Add(key string, fileName string, contentType string, content []byte, transferEncoding ContentTransferEncoding)
func (*ListContentFile) Clear ¶
func (L *ListContentFile) Clear()
type ListContentFormField ¶
type ListContentFormField []*ContentFormField
func NewListContentFormField ¶
func NewListContentFormField() ListContentFormField
func (*ListContentFormField) Add ¶
func (L *ListContentFormField) Add(fieldName string, fieldValue string)
func (*ListContentFormField) AddContentType ¶ added in v1.0.86
func (L *ListContentFormField) AddContentType(fieldName string, fieldValue string, contentType string)
func (*ListContentFormField) Clear ¶
func (L *ListContentFormField) Clear()
type ListContentText ¶
type ListContentText []*ContentText
func NewListContentText ¶
func NewListContentText() ListContentText
func (*ListContentText) Clear ¶
func (L *ListContentText) Clear()
type Request ¶
type Request struct {
Header *Header
ItensFormField ListContentFormField
ItensSubmitFile ListContentFile
ItensContentText ListContentText
ItensContentBin ListContentBinary
Body []byte
}
func NewRequest ¶
func NewRequest() *Request
func (*Request) AddContentBin ¶
func (*Request) AddFormField ¶
func (*Request) AddFormFieldContext ¶ added in v1.0.89
func (*Request) AddSubmitFile ¶
func (*Request) AddSubmitFile2 ¶ added in v1.0.92
type Response ¶
func NewResponse ¶
func NewResponse() *Response
func (*Response) GetAllFields ¶
func (*Response) GetStatusCodeStr ¶
func (*Response) GetStatusMessage ¶
type THttp ¶
type THttp struct {
/*publico*/
Auth2 *auth2
Request *Request
Response *Response
Metodo TMethod
AuthorizationType AuthorizationType
WebSocket *WebSocket
Authorization string
Password string
UserName string
Certificate TCert
TransportType TTransport
Protocolo string // http, https
Host string // www.example.com
Path string // /product
Varibles Varibles
Params Params
Proxy *proxy
EncType EncType
Timeout int //segundos
OnSend IWebsocket
// contains filtered or unexported fields
}
func (*THttp) ConvertBodyInStruct ¶ added in v1.0.90
func (*THttp) Desconectar ¶
func (*THttp) EnviarBinarioTypeBinaryMessage ¶
func (*THttp) EnviarTextTypeTextMessage ¶
func (*THttp) GetAuthorizationType ¶
func (H *THttp) GetAuthorizationType() AuthorizationType
func (*THttp) GetFullURL ¶
func (*THttp) GetMetodoStr ¶
func (*THttp) GetUrlFinal ¶ added in v1.0.110
func (*THttp) SetAuthorizationType ¶
func (H *THttp) SetAuthorizationType(value AuthorizationType) error
func (*THttp) SetMetodoStr ¶
type TTransport ¶ added in v1.0.131
type TTransport = int
const ( TNenhum TTransport = 0 TSSL TTransport = 1 TTLS TTransport = 2 TSSLTLS TTransport = 3 )
type TokenResponse ¶
type Varibles ¶
func NewVaribles ¶
func NewVaribles() Varibles
type WebSocket ¶ added in v1.0.61
type WebSocket struct {
AutoReconnect bool
NumberOfAttempts int
// contains filtered or unexported fields
}
func NewWebSocket ¶ added in v1.0.61
func NewWebSocket() *WebSocket
type Writer ¶ added in v1.0.80
type Writer struct {
// contains filtered or unexported fields
}
A Writer generates multipart messages.
func NewWriter ¶ added in v1.0.80
NewWriter returns a new multipart Writer with a random boundary, writing to w.
func (*Writer) Close ¶ added in v1.0.80
Close finishes the multipart message and writes the trailing boundary end line to the output.
func (*Writer) CreateFormField ¶ added in v1.0.80
CreateFormField calls CreatePart with a header using the given field name.
func (*Writer) CreateFormFile ¶ added in v1.0.80
CreateFormFile is a convenience wrapper around CreatePart. It creates a new form-data header with the provided field name and file name.
func (*Writer) CreateFormFile2 ¶ added in v1.0.80
func (*Writer) CreateFormFile3 ¶ added in v1.0.86
func (*Writer) CreateFormFile4 ¶ added in v1.0.91
func (*Writer) CreatePart ¶ added in v1.0.80
CreatePart creates a new multipart section with the provided header. The body of the part should be written to the returned Writer. After calling CreatePart, any previous part may no longer be written to.
func (*Writer) FormDataContentType ¶ added in v1.0.80
FormDataContentType returns the Content-Type for an HTTP multipart/form-data with this Writer's Boundary.
func (*Writer) SetBoundary ¶ added in v1.0.80
SetBoundary overrides the Writer's default randomly-generated boundary separator with an explicit value.
SetBoundary must be called before any parts are created, may only contain certain ASCII characters, and must be non-empty and at most 70 bytes long.
func (*Writer) WriteField ¶ added in v1.0.80
WriteField calls CreateFormField and then writes the given value.