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: 0

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