client

package
v0.0.0-...-b81cf11 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BackupTimeout = 3 * time.Hour
View Source
const ContainerDownloadTimeout = 1 * time.Hour
View Source
const ContainerOperationTimeout = 10 * time.Minute
View Source
const DefaultTimeout = 30 * time.Second
View Source
const OsDownloadTimeout = 1 * time.Hour

Variables

View Source
var RawJSON = false

RawJSON controls if the client does json handling or outputs it raw

Functions

func GenericJSONGet

func GenericJSONGet(section, command string) (*resty.Response, error)

GenericJSONGet is a helper for generic empty post request

func GenericJSONGetTimeout

func GenericJSONGetTimeout(section, command string, timeout time.Duration) (*resty.Response, error)

func GenericJSONPost

func GenericJSONPost(section, command string, body map[string]interface{}) (*resty.Response, error)

GenericJSONPost is a helper for generic empty post request

func GenericJSONPostTimeout

func GenericJSONPostTimeout(section, command string, body map[string]interface{}, timeout time.Duration) (*resty.Response, error)

func GetJSONRequest

func GetJSONRequest() *resty.Request

func GetJSONRequestTimeout

func GetJSONRequestTimeout(timeout time.Duration) *resty.Request

GetJSONRequest returns a request prepared for default JSON resposes

func GetRequest

func GetRequest() *resty.Request

func GetRequestTimeout

func GetRequestTimeout(timeout time.Duration) *resty.Request

GetRequest returns a resty.Request object prepared for an API call

func ShowJSONResponse

func ShowJSONResponse(resp *resty.Response) (success bool)

ShowJSONResponse formats a JSON response for human readers

func URLHelper

func URLHelper(section, command string) (string, error)

URLHelper returns a URL built from the arguments

Types

type Response

type Response struct {
	Result  string                 `json:"result"`
	Message string                 `json:"message,omitempty"`
	Data    map[string]interface{} `json:"data,omitempty"`
}

Response is the default JSON response from the Home Assistant Supervisor

Jump to

Keyboard shortcuts

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