Documentation ¶
Index ¶
- func Do(request *http.Request, timeout time.Duration, checkCertificate bool) ([]byte, error)
- func DoWithStatusCode(request *http.Request, timeout time.Duration, checkCertificate bool) ([]byte, int, error)
- func ListenApiWithOs(server *http.Server)
- func ListenWebSocket[T any](conn *websocket.Conn, objects chan T) error
- func ListenWebSocketWithReconnect[T any](newWebSocket func() (*websocket.Conn, error), reconnectDelay time.Duration, ...) error
- func ListenWebSocketWithReconnectAlways[T any](newWebSocket func() (*websocket.Conn, error), reconnectDelay time.Duration, ...) error
- func NewDeleteRequestWithApiKey(url string, key string, value string) (*http.Request, error)
- func NewDeleteRequestWithApiKeyAndBody(url string, body any, key string, value string) (*http.Request, error)
- func NewDeleteRequestWithBearer(url string, token string) (*http.Request, error)
- func NewPatchRequestWithApiKey(url string, key string, value string) (*http.Request, error)
- func NewPostFormRequestWithBasicAuth(url string, form map[string][]string, username string, password string) (*http.Request, error)
- func NewPostFormRequestWithHeaders(url string, form map[string][]string, headers map[string]string) (*http.Request, error)
- func NewPostRequest(url string, body any) (*http.Request, error)
- func NewPostRequestWithApiKey(url string, body any, key string, value string) (*http.Request, error)
- func NewPostRequestWithBearer(url string, body any, token string) (*http.Request, error)
- func NewPostRequestWithHeaders(url string, body any, headers map[string]string) (*http.Request, error)
- func NewPutRequest(url string, body any) (*http.Request, error)
- func NewPutRequestWithApiKey(url string, body any, key string, value string) (*http.Request, error)
- func NewPutRequestWithBearer(url string, body any, token string) (*http.Request, error)
- func NewRequest(url string) (*http.Request, error)
- func NewRequestWithApiKey(url string, key string, value string) (*http.Request, error)
- func NewRequestWithBearer(url string, token string) (*http.Request, error)
- func NewRequestWithHeaders(url string, headers map[string]string) (*http.Request, error)
- func NewWebSocketConnectionWithApiKey(url string, key string, value string) (*websocket.Conn, error)
- func Read[T any](request *http.Request, timeout time.Duration, checkCertificate bool) (T, error)
- func ReadWebSocket[T any](conn *websocket.Conn) (*T, error)
- func ReadWithStatusCode[T any](request *http.Request, timeout time.Duration, checkCertificate bool) (T, int, error)
- type CORSEnabledHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoWithStatusCode ¶ added in v1.0.24
func DoWithStatusCode(request *http.Request, timeout time.Duration, checkCertificate bool) ([]byte, int, error)
DoWithStatusCode return the body and the code
func ListenApiWithOs ¶ added in v1.0.14
ListenApiWithOs starts an API server and listen for API requests
func ListenWebSocket ¶ added in v1.0.19
ListenWebSocket on a web socket connection and returns typed data
func ListenWebSocketWithReconnect ¶ added in v1.0.20
func ListenWebSocketWithReconnectAlways ¶ added in v1.0.45
func NewDeleteRequestWithApiKey ¶ added in v1.0.26
func NewDeleteRequestWithApiKeyAndBody ¶ added in v1.0.33
func NewDeleteRequestWithBearer ¶ added in v1.0.54
func NewPatchRequestWithApiKey ¶ added in v1.0.26
func NewPostFormRequestWithBasicAuth ¶ added in v1.0.39
func NewPostFormRequestWithHeaders ¶ added in v1.0.39
func NewPostRequest ¶
NewPostRequest creates a new request for the given url and the body as payload. The url have to provide free access without any authentication. For authentication use other functions like NewPostRequestWithBearer.
func NewPostRequestWithApiKey ¶ added in v1.0.15
func NewPostRequestWithApiKey(url string, body any, key string, value string) (*http.Request, error)
NewPostRequestWithApiKey creates a new request for the given url. The url is authenticated with a named api key.
func NewPostRequestWithBearer ¶
NewPostRequestWithBearer creates a new request for the given url. The url is authenticated with a barrier token.
func NewPostRequestWithHeaders ¶ added in v1.0.37
func NewPutRequest ¶
NewPutRequest creates a new request for the given url and the body as payload. The url have to provide free access without any authentication. For authentication use other functions like NewPutRequestWithBearer.
func NewPutRequestWithApiKey ¶ added in v1.0.15
NewPutRequestWithApiKey creates a new request for the given url. The url is authenticated with a named api key.
func NewPutRequestWithBearer ¶
NewPutRequestWithBearer creates a new request for the given url. The url is authenticated with a barrier token.
func NewRequest ¶
NewRequest creates a new request for the given url. The url have to provide free access without any authentication. For authentication use other functions like NewGetRequestWithBarrier.
func NewRequestWithApiKey ¶ added in v1.0.15
NewRequestWithApiKey creates a new request for the given url. The url is authenticated with a named api key.
func NewRequestWithBearer ¶
NewRequestWithBearer creates a new request for the given url. The url is authenticated with a barrier token.
func NewRequestWithHeaders ¶ added in v1.0.23
func NewWebSocketConnectionWithApiKey ¶ added in v1.0.19
func NewWebSocketConnectionWithApiKey(url string, key string, value string) (*websocket.Conn, error)
NewWebSocketConnectionWithApiKey creates a connection to a web socket. The url is authenticated with a named api key.
func ReadWebSocket ¶ added in v1.0.19
ReadWebSocket reads one message from a web socket connection and returns typed data
Types ¶
type CORSEnabledHandler ¶ added in v1.0.30
type CORSEnabledHandler struct {
// contains filtered or unexported fields
}
func NewCORSEnabledHandler ¶ added in v1.0.30
func NewCORSEnabledHandler(handler http.Handler) CORSEnabledHandler
func (CORSEnabledHandler) ServeHTTP ¶ added in v1.0.30
func (h CORSEnabledHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)