Documentation
¶
Index ¶
- Constants
- func GetWebAppRelease() string
- func NewAPIClient(platform string) *req.Client
- func NewAuthClient(platform string) *req.Client
- func NewFirefoxAPIClient() *req.Client
- func NewFirefoxAuthClient() *req.Client
- func NewFirefoxClient() *req.Client
- func NewFirefoxTokenClient() *req.Client
- func NewIOSSafariAPIClient() *req.Client
- func NewIOSSafariAuthClient() *req.Client
- func NewIOSSafariClient() *req.Client
- func NewIOSSafariTokenClient() *req.Client
- func NewTokenClient(platform string) *req.Client
- type APIError
- type Auth
- func (a *Auth) Authorize(ctx context.Context, ...) (*tokens.TokenResult, error)
- func (a *Auth) DeviceAuthorize(ctx context.Context, clientID, scope string) (*DeviceAuthResponse, error)
- func (a *Auth) ExchangeDeviceCode(ctx context.Context, clientID, deviceCode string) (*tokens.TokenResult, error)
- func (a *Auth) RefreshToken(ctx context.Context, clientID, refreshToken, platform string) (*tokens.TokenResult, error)
- type Client
- func (c *Client) CreateCode(e *core.RecordRequestEvent) error
- func (c *Client) DeleteUnusedCodes() error
- func (c *Client) GetMe(ctx context.Context, accessToken, platform string) (*MeResponse, error)
- func (c *Client) LoadAccountData(ctx context.Context, account *core.Record) error
- func (c *Client) Register()
- func (c *Client) WaitForDeviceAuthorization(ctx context.Context, clientRecord *core.Record, codeRecord *core.Record) error
- type DeviceAuthResponse
- type MeResponse
Constants ¶
const ( TokenURL = "https://login.tado.com/oauth2/token" AuthorizeURL = "https://login.tado.com/oauth2/authorize" DeviceAuthURL = "https://login.tado.com/oauth2/device_authorize" TenantID = "1d543ad5-a8ac-4704-b9e2-26838b4d6513" )
const ( // User agent matching real iOS Safari traffic IOSUserAgent = "" /* 135-byte string literal not displayed */ // User agent for API requests IOSAPIUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148" )
const (
BaseURL = "https://my.tado.com"
)
const (
// Firefox User Agent from real traffic
FirefoxUserAgent = "Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0"
)
Variables ¶
This section is empty.
Functions ¶
func GetWebAppRelease ¶ added in v1.0.4
func GetWebAppRelease() string
func NewAPIClient ¶
NewAPIClient creates an API client for the given client type
func NewAuthClient ¶
func NewFirefoxAPIClient ¶
NewFirefoxAPIClient creates an HTTP client configured for API requests (Firefox)
func NewFirefoxAuthClient ¶
NewFirefoxAuthClient creates an HTTP client configured for auth requests (Firefox)
func NewFirefoxClient ¶
NewFirefoxClient creates an HTTP client that impersonates Firefox with proper TLS fingerprinting and header ordering matching real traffic
func NewFirefoxTokenClient ¶
NewFirefoxTokenClient creates an HTTP client configured for token exchange requests (Firefox)
func NewIOSSafariAPIClient ¶
NewIOSSafariAPIClient creates an HTTP client configured for API requests
func NewIOSSafariAuthClient ¶
NewIOSSafariAuthClient creates an HTTP client configured for auth requests
func NewIOSSafariClient ¶
NewIOSSafariClient creates an HTTP client that impersonates iOS Safari with proper TLS fingerprinting and header ordering matching real traffic
func NewIOSSafariTokenClient ¶
NewIOSSafariTokenClient creates an HTTP client configured for token exchange requests
func NewTokenClient ¶
NewTokenClient creates a token client for the given client type
Types ¶
type Auth ¶ added in v1.2.0
type Auth struct{}
Auth handles OAuth authentication with tado's API. It implements tokens.TokenAuthProvider. It is stateless and can be safely shared across goroutines.
func (*Auth) Authorize ¶ added in v1.2.0
func (a *Auth) Authorize( ctx context.Context, clientID, redirectURI, scope, email, password, platform string, ) (*tokens.TokenResult, error)
Authorize performs the OAuth password grant flow. Implements tokens.TokenAuthProvider.
func (*Auth) DeviceAuthorize ¶ added in v1.2.0
func (a *Auth) DeviceAuthorize(ctx context.Context, clientID, scope string) (*DeviceAuthResponse, error)
DeviceAuthorize initiates device code authorization flow.
func (*Auth) ExchangeDeviceCode ¶ added in v1.2.0
func (a *Auth) ExchangeDeviceCode(ctx context.Context, clientID, deviceCode string) (*tokens.TokenResult, error)
ExchangeDeviceCode exchanges a device code for tokens.
func (*Auth) RefreshToken ¶ added in v1.2.0
func (a *Auth) RefreshToken(ctx context.Context, clientID, refreshToken, platform string) (*tokens.TokenResult, error)
RefreshToken refreshes an OAuth token. Implements tokens.TokenAuthProvider.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles tado-specific business logic like account creation and device codes.
func (*Client) CreateCode ¶
func (c *Client) CreateCode(e *core.RecordRequestEvent) error
func (*Client) DeleteUnusedCodes ¶ added in v1.0.4
func (*Client) LoadAccountData ¶
LoadAccountData creates tokens for all password grant clients and fetches account homes.
type DeviceAuthResponse ¶
type DeviceAuthResponse struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
VerificationURIComplete string `json:"verification_uri_complete"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
DeviceAuthResponse is the device authorization response.