Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Api ¶
type Api struct { LicenseId string `json:"license_id"` ApiPassword string `json:"api_password"` ApiEndpoint string `json:"api_endpoint"` HttpClient *http.Client }
Api contains all information about the AnyDesk API endpoint and configurable options.
func NewApi ¶
NewApi returns an initialized AnyDesk API configuration used with a Professional license. If you want to quiry your Enterprise licensed API, feel free to configure the endpoint:
api := NewApi(...) api.ApiEndpoint = "https://yourinstance:8081"
func (*Api) Do ¶
func (api *Api) Do(request ApiRequest) (body []byte, err error)
Do will execute a given AnyDesk API request and return the plain json as string.
func (*Api) GetRequestToken ¶
func (api *Api) GetRequestToken(request *BaseRequest) string
GetRequestToken generates the request token used for the API request.
type ApiRequest ¶
ApiRequest is the basic interface used for all compatible API requests.
type AuthenticationRequest ¶
type AuthenticationRequest struct {
*BaseRequest
}
AuthenticationRequest is used to query the "/auth" API endpoint for information.
func NewAuthenticationRequest ¶
func NewAuthenticationRequest() *AuthenticationRequest
NewAuthenticationRequest will a clean API request against "/auth".
func (*AuthenticationRequest) Do ¶
func (req *AuthenticationRequest) Do(api *Api) (r *AuthenticationResponse, err error)
Do will execute the "/auth" query against the given API.
type AuthenticationResponse ¶
type AuthenticationResponse struct { Result string `json:"result"` Error string `json:"error"` Code string `json:"code"` Method string `json:"method"` Resource string `json:"method"` RequestTimestamp string `json:"request-time"` ContentHash string `json:"content-hash"` LicenseId string `json:"license-id"` }
AuthenticationResponse contains all available fields returned by the `/auth` API call.
type BaseRequest ¶
BaseRequest contains the base information required to work against the API.
func (*BaseRequest) GetContentHash ¶
func (r *BaseRequest) GetContentHash() string
GetContentHash generates the content hash required for the API request string generated by GetRequestString().
func (*BaseRequest) GetHttpRequest ¶
func (r *BaseRequest) GetHttpRequest(api *Api) (req *http.Request, err error)
GetHttpRequest will return the prepared HTTP request that can be used by a http.Client
func (*BaseRequest) GetRequestString ¶
func (r *BaseRequest) GetRequestString() string
GetRequestString generates the request string required for the API token generated by GetRequestToken().
type SysinfoRequest ¶
type SysinfoRequest struct {
*BaseRequest
}
SysinfoRequest is used to query the "/sysinfo" API endpoint for information.
func NewSysinfoRequest ¶
func NewSysinfoRequest() *SysinfoRequest
NewSysinfoRequest will a clean API request against "/sysinfo".
func (*SysinfoRequest) Do ¶
func (req *SysinfoRequest) Do(api *Api) (resp *SysinfoResponse, err error)
Do will execute the "/sysinfo" query against the given API.
type SysinfoResponse ¶
type SysinfoResponse struct { Name string `json:"name"` ApiVersion string `json:"api-ver"` License struct { Name string `json:"name"` ExpiresTimestamp int64 `json:"expires"` HasExpired bool `json:"has-expired"` // undocumented or deprecated MaxClients int `json:"max-clients"` MaxSessions int `json:"max-sessions"` MaxSessionTime int `json:"max-session-time"` Namespaces []struct { Name string `json:"name"` Size int `json:"size"` } `json:"namespaces"` Id string `json:"license-id"` Key string `json:"license-key"` ApiPassword string `json:"api-password"` PowerUser bool `json:"power-user"` // undocumented or deprecated } `json:"license"` Clients struct { Total int `json:"total"` Online int `json:"online"` } `json:"clients"` Sessions struct { Total int `json:"total"` Active int `json:"active"` } `json:"sessions"` Standalone bool `json:"standalone"` }
SysinfoResponse contains all available fields returned by the `/sysinfo` API call.