|
|
package commands
import ( "fmt" "git.aiterp.net/lucifer3/server/internal/formattools" "strings" )
type PairDevice struct { ID string `json:"id"` APIKey string `json:"apiKey"` }
func (c PairDevice) CommandDescription() string { return fmt.Sprintf("PairDevice(%s, %s)", c.ID, formattools.Asterisks(c.APIKey)) }
func (c PairDevice) Matches(driver string) (sub string, ok bool) { split := strings.SplitN(c.ID, ":", 2) if split[0] != driver { return "", false }
return split[1], true }
type ConnectDevice struct { ID string `json:"id"` APIKey string `json:"apiKey"` }
func (c ConnectDevice) Matches(driver string) (sub string, ok bool) { split := strings.SplitN(c.ID, ":", 2) if split[0] != driver { return "", false }
return split[1], true }
func (c ConnectDevice) CommandDescription() string { return fmt.Sprintf("ConnectDevice(%s, %s)", c.ID, formattools.Asterisks(c.APIKey)) }
type SearchDevices struct { ID string `json:"id"` Hint string `json:"hint"` }
func (c SearchDevices) Matches(driver string) (string, bool) { split := strings.SplitN(c.ID, ":", 2) if split[0] != driver { return "", false }
return split[1], true }
func (c SearchDevices) CommandDescription() string { return fmt.Sprintf("SearchDevices(%s, %#+v)", c.ID, c.Hint) }
type ForgetDevice struct { ID string `json:"id"` }
func (c ForgetDevice) CommandDescription() string { return fmt.Sprintf("ForgetDevice(%s)", c.ID) }
|