httpclient

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2021 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPError added in v1.2.0

type HTTPError struct {
	StatusCode int
}

HTTPError is the error in a http call

func NewHTTPError added in v1.2.0

func NewHTTPError(statusCode int) *HTTPError

NewHTTPError is the HTTPError ctor

func (*HTTPError) Error added in v1.2.0

func (e *HTTPError) Error() string

Error returns an http error string

type HttpClient

type HttpClient struct {
	HttpServerUrl string

	ConfigPath string
	Config     *viper.Viper
	Logger     log.FieldLogger
	// contains filtered or unexported fields
}

func GetHttpClient

func GetHttpClient(configPath string, l log.FieldLogger) *HttpClient

GetHqttClient creates the hqttclient and returns it

func (*HttpClient) SendMessage

func (mc *HttpClient) SendMessage(ctx context.Context, topic string, payload string, retainBool bool) error

SendMessage sends a message to mqqt using a HTTP POST request

type MqttPost

type MqttPost struct {
	Topic     string `json:"topic"`
	Payload   string `json:"payload"`
	Qos       int    `json:"qos"`
	Retain    bool   `json:"retain"`
	Client_id string `json:"client_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL