Documentation
¶
Index ¶
- Constants
- type AccessTokenAuth
- type AuthRoom
- type Config
- type Connector
- type Context
- type ContextBuilder
- type FormURLEncodedBody
- type HTTPMethod
- type HTTPProtocol
- type Header
- type IAuth
- type IAuthRoom
- type IBodyParser
- type IContextBuilder
- type IDTOFactory
- type IHeader
- type IMapQuery
- type IQuery
- type IRoom
- type ISend
- type IUrlQuery
- type JsonBody
- type JsonDTOFactory
- type LogFunc
- type OptionConnector
- type OptionRequest
- func ForceDTO() OptionRequest
- func WithBody(bodyParser IBodyParser) OptionRequest
- func WithContextBuilder(contextBuilder IContextBuilder) OptionRequest
- func WithDTO(dto any) OptionRequest
- func WithHeader(header IHeader) OptionRequest
- func WithMethod(method HTTPMethod) OptionRequest
- func WithQuery(query IQuery) OptionRequest
- type Query
- type Request
- type Response
- type Room
- type URI
- type XMLDTOFactory
Constants ¶
View Source
const ( TagTime = "time" TagHeader = "header:" TagStatus = "status" TagOk = "ok" TagQueryParams = "queryParams" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessTokenAuth ¶
type AccessTokenAuth struct{}
func (AccessTokenAuth) Apply ¶
func (a AccessTokenAuth) Apply(connector *Connector, response Response)
type AuthRoom ¶
func (*AuthRoom) SetAuthStrategy ¶
type Connector ¶
type Connector struct {
Header IHeader
// contains filtered or unexported fields
}
func NewConnector ¶
func NewConnector(baseUrl string, opts ...OptionConnector) *Connector
type ContextBuilder ¶
type ContextBuilder struct {
// contains filtered or unexported fields
}
func NewContextBuilder ¶
func NewContextBuilder(timeout time.Duration) ContextBuilder
func (ContextBuilder) Build ¶
func (b ContextBuilder) Build() Context
type FormURLEncodedBody ¶
type FormURLEncodedBody struct {
// contains filtered or unexported fields
}
func (FormURLEncodedBody) Parse ¶
func (f FormURLEncodedBody) Parse() *bytes.Buffer
type HTTPMethod ¶
type HTTPMethod string
const ( GET HTTPMethod = "GET" POST HTTPMethod = "POST" PUT HTTPMethod = "PUT" PATCH HTTPMethod = "PATCH" DELETE HTTPMethod = "DELETE" HEAD HTTPMethod = "HEAD" )
func (HTTPMethod) String ¶
func (s HTTPMethod) String() string
type HTTPProtocol ¶
type HTTPProtocol int
const ( Http HTTPProtocol = iota + 1 Https )
func (HTTPProtocol) String ¶
func (h HTTPProtocol) String() string
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
func (*Header) Properties ¶
type IBodyParser ¶
func NewFormURLEncodedBodyParser ¶
func NewFormURLEncodedBodyParser(v any) IBodyParser
func NewJsonBodyParser ¶
func NewJsonBodyParser(v any) IBodyParser
type IContextBuilder ¶
type IContextBuilder interface {
Build() Context
}
type IDTOFactory ¶
type IDTOFactory interface {
// contains filtered or unexported methods
}
IDTOFactory declares the interface for creating DTOs.
func NewDTOFactory ¶
func NewDTOFactory(contentType ...string) IDTOFactory
NewDTOFactory creates a concrete factory based on content type.
type IHeader ¶
type OptionConnector ¶
type OptionConnector func(info *Connector)
func WithHeaderConnector ¶
func WithHeaderConnector(header IHeader) OptionConnector
func WithHeaderContextBuilder ¶
func WithHeaderContextBuilder(ctxBuilder IContextBuilder) OptionConnector
type OptionRequest ¶
type OptionRequest func(request *Request)
func ForceDTO ¶
func ForceDTO() OptionRequest
func WithBody ¶
func WithBody(bodyParser IBodyParser) OptionRequest
func WithContextBuilder ¶
func WithContextBuilder(contextBuilder IContextBuilder) OptionRequest
func WithDTO ¶
func WithDTO(dto any) OptionRequest
func WithHeader ¶
func WithHeader(header IHeader) OptionRequest
func WithMethod ¶
func WithMethod(method HTTPMethod) OptionRequest
func WithQuery ¶
func WithQuery(query IQuery) OptionRequest
type Request ¶
type Request struct {
Header IHeader
Query IQuery
BodyParser IBodyParser
DTO any
// ForceDTO is a flag to force the parse http response to DTO which is map[string]any
ForceDTO bool
// contains filtered or unexported fields
}
func NewRequest ¶
func NewRequest(path string, opts ...OptionRequest) *Request
NewRequest creates a new request baseUrl: the base url ex: http://localhost:8080, http://localhost/path, path/, path?lorem=ipsum opts: options to configure the request
type Response ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
auth_room
command
|
|
|
solo_request
command
|
|
|
solo_request_connector
command
|
|
|
yml_concurrent_example
command
|
|
|
yml_example
command
|
|
Click to show internal directories.
Click to hide internal directories.