Documentation
¶
Overview ¶
Package rest implements stateless Roborock cloud authentication and inventory.
Index ¶
- func DecodeOTA(encoded string) (*dependencymodels.InventoryOTA, error)
- func DecodeProductInfo(encoded string) (*dependencymodels.InventoryProductInfo, error)
- func DecodeProgramState(encoded string) (*dependencymodels.InventoryProgramState, error)
- func DecodeProperty(encoded string) (*dependencymodels.ProductPropertyConstraints, error)
- type AgreementRequest
- type AgreementResult
- type AuthContext
- type Client
- func (c *Client) GetAgreement(ctx context.Context, request AgreementRequest) (AgreementResult, error)
- func (c *Client) HomeData(ctx context.Context, request HomeDataRequest) (HomeDataResult, error)
- func (c *Client) HomeDetail(ctx context.Context, request HomeDetailRequest) (HomeDetailResult, error)
- func (c *Client) HomeRooms(ctx context.Context, request HomeRoomsRequest) (RoomsResult, error)
- func (c *Client) LoginCode(ctx context.Context, request LoginCodeRequest) (LoginResult, error)
- func (c *Client) LoginLegacyCode(ctx context.Context, request LoginLegacyCodeRequest) (LoginResult, error)
- func (c *Client) LoginPassword(ctx context.Context, request LoginPasswordRequest) (LoginResult, error)
- func (c *Client) RequestCode(ctx context.Context, request CodeRequest) (CodeResult, error)
- func (c *Client) ResolveRegion(ctx context.Context, request RegionRequest) (RegionResult, error)
- func (c *Client) SharedDeviceRooms(ctx context.Context, request SharedDeviceRoomsRequest) (RoomsResult, error)
- func (c *Client) SignKey(ctx context.Context, request SignRequest) (SignResult, error)
- type CodeRequest
- type CodeResult
- type HTTPDoer
- type HomeDataRequest
- type HomeDataResult
- type HomeDetailRequest
- type HomeDetailResult
- type HomeRoomsRequest
- type LoginCodeRequest
- type LoginContext
- type LoginLegacyCodeRequest
- type LoginPasswordRequest
- type LoginResult
- type Option
- type RegionRequest
- type RegionResult
- type RoomsResult
- type SharedDeviceRoomsRequest
- type SignRequest
- type SignResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeOTA ¶
func DecodeOTA(encoded string) (*dependencymodels.InventoryOTA, error)
DecodeOTA decodes the JSON string in inventory datapoint 10007.
func DecodeProductInfo ¶
func DecodeProductInfo(encoded string) (*dependencymodels.InventoryProductInfo, error)
DecodeProductInfo decodes the JSON string in inventory datapoint 10005.
func DecodeProgramState ¶
func DecodeProgramState(encoded string) (*dependencymodels.InventoryProgramState, error)
DecodeProgramState decodes the JSON string in inventory datapoint 10001.
func DecodeProperty ¶
func DecodeProperty(encoded string) (*dependencymodels.ProductPropertyConstraints, error)
DecodeProperty decodes JSON-encoded product constraints; JSON null returns nil.
Types ¶
type AgreementRequest ¶
type AgreementRequest struct{ Login LoginContext }
AgreementRequest retrieves current agreement versions for a country.
type AgreementResult ¶
type AgreementResult struct{ Agreement dependencymodels.Agreement }
AgreementResult supplies the agreement version used at login.
type AuthContext ¶
type AuthContext struct {
Token string
ClientID string
BaseURL string
RRiot dependencymodels.RRiot
}
AuthContext holds caller-owned credentials for one account.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client retains configuration only; credentials belong to each request.
func (*Client) GetAgreement ¶
func (c *Client) GetAgreement(ctx context.Context, request AgreementRequest) (AgreementResult, error)
GetAgreement retrieves the latest agreement; it does not conceal failures.
func (*Client) HomeData ¶
func (c *Client) HomeData(ctx context.Context, request HomeDataRequest) (HomeDataResult, error)
HomeData retrieves a specified home's inventory using per-call Hawk credentials.
func (*Client) HomeDetail ¶
func (c *Client) HomeDetail(ctx context.Context, request HomeDetailRequest) (HomeDetailResult, error)
HomeDetail uses plain token authentication against the regional IoT origin.
func (*Client) HomeRooms ¶ added in v0.2.0
func (c *Client) HomeRooms(ctx context.Context, request HomeRoomsRequest) (RoomsResult, error)
HomeRooms reads the rooms currently associated with a home.
func (*Client) LoginCode ¶
func (c *Client) LoginCode(ctx context.Context, request LoginCodeRequest) (LoginResult, error)
LoginCode submits explicit country, signature, and agreement settings.
func (*Client) LoginLegacyCode ¶
func (c *Client) LoginLegacyCode(ctx context.Context, request LoginLegacyCodeRequest) (LoginResult, error)
LoginLegacyCode submits an explicitly selected v1 email code login.
func (*Client) LoginPassword ¶
func (c *Client) LoginPassword(ctx context.Context, request LoginPasswordRequest) (LoginResult, error)
LoginPassword uses the legacy v1 password exchange evidenced by the reference.
func (*Client) RequestCode ¶
func (c *Client) RequestCode(ctx context.Context, request CodeRequest) (CodeResult, error)
RequestCode sends a v4 email code request without implicit fallback.
func (*Client) ResolveRegion ¶
func (c *Client) ResolveRegion(ctx context.Context, request RegionRequest) (RegionResult, error)
ResolveRegion makes one explicit regional lookup; it never cycles regions.
func (*Client) SharedDeviceRooms ¶ added in v0.2.0
func (c *Client) SharedDeviceRooms(ctx context.Context, request SharedDeviceRoomsRequest) (RoomsResult, error)
SharedDeviceRooms accepts the provider's roomId alias when id is absent.
func (*Client) SignKey ¶
func (c *Client) SignKey(ctx context.Context, request SignRequest) (SignResult, error)
SignKey generates a nonce and obtains its matching mercy key.
type CodeRequest ¶
type CodeRequest struct{ Login LoginContext }
CodeRequest requests an email verification code.
type HomeDataRequest ¶
type HomeDataRequest struct {
Auth AuthContext
HomeID int64
Version int
}
HomeDataRequest selects a home and a documented version (1, 2, or 3).
type HomeDataResult ¶
type HomeDataResult struct{ Home dependencymodels.HomeData }
HomeDataResult contains inventory with absent fields preserved by pointers.
type HomeDetailRequest ¶
type HomeDetailRequest struct{ Auth AuthContext }
HomeDetailRequest authenticates a home ID lookup using the caller's token.
type HomeDetailResult ¶
type HomeDetailResult struct{ Home dependencymodels.HomeDetail }
HomeDetailResult contains the vendor home identifier.
type HomeRoomsRequest ¶ added in v0.2.0
type HomeRoomsRequest struct {
Auth AuthContext
HomeID int64
}
HomeRoomsRequest refreshes rooms using a caller-owned home ID and account.
type LoginCodeRequest ¶
type LoginCodeRequest struct {
Login LoginContext
Code string
Signature SignResult
Agreement dependencymodels.Agreement
}
LoginCodeRequest submits a code with caller-obtained mercy and agreement values.
type LoginContext ¶
type LoginContext struct {
Email string
ClientID string
Country string
CountryCode string
BaseURL string
}
LoginContext identifies one account and its explicit regional settings.
type LoginLegacyCodeRequest ¶
type LoginLegacyCodeRequest struct {
Login LoginContext
Code string
}
LoginLegacyCodeRequest selects the evidenced legacy code endpoint.
type LoginPasswordRequest ¶
type LoginPasswordRequest struct {
Login LoginContext
Password string
}
LoginPasswordRequest selects the evidenced legacy password endpoint.
type LoginResult ¶
type LoginResult struct{ User dependencymodels.UserData }
LoginResult holds the newly returned credentials without mutating the client.
type Option ¶
type Option func(*Client)
Option configures a reusable client at construction.
func WithBaseURL ¶
WithBaseURL sets the default explicit regional origin.
func WithHTTPClient ¶
WithHTTPClient supplies an HTTP transport owned by the caller.
func WithRandom ¶
WithRandom supplies signing entropy. The reader must support concurrent reads.
type RegionRequest ¶
RegionRequest resolves an email at the supplied origin only.
type RegionResult ¶
type RegionResult struct{ Region dependencymodels.RegionData }
RegionResult contains the service's region and country discovery result.
type RoomsResult ¶ added in v0.2.0
type RoomsResult struct {
Rooms []dependencymodels.RefreshedRoom
}
RoomsResult preserves missing room names and forward-compatible room fields.
type SharedDeviceRoomsRequest ¶ added in v0.2.0
type SharedDeviceRoomsRequest struct {
}
SharedDeviceRoomsRequest selects a received device without changing account state.
type SignRequest ¶
type SignRequest struct{ Login LoginContext }
SignRequest asks the service to sign a new 16-character mercy nonce.
type SignResult ¶
SignResult contains the paired nonce and signature for one login.