refactor, simplify api, add support for email/password auth

This commit is contained in:
seydx
2025-05-26 18:29:31 +02:00
parent 42b7eea852
commit 5be5d9247c
10 changed files with 857 additions and 941 deletions
+12 -16
View File
@@ -26,17 +26,13 @@ type TuyaAPI interface {
type TuyaClient struct {
TuyaAPI
httpClient *http.Client
mqtt *TuyaMqttClient
streamMode string
baseUrl string
accessToken string
refreshToken string
expireTime int64
deviceId string
uid string
skill *Skill
iceServers []pionWebrtc.ICEServer
httpClient *http.Client
mqtt *TuyaMqttClient
baseUrl string
expireTime int64
deviceId string
skill *Skill
iceServers []pionWebrtc.ICEServer
}
type AudioAttributes struct {
@@ -44,11 +40,11 @@ type AudioAttributes struct {
HardwareCapability []int `json:"hardware_capability"` // 1 = mic, 2 = speaker
}
type OpenApiICE struct {
type ICEServer struct {
Urls string `json:"urls"`
Username string `json:"username"`
Credential string `json:"credential"`
TTL int `json:"ttl"`
Username string `json:"username,omitempty"`
Credential string `json:"credential,omitempty"`
TTL int `json:"ttl,omitempty"`
}
type WebICE struct {
@@ -58,7 +54,7 @@ type WebICE struct {
}
type P2PConfig struct {
Ices []OpenApiICE `json:"ices"`
Ices []ICEServer `json:"ices"`
}
type AudioSkill struct {