Documentation ¶
Index ¶
- Constants
- Variables
- type AnyDesk
- func (a *AnyDesk) AuthTest() (*GenericResult, error)
- func (a *AnyDesk) Client(id int) (*Client, error)
- func (a *AnyDesk) ClientAlias(id int, alias string) error
- func (a *AnyDesk) Clients(opts *ClientsOptions) (*Clients, error)
- func (a *AnyDesk) Session(id int) (*Session, error)
- func (a *AnyDesk) SessionClose(id int) error
- func (a *AnyDesk) SessionComment(id int, comment string) error
- func (a *AnyDesk) Sessions(opts *SessionsOptions) (*Sessions, error)
- func (a *AnyDesk) SysInfo() (*SysInfo, error)
- type Client
- type Clients
- type ClientsOptions
- type GenericResult
- type Options
- type Session
- type Sessions
- type SessionsOptions
- type SysInfo
Constants ¶
const ( DirectionAny = "" DirectionIn = "in" DirectionOut = "out" )
Direction constants
Variables ¶
var ( ErrMissingAPIKey = errors.New("missing API Key") ErrMissingLicenseID = errors.New("missing License ID") ErrBadResourceField = errors.New("bad resource field") )
Errors
var ( SortClientID = "cid" SortAlias = "alias" SortOnline = "online" SortClientIDFrom = "from.cid" SortClientIDTo = "to.cid" SortTimeStart = "start-time" SortTimeEnd = "end-time" SortDuration = "duration" )
Sort constants
Functions ¶
This section is empty.
Types ¶
type AnyDesk ¶
type AnyDesk struct {
// contains filtered or unexported fields
}
AnyDesk is an AnyDesk API client
func (*AnyDesk) AuthTest ¶
func (a *AnyDesk) AuthTest() (*GenericResult, error)
AuthTest tests to see if auth is working
func (*AnyDesk) ClientAlias ¶
ClientAlias sets the alias for a specific client
func (*AnyDesk) Clients ¶
func (a *AnyDesk) Clients(opts *ClientsOptions) (*Clients, error)
Clients gets a list of individual AnyDesk-powered clients attached to this license
func (*AnyDesk) SessionClose ¶
SessionClose closes the specified currently open session
func (*AnyDesk) SessionComment ¶
SessionComment sets the comment on a session, overwriting the existing comment if there was one
type Client ¶
type Client struct { ID int `json:"cid"` Alias string ClientVersion string `json:"client-version"` Online bool OnlineTime int `json:"online-time"` RecentSessions []Session `json:"last-sessions"` }
Client is an individual AnyDesk-powered client attached to this license
type Clients ¶
type Clients struct { Count int Selected int Offset int Limit int OnlineOnly bool `json:"online"` Clients []Client `json:"list"` }
Clients is a response for a Clients method call
type ClientsOptions ¶
type ClientsOptions struct { IncludeOffline bool // Default is false. Offset int // The index of the first item to be returned. Limit int // Defaults to unlimited. Sort string // `anydesk.SortClientID`, `anydesk.SortAlias`, or `anydesk.SortOnline` Order bool // `false` is descending (default), `true` is ascending }
ClientsOptions are options for client list query
type GenericResult ¶
type GenericResult struct { Success bool Error string Code string Method string Resource string RequestTime string `json:"request-time"` ContentHash string `json:"content-hash"` Result string LicenseID string }
GenericResult is a generic result struct
type Session ¶
type Session struct { ID string `json:"sid"` ClientIDFrom Client ClientIDTo Client Active bool TimeStart int `json:"start-time"` // time.Time? TimeEnd int `json:"end-time"` // time.Time? Duration int Comment string }
Session is detailed information about an individual session
type Sessions ¶
type Sessions struct { Count int Selected int Offset int Limit int ClientID int Direction string Sessions []Session `json:"list"` }
Sessions list all sessions regarding a license's clients
type SessionsOptions ¶
type SessionsOptions struct { ClientID int // If set it will limit returned sessions to that client. Direction string // `anydesk.DirectionAny` (default), `anydesk.DirectionIn`, or `anydesk.DirectionOut` TimeAfter time.Time // Only return sessions after this time. TimeBefore time.Time // Only return sessions before this time. Offset int // The index of the first item to be returned. Limit int // Defaults to unlimited. Sort string // `anydesk.SortClientIDFrom`, `anydesk.SortClientIDTo`, `anydesk.SortTimeStart`, `anydesk.SortTimeEnd`, or `anydesk.SortDuration` Order bool // `false` is descending (default), `true` is ascending }
SessionsOptions are options for session list query
type SysInfo ¶
type SysInfo struct { Name string APIVersion string `json:"api-ver"` License struct { Name string Expires int MaxClients int `json:"max-clients"` MaxSessions int `json:"max-sessions"` MaxSessionTime int `json:"max-session-time"` Namespaces []struct { Name string Size int } LicenseID string `json:"license-id"` LicenseKey string `json:"license-key"` APIPassword string `json:"api-password"` } Clients struct { Total int Online int } Sessions struct { Total int Online int } Standalone bool }
SysInfo is general license info and AnyDesk system information