Documentation
¶
Overview ¶
Package fritzbox provides a client for interacting with AVM FRITZ!Box routers.
Index ¶
- Variables
- func Pow(n, m int) int
- func ValueFromJsonPath(body string, pathKeys []string) (v map[string]interface{}, err error)
- type Client
- func (c *Client) AhaRequest(method, path string, data Values) (*http.Response, error)
- func (c *Client) AhaRequestString(method, path string, data Values) (int, string, error)
- func (c *Client) AhaRequestXML(method, path string, data Values, target any) error
- func (c *Client) CheckExpiry() error
- func (c *Client) Close()
- func (c *Client) Connect() error
- func (c *Client) IsConnected() bool
- func (c *Client) IsExpired() bool
- func (c *Client) RestDelete(path string) ([]byte, int, error)
- func (c *Client) RestGet(path string) ([]byte, int, error)
- func (c *Client) RestPost(path string, body any) ([]byte, int, error)
- func (c *Client) RestPut(path string, body any) ([]byte, int, error)
- func (c *Client) RestRequest(method, path string, body any) ([]byte, int, error)
- func (c *Client) SID() string
- func (c *Client) SetHTTPClient(client *http.Client)
- func (c *Client) String() string
- type Values
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidCredentials = errors.New("invalid credentials")
Functions ¶
Types ¶
type Client ¶
type Client struct {
BaseUrl string
Username string
Password string
// contains filtered or unexported fields
}
Client handles authentication and communication with the FRITZ!Box.
func New ¶
New creates a new client with the given credentials. Call Connect() to authenticate with the FRITZ!Box.
func (*Client) AhaRequest ¶
AhaRequest sends a form-encoded request to the FRITZ!Box. GET: data as query parameters. POST: data as form body.
func (*Client) AhaRequestString ¶
AhaRequestString sends a request and returns the response body as a string.
func (*Client) AhaRequestXML ¶
AhaRequestXML sends a request and decodes the XML response into target.
func (*Client) CheckExpiry ¶
CheckExpiry reconnects if the session is expired or not connected.
func (*Client) Close ¶
func (c *Client) Close()
Close terminates the session and releases resources.
func (*Client) Connect ¶
Connect initializes and authenticates the client. If already connected, the existing session is closed first.
func (*Client) IsConnected ¶
IsConnected returns true if the client has an active session.
func (*Client) RestDelete ¶
RestDelete sends a DELETE request to the REST API.
func (*Client) RestRequest ¶
RestRequest sends a JSON request to the FRITZ!Box REST API. Body is JSON-marshaled for PUT/POST requests. Pass nil for GET/DELETE.
func (*Client) SetHTTPClient ¶
SetHTTPClient sets a custom HTTP client. Must be called before Connect().
Directories
¶
| Path | Synopsis |
|---|---|
|
Package aha is a Go-Wrapper for the AHA HTTP Interface (AVM Home Automation HTTP Interface)
|
Package aha is a Go-Wrapper for the AHA HTTP Interface (AVM Home Automation HTTP Interface) |
|
Package smarthome provides access to FRITZ!Box Smart Home features via the REST API.
|
Package smarthome provides access to FRITZ!Box Smart Home features via the REST API. |