v3.0.0-alpha - almost done.

This commit is contained in:
MickMake 2022-12-05 21:33:52 +11:00
parent 361db3e781
commit efcc3b1513
1008 changed files with 7669 additions and 3671 deletions

1287
.idea/workspace.xml generated

File diff suppressed because it is too large Load Diff

View File

@ -83,8 +83,9 @@ func (c *CmdApi) AttachCommand(cmd *cobra.Command) *cobra.Command {
var cmdApi = &cobra.Command{
Use: "api",
Aliases: []string{},
Short: fmt.Sprintf("Interact with the low-level SunGrow api."),
Long: fmt.Sprintf("Interact with the low-level SunGrow api."),
Annotations: map[string]string{"group": "Api"},
Short: fmt.Sprintf("Low-level interface to the SunGrow api."),
Long: fmt.Sprintf("Low-level interface to the SunGrow api."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: nil,
@ -98,21 +99,12 @@ func (c *CmdApi) AttachCommand(cmd *cobra.Command) *cobra.Command {
var cmdApiList = &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
Short: fmt.Sprintf("List iSolarCloud api endpoints/areas"),
Long: fmt.Sprintf("List iSolarCloud api endpoints/areas"),
Annotations: map[string]string{"group": "Api"},
Short: fmt.Sprintf("List SunGrow api endpoints/areas"),
Long: fmt.Sprintf("List SunGrow api endpoints/areas"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
Run: c.CmdApiList,
Args: cobra.RangeArgs(0, 1),
}
@ -123,21 +115,12 @@ func (c *CmdApi) AttachCommand(cmd *cobra.Command) *cobra.Command {
var cmdApiLogin = &cobra.Command{
Use: "login",
Aliases: []string{},
Short: fmt.Sprintf("Login to iSolarCloud"),
Long: fmt.Sprintf("Login to iSolarCloud"),
Annotations: map[string]string{"group": "Api"},
Short: fmt.Sprintf("Login to the SunGrow api."),
Long: fmt.Sprintf("Login to the SunGrow api."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
c.Error = c.ApiLogin(true)
if c.Error != nil {
@ -156,21 +139,12 @@ func (c *CmdApi) AttachCommand(cmd *cobra.Command) *cobra.Command {
var cmdApiGet = &cobra.Command{
Use: "get",
Aliases: []string{output.StringTypeTable},
Short: fmt.Sprintf("Get details from iSolarCloud"),
Long: fmt.Sprintf("Get details from iSolarCloud"),
Annotations: map[string]string{"group": "Api"},
Short: fmt.Sprintf("Get endpoint details from the SunGrow api."),
Long: fmt.Sprintf("Get endpoint details from the SunGrow api."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
c.SunGrow.SaveAsFile = false
c.SunGrow.OutputType.SetJson()
@ -185,21 +159,12 @@ func (c *CmdApi) AttachCommand(cmd *cobra.Command) *cobra.Command {
var cmdApiRaw = &cobra.Command{
Use: output.StringTypeRaw,
Aliases: []string{},
Short: fmt.Sprintf("Raw details from iSolarCloud"),
Long: fmt.Sprintf("Raw details from iSolarCloud"),
Annotations: map[string]string{"group": "Api"},
Short: fmt.Sprintf("Raw response from the SunGrow api."),
Long: fmt.Sprintf("Raw response from the SunGrow api."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
c.SunGrow.SaveAsFile = false
c.SunGrow.OutputType.SetRaw()
@ -214,21 +179,12 @@ func (c *CmdApi) AttachCommand(cmd *cobra.Command) *cobra.Command {
var cmdApiSave = &cobra.Command{
Use: "save",
Aliases: []string{},
Short: fmt.Sprintf("Save details from iSolarCloud"),
Long: fmt.Sprintf("Save details from iSolarCloud"),
Annotations: map[string]string{"group": "Api"},
Short: fmt.Sprintf("Save the response from the SunGrow api."),
Long: fmt.Sprintf("Save the response from the SunGrow api."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
c.SunGrow.SaveAsFile = true
c.SunGrow.OutputType.SetJson()
@ -243,21 +199,12 @@ func (c *CmdApi) AttachCommand(cmd *cobra.Command) *cobra.Command {
var cmdApiStruct = &cobra.Command{
Use: output.StringTypeStruct,
Aliases: []string{},
Annotations: map[string]string{"group": "Api"},
Short: fmt.Sprintf("Show response as Go structure (debug)"),
Long: fmt.Sprintf("Show response as Go structure (debug)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
// c.SunGrow.SaveAsFile = true
c.SunGrow.OutputType.SetStruct()
@ -272,21 +219,12 @@ func (c *CmdApi) AttachCommand(cmd *cobra.Command) *cobra.Command {
var cmdApiPut = &cobra.Command{
Use: "put",
Aliases: []string{"write"},
Short: fmt.Sprintf("Put details onto iSolarCloud"),
Long: fmt.Sprintf("Put details onto iSolarCloud"),
Annotations: map[string]string{"group": "Api"},
Short: fmt.Sprintf("Put details onto the SunGrow api."),
Long: fmt.Sprintf("Put details onto the SunGrow api."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
Run: c.CmdApiPut,
Args: cobra.RangeArgs(0, 1),
}
@ -321,8 +259,13 @@ func (c *CmdApi) AttachFlags(cmd *cobra.Command, viper *viper.Viper) {
}
func (ca *Cmds) SunGrowArgs(_ *cobra.Command, _ []string) error {
func (ca *Cmds) SunGrowArgs(cmd *cobra.Command, args []string) error {
for range Only.Once {
ca.Error = cmds.ProcessArgs(cmd, args)
if ca.Error != nil {
break
}
ca.Api.SunGrow = iSolarCloud.NewSunGro(ca.Api.Url, ca.CacheDir)
if ca.Api.SunGrow.Error != nil {
ca.Error = ca.Api.SunGrow.Error

View File

@ -40,21 +40,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: "data",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("High-level iSolarCloud data fetching."),
Long: fmt.Sprintf("High-level iSolarCloud data fetching."),
Short: fmt.Sprintf("Mid-level access to the Sungrow api."),
Long: fmt.Sprintf("Mid-level access to the Sungrow api."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
@ -68,21 +58,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: output.StringTypeList + " <[area.]endpoint> [endpoint args ...]",
Aliases: []string{"get"},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from iSolarCloud (list)"),
Long: fmt.Sprintf("Get data from iSolarCloud (list)"),
Short: fmt.Sprintf("Get data from the Sungrow api (list)"),
Long: fmt.Sprintf("Get data from the Sungrow api (list)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -94,21 +74,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: output.StringTypeTable + " <[area.]endpoint> [endpoint args ...]",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from iSolarCloud (table)"),
Long: fmt.Sprintf("Get data from iSolarCloud (table)"),
Short: fmt.Sprintf("Get data from the Sungrow api (table)"),
Long: fmt.Sprintf("Get data from the Sungrow api (table)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -120,21 +90,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: output.StringTypeRaw + " <[area.]endpoint> [endpoint args ...]",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from iSolarCloud (raw)"),
Long: fmt.Sprintf("Get data from iSolarCloud (raw)"),
Short: fmt.Sprintf("Get data from the Sungrow api (raw)"),
Long: fmt.Sprintf("Get data from the Sungrow api (raw)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -146,21 +106,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: output.StringTypeJson + " <[area.]endpoint> [endpoint args ...]",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from iSolarCloud (json)"),
Long: fmt.Sprintf("Get data from iSolarCloud (json)"),
Short: fmt.Sprintf("Get data from the Sungrow api (json)"),
Long: fmt.Sprintf("Get data from the Sungrow api (json)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -172,21 +122,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: output.StringTypeCsv + " <[area.]endpoint> [endpoint args ...]",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from iSolarCloud (csv)"),
Long: fmt.Sprintf("Get data from iSolarCloud (csv)"),
Short: fmt.Sprintf("Get data from the Sungrow api (csv)"),
Long: fmt.Sprintf("Get data from the Sungrow api (csv)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -198,21 +138,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: output.StringTypeGraph + " <[area.]endpoint> [endpoint args ...]",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from iSolarCloud (graph)"),
Long: fmt.Sprintf("Get data from iSolarCloud (graph)"),
Short: fmt.Sprintf("Get data from the Sungrow api (graph)"),
Long: fmt.Sprintf("Get data from the Sungrow api (graph)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -224,21 +154,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: output.StringTypeXML + " <[area.]endpoint> [endpoint args ...]",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from iSolarCloud (xml)"),
Long: fmt.Sprintf("Get data from iSolarCloud (xml)"),
Short: fmt.Sprintf("Get data from the Sungrow api (xml)"),
Long: fmt.Sprintf("Get data from the Sungrow api (xml)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -250,21 +170,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Use: output.StringTypeXLSX + " <[area.]endpoint> [endpoint args ...]",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from iSolarCloud (XLSX)"),
Long: fmt.Sprintf("Get data from iSolarCloud (XLSX)"),
Short: fmt.Sprintf("Get data from the Sungrow api (XLSX)"),
Long: fmt.Sprintf("Get data from the Sungrow api (XLSX)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -280,17 +190,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Show response as Go structure (debug)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: c.GetEndpoints,
Args: cobra.MinimumNArgs(0),
}
@ -316,13 +216,14 @@ func (c *CmdData) GetEndpoints(cmd *cobra.Command, args []string) error {
data.SetOutput(cmd.Name())
data.SetSaveAsFile(cmds.Api.SaveFile)
data.SetEndpoints(eps...)
data.SetArgs(args[1:]...)
c.Error = data.GetData(args[1:]...)
c.Error = data.GetData()
if c.Error != nil {
break
}
c.Error = data.GetOutput()
c.Error = data.Output()
if c.Error != nil {
break
}

View File

@ -1,7 +1,6 @@
package cmd
import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/GoStruct/output"
"fmt"
"github.com/MickMake/GoUnify/Only"
@ -44,17 +43,7 @@ func (c *CmdInfo) AttachCommand(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("General iSolarCloud functions."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
@ -72,17 +61,7 @@ func (c *CmdInfo) AttachCommand(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Get info from iSolarCloud (table)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
@ -101,17 +80,7 @@ func (c *CmdInfo) AttachCommand(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Get info from iSolarCloud (raw)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
@ -130,17 +99,7 @@ func (c *CmdInfo) AttachCommand(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Get info from iSolarCloud (json)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
@ -159,17 +118,7 @@ func (c *CmdInfo) AttachCommand(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Get info from iSolarCloud (json)"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
@ -188,17 +137,7 @@ func (c *CmdInfo) AttachCommand(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Set info on iSolarCloud"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
Run: cmds.CmdInfoPut,
Args: cobra.ExactArgs(2),
}
@ -214,18 +153,18 @@ func (c *CmdInfo) AttachCmdInfo(cmd *cobra.Command) *cobra.Command {
break
}
c.AttachCmdInfoPointNames(cmd)
// c.AttachCmdInfoPointNames(cmd)
c.AttachCmdInfoMqtt(cmd)
c.AttachCmdInfoSearchPointInfo(cmd)
c.AttachCmdInfoDevices(cmd)
c.AttachCmdInfoDeviceModels(cmd)
c.AttachCmdInfoTemplates(cmd)
c.AttachCmdInfoTemplatePoints(cmd)
c.AttachCmdInfoGetDevicePoints(cmd)
// c.AttachCmdInfoSearchPointInfo(cmd)
// c.AttachCmdInfoDevices(cmd)
// c.AttachCmdInfoDeviceModels(cmd)
// c.AttachCmdInfoTemplates(cmd)
// c.AttachCmdInfoTemplatePoints(cmd)
// c.AttachCmdInfoGetDevicePoints(cmd)
c.AttachCmdInfoStats(cmd)
c.AttachCmdInfoTemplate(cmd)
c.AttachCmdInfoPoints(cmd)
// c.AttachCmdInfoTemplate(cmd)
// c.AttachCmdInfoPoints(cmd)
c.AttachCmdInfoRealTime(cmd)
c.AttachCmdInfoPsDetails(cmd)
@ -253,17 +192,7 @@ func (c *CmdInfo) AttachCmdInfoMqtt(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Get iSolarCloud MQTT service login details."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
args = cmdConfig.FillArray(1, args)
@ -277,282 +206,150 @@ func (c *CmdInfo) AttachCmdInfoMqtt(cmd *cobra.Command) *cobra.Command {
return cmd
}
// "point-names" -> Alias AppService.getPowerDevicePointNames
func (c *CmdInfo) AttachCmdInfoPointNames(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "point-names",
Aliases: []string{"names"},
Annotations: map[string]string{"group": "Info"},
Short: fmt.Sprintf("Get iSolarCloud point names."),
Long: fmt.Sprintf("Get iSolarCloud point names."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
return cmds.Api.SunGrow.GetPointNames(args...)
},
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "")
// func (c *CmdInfo) AttachCmdInfoPointNames(cmd *cobra.Command) *cobra.Command {
// // ********************************************************************************
// var c2 = &cobra.Command{
// Use: "point-names",
// Aliases: []string{"names"},
// Annotations: map[string]string{"group": "Info"},
// Short: fmt.Sprintf("Get iSolarCloud point names."),
// Long: fmt.Sprintf("Get iSolarCloud point names."),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: func(cmd *cobra.Command, args []string) error {
// cmds.Error = cmds.ProcessArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// cmds.Error = cmds.SunGrowArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// return nil
// },
// RunE: func(cmd *cobra.Command, args []string) error {
// _ = cmds.SetOutputType(cmd)
// return cmds.Api.SunGrow.GetPointNames(args...)
// },
// Args: cobra.MinimumNArgs(0),
// }
// cmd.AddCommand(c2)
// c2.Example = cmdHelp.PrintExamples(c2, "")
//
// return cmd
// }
return cmd
}
// func (c *CmdInfo) AttachCmdInfoSearchPointInfo(cmd *cobra.Command) *cobra.Command {
// // ********************************************************************************
// var c2 = &cobra.Command{
// Use: "search-point-names",
// Aliases: []string{"names"},
// Annotations: map[string]string{"group": "Info"},
// Short: fmt.Sprintf("Get iSolarCloud search point names."),
// Long: fmt.Sprintf("Get iSolarCloud search point names."),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: func(cmd *cobra.Command, args []string) error {
// cmds.Error = cmds.ProcessArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// cmds.Error = cmds.SunGrowArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// return nil
// },
// RunE: func(cmd *cobra.Command, args []string) error {
// _ = cmds.SetOutputType(cmd)
// return cmds.Api.SunGrow.SearchPointNames(args...)
// },
// Args: cobra.MinimumNArgs(0),
// }
// cmd.AddCommand(c2)
// c2.Example = cmdHelp.PrintExamples(c2, "")
//
// return cmd
// }
func (c *CmdInfo) AttachCmdInfoSearchPointInfo(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "search-point-names",
Aliases: []string{"names"},
Annotations: map[string]string{"group": "Info"},
Short: fmt.Sprintf("Get iSolarCloud search point names."),
Long: fmt.Sprintf("Get iSolarCloud search point names."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
return cmds.Api.SunGrow.SearchPointNames(args...)
},
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "")
return cmd
}
// func (c *CmdInfo) AttachCmdInfoDevices(cmd *cobra.Command) *cobra.Command {
// // ********************************************************************************
// var c2 = &cobra.Command{
// Use: "devices",
// Aliases: []string{"device"},
// Annotations: map[string]string{"group": "Info"},
// Short: fmt.Sprintf("Get iSolarCloud devices."),
// Long: fmt.Sprintf("Get iSolarCloud devices."),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: func(cmd *cobra.Command, args []string) error {
// cmds.Error = cmds.ProcessArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// cmds.Error = cmds.SunGrowArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// return nil
// },
// RunE: func(cmd *cobra.Command, args []string) error {
// _ = cmds.SetOutputType(cmd)
// // pids, err := cmds.Api.SunGrow.StringToPids(args...)
// // if err != nil {
// // return err
// // }
// return cmds.Api.SunGrow.GetDeviceList(args...)
// },
// Args: cobra.MinimumNArgs(0),
// }
// cmd.AddCommand(c2)
// c2.Example = cmdHelp.PrintExamples(c2, "")
//
// return cmd
// }
func (c *CmdInfo) AttachCmdInfoDevices(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "devices",
Aliases: []string{"device"},
Annotations: map[string]string{"group": "Info"},
Short: fmt.Sprintf("Get iSolarCloud devices."),
Long: fmt.Sprintf("Get iSolarCloud devices."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
// pids, err := cmds.Api.SunGrow.StringToPids(args...)
// if err != nil {
// return err
// }
return cmds.Api.SunGrow.GetDeviceList(args...)
},
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "")
return cmd
}
// func (c *CmdInfo) AttachCmdInfoGetDevicePoints(cmd *cobra.Command) *cobra.Command {
// // ********************************************************************************
// var c2 = &cobra.Command{
// Use: "device-points [ps_id]",
// Aliases: []string{},
// Annotations: map[string]string{"group": "Info"},
// Short: fmt.Sprintf("List all available device data points."),
// Long: fmt.Sprintf("List all available device data points."),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: func(cmd *cobra.Command, args []string) error {
// cmds.Error = cmds.ProcessArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// cmds.Error = cmds.SunGrowArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// return nil
// },
// RunE: func(cmd *cobra.Command, args []string) error {
// _ = cmds.SetOutputType(cmd)
// pids, err := cmds.Api.SunGrow.StringToPids(args...)
// if err != nil {
// return err
// }
// return cmds.Api.SunGrow.GetDevicePoints(pids...)
// },
// Args: cobra.MinimumNArgs(0),
// }
// cmd.AddCommand(c2)
// c2.Example = cmdHelp.PrintExamples(c2, "", "1129147")
//
// return cmd
// }
func (c *CmdInfo) AttachCmdInfoDeviceModels(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "models",
Aliases: []string{"model"},
Annotations: map[string]string{"group": "Info"},
Short: fmt.Sprintf("Get ALL iSolarCloud models."),
Long: fmt.Sprintf("Get ALL iSolarCloud models."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
return cmds.Api.SunGrow.GetDeviceModelInfoList()
},
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "")
return cmd
}
func (c *CmdInfo) AttachCmdInfoTemplates(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "templates",
Aliases: []string{},
Annotations: map[string]string{"group": "Info"},
Short: fmt.Sprintf("Get all defined templates."),
Long: fmt.Sprintf("Get all defined templates."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
return cmds.Api.SunGrow.GetTemplates()
},
Args: cobra.ExactArgs(0),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "")
return cmd
}
func (c *CmdInfo) AttachCmdInfoTemplatePoints(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "template-points <template_id>",
Aliases: []string{},
Annotations: map[string]string{"group": "Info"},
Short: fmt.Sprintf("List data points used in report template."),
Long: fmt.Sprintf("List data points used in report template."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
return cmds.Api.SunGrow.GetTemplatePoints(args[0])
},
Args: cobra.ExactArgs(1),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "8042", "8040")
return cmd
}
func (c *CmdInfo) AttachCmdInfoGetDevicePoints(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "device-points [ps_id]",
Aliases: []string{},
Annotations: map[string]string{"group": "Info"},
Short: fmt.Sprintf("List all available device data points."),
Long: fmt.Sprintf("List all available device data points."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
pids, err := cmds.Api.SunGrow.StringToPids(args...)
if err != nil {
return err
}
return cmds.Api.SunGrow.GetDevicePoints(pids...)
},
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "", "1129147")
return cmd
}
func (c *CmdInfo) AttachCmdInfoTemplate(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "template <template_id> <date> [filter]",
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get data from report template."),
Long: fmt.Sprintf("Get data from report template."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
args = cmdConfig.FillArray(3, args)
return cmds.Api.SunGrow.GetTemplateData(args[0], args[1], args[2])
},
Args: cobra.RangeArgs(2, 3),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "8042 20220212", "8042 20220212 '{\"search_string\":\"p83106\",\"min_left_axis\":-6000,\"max_left_axis\":12000}'")
return cmd
}
func (c *CmdInfo) AttachCmdInfoStats(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
@ -564,17 +361,7 @@ func (c *CmdInfo) AttachCmdInfoStats(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Get current inverter stats, (last 5 minutes)."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
return cmds.Api.SunGrow.PrintCurrentStats()
@ -587,38 +374,38 @@ func (c *CmdInfo) AttachCmdInfoStats(cmd *cobra.Command) *cobra.Command {
return cmd
}
func (c *CmdInfo) AttachCmdInfoPoints(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var cmdDataPoints = &cobra.Command{
Use: "points <date> <device_id.point_id> ...",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get points data for a specific date."),
Long: fmt.Sprintf("Get points data for a specific date."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
return cmds.Api.SunGrow.GetPointData(args[0], api.CreatePoints(args[1:]))
},
Args: cobra.MinimumNArgs(2),
}
cmd.AddCommand(cmdDataPoints)
cmdDataPoints.Example = cmdHelp.PrintExamples(cmdDataPoints, "20220202 1129147.p13019 1129147.p83106")
return cmd
}
// func (c *CmdInfo) AttachCmdInfoPoints(cmd *cobra.Command) *cobra.Command {
// // ********************************************************************************
// var cmdDataPoints = &cobra.Command{
// Use: "points <date> <device_id.point_id> ...",
// Aliases: []string{},
// Annotations: map[string]string{"group": "Data"},
// Short: fmt.Sprintf("Get points data for a specific date."),
// Long: fmt.Sprintf("Get points data for a specific date."),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: func(cmd *cobra.Command, args []string) error {
// cmds.Error = cmds.ProcessArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// cmds.Error = cmds.SunGrowArgs(cmd, args)
// if cmds.Error != nil {
// return cmds.Error
// }
// return nil
// },
// RunE: func(cmd *cobra.Command, args []string) error {
// _ = cmds.SetOutputType(cmd)
// return cmds.Api.SunGrow.GetPointData(args[0], api.CreatePoints(args[1:]))
// },
// Args: cobra.MinimumNArgs(2),
// }
// cmd.AddCommand(cmdDataPoints)
// cmdDataPoints.Example = cmdHelp.PrintExamples(cmdDataPoints, "20220202 1129147.p13019 1129147.p83106")
//
// return cmd
// }
func (c *CmdInfo) AttachCmdInfoRealTime(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
@ -630,17 +417,7 @@ func (c *CmdInfo) AttachCmdInfoRealTime(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Get iSolarCloud real-time data."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
args = cmdConfig.FillArray(1, args)
@ -664,17 +441,7 @@ func (c *CmdInfo) AttachCmdInfoPsDetails(cmd *cobra.Command) *cobra.Command {
Long: fmt.Sprintf("Get iSolarCloud ps details."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
_ = cmds.SetOutputType(cmd)
// pids, err := cmds.Api.SunGrow.StringToPids(args...)

View File

@ -85,10 +85,6 @@ func (c *CmdMqtt) AttachCommand(cmd *cobra.Command) *cobra.Command {
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
@ -114,10 +110,6 @@ func (c *CmdMqtt) AttachCommand(cmd *cobra.Command) *cobra.Command {
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
@ -167,7 +159,16 @@ func (ca *Cmds) MqttArgs(_ *cobra.Command, _ []string) error {
}
cmdLog.LogPrintDate("Connecting to SunGrow...\n")
ca.Mqtt.Client.SungrowDevices, ca.Error = ca.Api.SunGrow.GetDevices(true)
// ca.Mqtt.Client.SungrowDevices, ca.Error = ca.Api.SunGrow.GetDevices()
fmt.Println("FIX THIS UP")
fmt.Println("FIX THIS UP")
fmt.Println("FIX THIS UP")
fmt.Println("FIX THIS UP")
fmt.Println("FIX THIS UP")
fmt.Println("FIX THIS UP")
fmt.Println("FIX THIS UP")
fmt.Println("FIX THIS UP")
time.Sleep(time.Hour * 24)
if ca.Error != nil {
break
}
@ -212,7 +213,7 @@ func (ca *Cmds) MqttArgs(_ *cobra.Command, _ []string) error {
psId.PsKey.Value(),
psId.DeviceName.Value(),
psId.DeviceModel.Value(),
psId.Vendor.Value(),
psId.FactoryName.Value(),
"Roof",
)
if ca.Error != nil {
@ -372,7 +373,7 @@ func (ca *Cmds) MqttCron() error {
// results := data.GetResults()
for _, result := range data.GetResults() {
for _, result := range data.Results {
ca.Error = result.ProcessMapForMqtt()
if ca.Error != nil {
continue

80
cmd/cmd_show.go Normal file
View File

@ -0,0 +1,80 @@
package cmd
import (
"fmt"
"github.com/MickMake/GoUnify/Only"
"github.com/MickMake/GoUnify/cmdHelp"
"github.com/spf13/cobra"
)
// type CmdShow struct {
// CmdDefault
// PsId CmdDefault
// Device CmdDefault
// Template CmdDefault
// }
//
// func NewCmdShow() *CmdShow {
// ret := &CmdShow {
// CmdDefault: CmdDefault {
// Error: nil,
// cmd: nil,
// SelfCmd: nil,
// },
// }
// return ret
// }
type CmdShow CmdDefault
func NewCmdShow() *CmdShow {
return &CmdShow {
Error: nil,
cmd: nil,
SelfCmd: nil,
}
}
func (c *CmdShow) AttachCommand(cmd *cobra.Command) *cobra.Command {
for range Only.Once {
if cmd == nil {
break
}
c.cmd = cmd
// ******************************************************************************** //
c.SelfCmd = &cobra.Command{
Use: "show",
Aliases: []string{},
Annotations: map[string]string{"group": "Show"},
Short: fmt.Sprintf("Helpful Sungrow functions."),
Long: fmt.Sprintf("Helpful Sungrow functions."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: func(cmd *cobra.Command, args []string) error {
cmds.Error = cmds.ProcessArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
cmds.Error = cmds.SunGrowArgs(cmd, args)
if cmds.Error != nil {
return cmds.Error
}
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(c.SelfCmd)
c.SelfCmd.Example = cmdHelp.PrintExamples(c.SelfCmd, "")
c.AttachPsId(c.SelfCmd)
c.AttachDevice(c.SelfCmd)
c.AttachPoint(c.SelfCmd)
c.AttachTemplate(c.SelfCmd)
}
return c.SelfCmd
}

92
cmd/cmd_show_device.go Normal file
View File

@ -0,0 +1,92 @@
package cmd
import (
"fmt"
"github.com/MickMake/GoUnify/Only"
"github.com/MickMake/GoUnify/cmdHelp"
"github.com/spf13/cobra"
)
func (c *CmdShow) AttachDevice(cmd *cobra.Command) *cobra.Command {
for range Only.Once {
var self = &cobra.Command{
Use: "device",
Aliases: []string{},
Annotations: map[string]string{"group": "Device"},
Short: fmt.Sprintf("General iSolarCloud functions."),
Long: fmt.Sprintf("General iSolarCloud functions."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
c.AttachDeviceList(self)
c.AttachDeviceModels(self)
}
return c.SelfCmd
}
func (c *CmdShow) AttachDeviceList(cmd *cobra.Command) *cobra.Command {
var self = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Annotations: map[string]string{"group": "Device"},
Short: fmt.Sprintf("Show all devices on account."),
Long: fmt.Sprintf("Show all devices on account."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachDeviceList,
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachDeviceList(_ *cobra.Command, args []string) error {
for range Only.Once {
var devices string
devices, c.Error = cmds.Api.SunGrow.Devices(args...)
if c.Error != nil {
break
}
fmt.Printf("%s\n", devices)
}
return c.Error
}
func (c *CmdShow) AttachDeviceModels(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "models",
Aliases: []string{"model"},
Annotations: map[string]string{"group": "Device"},
Short: fmt.Sprintf("Get ALL Sungrow models (large list)."),
Long: fmt.Sprintf("Get ALL Sungrow models (large list)."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachDeviceModels,
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "")
return cmd
}
func (c *CmdShow) funcAttachDeviceModels(_ *cobra.Command, _ []string) error {
for range Only.Once {
// _ = cmds.SetOutputType(cmd)
c.Error = cmds.Api.SunGrow.GetDeviceModelInfoList()
}
return c.Error
}

153
cmd/cmd_show_point.go Normal file
View File

@ -0,0 +1,153 @@
package cmd
import (
"fmt"
"github.com/MickMake/GoUnify/Only"
"github.com/MickMake/GoUnify/cmdConfig"
"github.com/MickMake/GoUnify/cmdHelp"
"github.com/spf13/cobra"
)
func (c *CmdShow) AttachPoint(cmd *cobra.Command) *cobra.Command {
for range Only.Once {
var self = &cobra.Command{
Use: "point",
Aliases: []string{},
Annotations: map[string]string{"group": "Point"},
Short: fmt.Sprintf("General iSolarCloud functions."),
Long: fmt.Sprintf("General iSolarCloud functions."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
c.AttachPointNames(self)
c.AttachPointScan(self)
c.AttachPointData(self)
c.AttachPointTemplate(self)
}
return c.SelfCmd
}
func (c *CmdShow) AttachPointNames(cmd *cobra.Command) *cobra.Command {
var self = &cobra.Command{
Use: "names [ps_id]",
Aliases: []string{},
Annotations: map[string]string{"group": "Point"},
Short: fmt.Sprintf("Get point names for a given ps_id."),
Long: fmt.Sprintf("Get point names for a given ps_id."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachPointNames,
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachPointNames(_ *cobra.Command, args []string) error {
for range Only.Once {
points := cmds.Api.SunGrow.PointNames(args...)
if c.Error != nil {
break
}
fmt.Printf("%s\n", points)
}
return c.Error
}
func (c *CmdShow) AttachPointScan(cmd *cobra.Command) *cobra.Command {
var self = &cobra.Command{
Use: "scan [min] [max]",
Aliases: []string{},
Annotations: map[string]string{"group": "Point"},
Short: fmt.Sprintf("Scan full list of points."),
Long: fmt.Sprintf("Scan full list of points."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachPointScan,
Args: cobra.MinimumNArgs(2),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachPointScan(_ *cobra.Command, args []string) error {
for range Only.Once {
args = cmdConfig.FillArray(2, args)
points := cmds.Api.SunGrow.PointScan(args[0], args[1])
if c.Error != nil {
break
}
fmt.Printf("%s\n", points)
}
return c.Error
}
func (c *CmdShow) AttachPointData(cmd *cobra.Command) *cobra.Command {
var self = &cobra.Command{
Use: "data <start:YYYYmmdd[HHMMSS]> <end:YYYYmmdd[HHMMSS]> <interval minutes> <points ...>",
Aliases: []string{},
Annotations: map[string]string{"group": "Point"},
Short: fmt.Sprintf("Get data points."),
Long: fmt.Sprintf("Get data points."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachPointData,
Args: cobra.MinimumNArgs(4),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachPointData(_ *cobra.Command, args []string) error {
for range Only.Once {
args = cmdConfig.FillArray(4, args)
cmds.Api.SunGrow.PointData(args[0], args[1], args[2], args[3:]...)
if c.Error != nil {
break
}
}
return c.Error
}
func (c *CmdShow) AttachPointTemplate(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var c2 = &cobra.Command{
Use: "template <template_id>",
Aliases: []string{},
Annotations: map[string]string{"group": "Point"},
Short: fmt.Sprintf("List data points used in report template."),
Long: fmt.Sprintf("List data points used in report template."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachPointTemplate,
Args: cobra.ExactArgs(1),
}
cmd.AddCommand(c2)
c2.Example = cmdHelp.PrintExamples(c2, "8042", "8040")
return cmd
}
func (c *CmdShow) funcAttachPointTemplate(_ *cobra.Command, args []string) error {
for range Only.Once {
// _ = cmds.SetOutputType(cmd)
c.Error = cmds.Api.SunGrow.TemplatePoints(args[0])
}
return c.Error
}

125
cmd/cmd_show_psid.go Normal file
View File

@ -0,0 +1,125 @@
package cmd
import (
"GoSungrow/iSolarCloud"
"fmt"
"github.com/MickMake/GoUnify/Only"
"github.com/MickMake/GoUnify/cmdHelp"
"github.com/spf13/cobra"
)
func (c *CmdShow) AttachPsId(cmd *cobra.Command) *cobra.Command {
for range Only.Once {
var self = &cobra.Command{
Use: "ps",
Aliases: []string{},
Annotations: map[string]string{"group": "PsId"},
Short: fmt.Sprintf("General iSolarCloud functions."),
Long: fmt.Sprintf("General iSolarCloud functions."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
c.AttachPsIdList(self)
c.AttachPsTree(self)
c.AttachPsPoints(self)
}
return c.SelfCmd
}
func (c *CmdShow) AttachPsIdList(cmd *cobra.Command) *cobra.Command {
var self = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Annotations: map[string]string{"group": "PsId"},
Short: fmt.Sprintf("Show all available PS."),
Long: fmt.Sprintf("Show all available PS."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachPsIdList,
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachPsIdList(_ *cobra.Command, args []string) error {
for range Only.Once {
pids := cmds.Api.SunGrow.SetPsIds(args...)
if c.Error != nil {
break
}
fmt.Printf("%s\n", pids)
}
return c.Error
}
func (c *CmdShow) AttachPsTree(cmd *cobra.Command) *cobra.Command {
var self = &cobra.Command{
Use: "tree",
Aliases: []string{},
Annotations: map[string]string{"group": "PsId"},
Short: fmt.Sprintf("Show the PS tree."),
Long: fmt.Sprintf("Show the PS tree."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachPsTree,
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachPsTree(_ *cobra.Command, args []string) error {
for range Only.Once {
var pids iSolarCloud.PsTree
pids, c.Error = cmds.Api.SunGrow.PsTreeMenu(args...)
if c.Error != nil {
break
}
fmt.Printf("%s\n", pids)
}
return c.Error
}
func (c *CmdShow) AttachPsPoints(cmd *cobra.Command) *cobra.Command {
var self = &cobra.Command{
Use: "points",
Aliases: []string{},
Annotations: map[string]string{"group": "PsId"},
Short: fmt.Sprintf("Show available PS points."),
Long: fmt.Sprintf("Show available PS points."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachPsPoints,
Args: cobra.MinimumNArgs(0),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachPsPoints(_ *cobra.Command, args []string) error {
for range Only.Once {
points := cmds.Api.SunGrow.PointNames(args...)
if cmds.Api.SunGrow.Error != nil {
c.Error = cmds.Api.SunGrow.Error
break
}
fmt.Printf("%s\n", points)
}
return c.Error
}

118
cmd/cmd_show_template.go Normal file
View File

@ -0,0 +1,118 @@
package cmd
import (
"fmt"
"github.com/MickMake/GoUnify/Only"
"github.com/MickMake/GoUnify/cmdConfig"
"github.com/MickMake/GoUnify/cmdHelp"
"github.com/spf13/cobra"
)
func (c *CmdShow) AttachTemplate(cmd *cobra.Command) *cobra.Command {
for range Only.Once {
var self = &cobra.Command{
Use: "template",
Aliases: []string{},
Annotations: map[string]string{"group": "Template"},
Short: fmt.Sprintf("General iSolarCloud functions."),
Long: fmt.Sprintf("General iSolarCloud functions."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: func(cmd *cobra.Command, args []string) error {
return cmd.Help()
},
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
c.AttachTemplateList(self)
c.AttachTemplatePoints(self)
c.AttachTemplateData(self)
}
return c.SelfCmd
}
func (c *CmdShow) AttachTemplateList(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var self = &cobra.Command{
Use: "list",
Aliases: []string{},
Annotations: map[string]string{"group": "Template"},
Short: fmt.Sprintf("Get all defined templates."),
Long: fmt.Sprintf("Get all defined templates."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachTemplateList,
Args: cobra.ExactArgs(0),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachTemplateList(_ *cobra.Command, _ []string) error {
for range Only.Once {
// _ = cmds.SetOutputType(cmd)
c.Error = cmds.Api.SunGrow.TemplateList()
}
return c.Error
}
func (c *CmdShow) AttachTemplatePoints(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var self = &cobra.Command{
Use: "points <template id>",
Aliases: []string{"point"},
Annotations: map[string]string{"group": "Template"},
Short: fmt.Sprintf("Get all points defined within a template."),
Long: fmt.Sprintf("Get all points defined within a template."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachTemplatePoints,
Args: cobra.ExactArgs(1),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "")
return cmd
}
func (c *CmdShow) funcAttachTemplatePoints(_ *cobra.Command, args []string) error {
for range Only.Once {
// _ = cmds.SetOutputType(cmd)
c.Error = cmds.Api.SunGrow.TemplatePoints(args[0])
}
return c.Error
}
func (c *CmdShow) AttachTemplateData(cmd *cobra.Command) *cobra.Command {
// ********************************************************************************
var self = &cobra.Command{
Use: "data <template_id> [start date] [end date] [interval]",
Annotations: map[string]string{"group": "Template"},
Short: fmt.Sprintf("Get data from report template."),
Long: fmt.Sprintf("Get data from report template."),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: cmds.SunGrowArgs,
RunE: c.funcAttachTemplateData,
Args: cobra.MinimumNArgs(1),
}
cmd.AddCommand(self)
self.Example = cmdHelp.PrintExamples(self, "8042 20220212", "8042 20220212 '{\"search_string\":\"p83106\",\"min_left_axis\":-6000,\"max_left_axis\":12000}'")
return cmd
}
func (c *CmdShow) funcAttachTemplateData(_ *cobra.Command, args []string) error {
for range Only.Once {
// _ = cmds.SetOutputType(cmd)
args = cmdConfig.FillArray(4, args)
c.Error = cmds.Api.SunGrow.TemplateData(args[0], args[1], args[2], args[3])
}
return c.Error
}

View File

@ -1,8 +1,8 @@
package cmd
import (
"github.com/MickMake/GoUnify/Only"
"GoSungrow/defaults"
"github.com/MickMake/GoUnify/Only"
"github.com/MickMake/GoUnify/Unify"
"github.com/spf13/cobra"
"time"
@ -22,6 +22,7 @@ type Cmds struct {
Api *CmdApi
Data *CmdData
Info *CmdInfo
Show *CmdShow
Mqtt *CmdMqtt
ConfigDir string
@ -76,6 +77,9 @@ func init() {
cmds.Info = NewCmdInfo()
cmds.Info.AttachCommand(cmdRoot)
cmds.Show = NewCmdShow()
cmds.Show.AttachCommand(cmdRoot)
cmds.Mqtt = NewCmdMqtt()
cmds.Mqtt.AttachCommand(cmdRoot)
cmds.Mqtt.AttachFlags(cmdRoot, cmds.Unify.GetViper())

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/messageService/msgDownwardStatusReceipt"
const Disabled = false
const EndPointName = "AliSmsService.msgDownwardStatusReceipt"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/acceptPsSharing"
const Disabled = false
const EndPointName = "AppService.acceptPsSharing"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/activateEmail"
const Disabled = false
const EndPointName = "AppService.activateEmail"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/devDataHandleService/addConfig"
const Disabled = false
const EndPointName = "AppService.addConfig"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/addDeviceRepair"
const Disabled = false
const EndPointName = "AppService.addDeviceRepair"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/devDataHandleService/addDeviceToStructureForHousehold"
const Disabled = false
const EndPointName = "AppService.addDeviceToStructureForHousehold"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,6 +10,7 @@ import (
const Url = "/devDataHandleService/addDeviceToStructureForHouseholdByPsIdS"
const Disabled = false
const EndPointName = "AppService.addDeviceToStructureForHouseholdByPsIdS"
type RequestData struct {
}

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addFault"
const Disabled = false
const EndPointName = "AppService.addFault"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addFaultOrder"
const Disabled = false
const EndPointName = "AppService.addFaultOrder"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addFaultPlan"
const Disabled = false
const EndPointName = "AppService.addFaultPlan"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addFaultRepairSteps"
const Disabled = false
const EndPointName = "AppService.addFaultRepairSteps"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addHouseholdEvaluation"
const Disabled = false
const EndPointName = "AppService.addHouseholdEvaluation"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addHouseholdLeaveMessage"
const Disabled = false
const EndPointName = "AppService.addHouseholdLeaveMessage"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addHouseholdOpinionFeedback"
const Disabled = false
const EndPointName = "AppService.addHouseholdOpinionFeedback"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addHouseholdWorkOrder"
const Disabled = false
const EndPointName = "AppService.addHouseholdWorkOrder"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/otherService/addOnDutyInfo"
const Disabled = false
const EndPointName = "AppService.addOnDutyInfo"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addOperRule"
const Disabled = false
const EndPointName = "AppService.addOperRule"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/addOrDelPsStructure"
const Disabled = false
const EndPointName = "AppService.addOrDelPsStructure"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/addOrderStep"
const Disabled = false
const EndPointName = "AppService.addOrderStep"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/addPowerStationForHousehold"
const Disabled = false
const EndPointName = "AppService.addPowerStationForHousehold"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/addPowerStationInfo"
const Disabled = false
const EndPointName = "AppService.addPowerStationInfo"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/reportService/addReportConfigEmail"
const Disabled = false
const EndPointName = "AppService.addReportConfigEmail"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/addSysAdvancedParam"
const Disabled = false
const EndPointName = "AppService.addSysAdvancedParam"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/otherService/addSysOrgNew"
const Disabled = false
const EndPointName = "AppService.addSysOrgNew"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/onlinepay/aliPayAppTest"
const Disabled = false
const EndPointName = "AppService.aliPayAppTest"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/auditOperRule"
const Disabled = false
const EndPointName = "AppService.auditOperRule"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/batchAddStationBySn"
const Disabled = false
const EndPointName = "AppService.batchAddStationBySn"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/batchImportSN"
const Disabled = false
const EndPointName = "AppService.batchImportSN"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/batchInsertUserAndOrg"
const Disabled = false
const EndPointName = "AppService.batchInsertUserAndOrg"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/batchModifyDevicesInfoAndPropertis"
const Disabled = false
const EndPointName = "AppService.batchModifyDevicesInfoAndPropertis"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/batchProcessPlantReport"
const Disabled = false
const EndPointName = "AppService.batchProcessPlantReport"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/batchUpdateDeviceSim"
const Disabled = false
const EndPointName = "AppService.batchUpdateDeviceSim"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/batchUpdateUserIsAgreeGdpr"
const Disabled = false
const EndPointName = "AppService.batchUpdateUserIsAgreeGdpr"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/boundMobilePhone"
const Disabled = false
const EndPointName = "AppService.boundMobilePhone"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/boundUserMail"
const Disabled = false
const EndPointName = "AppService.boundUserMail"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/caculateDeviceInputDiscrete"
const Disabled = false
const EndPointName = "AppService.caculateDeviceInputDiscrete"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/calculateDeviceDiscrete"
const Disabled = false
const EndPointName = "AppService.calculateDeviceDiscrete"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/calculateInitialCompensationData"
const Disabled = false
const EndPointName = "AppService.calculateInitialCompensationData"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/messageService/cancelDeliverMail"
const Disabled = false
const EndPointName = "AppService.cancelDeliverMail"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/cancelOrderScan"
const Disabled = false
const EndPointName = "AppService.cancelOrderScan"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/cancelParamSetTask"
const Disabled = false
const EndPointName = "AppService.cancelParamSetTask"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/cancelPsSharing"
const Disabled = false
const EndPointName = "AppService.cancelPsSharing"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/onlinepay/cancelRechargeOrder"
const Disabled = false
const EndPointName = "AppService.cancelRechargeOrder"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/onlinepay/changRechargeOrderToCancel"
const Disabled = false
const EndPointName = "AppService.changRechargeOrderToCancel"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/orgService/changeHouseholdUser2Installer"
const Disabled = false
const EndPointName = "AppService.changeHouseholdUser2Installer"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/changeRemoteParam"
const Disabled = false
const EndPointName = "AppService.changeRemoteParam"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/orgService/checkDealerOrgCode"
const Disabled = false
const EndPointName = "AppService.checkDealerOrgCode"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/checkDevSnIsBelongsToUser"
const Disabled = false
const EndPointName = "AppService.checkDevSnIsBelongsToUser"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/checkInverterResult"
const Disabled = false
const EndPointName = "AppService.checkInverterResult"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/checkIsCanDoParamSet"
const Disabled = false
const EndPointName = "AppService.checkIsCanDoParamSet"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/checkIsIvScan"
const Disabled = false
const EndPointName = "AppService.checkIsIvScan"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/commonService/checkOssObjectExist"
const Disabled = false
const EndPointName = "AppService.checkOssObjectExist"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/commonService/checkServiceIsConnect"
const Disabled = false
const EndPointName = "AppService.checkServiceIsConnect"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/checkTechnicalParameters"
const Disabled = false
const EndPointName = "AppService.checkTechnicalParameters"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/checkUnitStatus"
const Disabled = false
const EndPointName = "AppService.checkUnitStatus"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/onlinepay/checkUpRechargeDevicePaying"
const Disabled = false
const EndPointName = "AppService.checkUpRechargeDevicePaying"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/checkUserAccountUnique"
const Disabled = false
const EndPointName = "AppService.checkUserAccountUnique"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/checkUserAccountUniqueAll"
const Disabled = false
const EndPointName = "AppService.checkUserAccountUniqueAll"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/checkUserInfoUnique"
const Disabled = false
const EndPointName = "AppService.checkUserInfoUnique"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/checkUserIsExist"
const Disabled = false
const EndPointName = "AppService.checkUserIsExist"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/checkUserListIsExist"
const Disabled = false
const EndPointName = "AppService.checkUserListIsExist"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/checkUserPassword"
const Disabled = false
const EndPointName = "AppService.checkUserPassword"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/commonService/cloudDeploymentRecord"
const Disabled = false
const EndPointName = "AppService.cloudDeploymentRecord"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/comfirmParamModel"
const Disabled = false
const EndPointName = "AppService.comfirmParamModel"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,6 +10,7 @@ import (
const Url = "/v1/devService/communicationModuleDetail"
const Disabled = false
const EndPointName = "AppService.communicationModuleDetail"
type RequestData struct {
Sn valueTypes.String `json:"sn" required:"true"`

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/compareValidateCode"
const Disabled = false
const EndPointName = "AppService.compareValidateCode"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/componentInfo2Cloud"
const Disabled = false
const EndPointName = "AppService.componentInfo2Cloud"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/confirmFault"
const Disabled = false
const EndPointName = "AppService.confirmFault"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/confirmIvFault"
const Disabled = false
const EndPointName = "AppService.confirmIvFault"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/reportService/confirmReportConfig"
const Disabled = false
const EndPointName = "AppService.confirmReportConfig"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/userService/createAppkeyInfo"
const Disabled = false
const EndPointName = "AppService.createAppkeyInfo"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/onlinepay/createRenewInvoice"
const Disabled = false
const EndPointName = "AppService.createRenewInvoice"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/devDataHandleService/dealCommandReply"
const Disabled = false
const EndPointName = "AppService.dealCommandReply"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/dealDeletePsFailPsDelete"
const Disabled = false
const EndPointName = "AppService.dealDeletePsFailPsDelete"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/dealFailRemoteUpgradeSubTasks"
const Disabled = false
const EndPointName = "AppService.dealFailRemoteUpgradeSubTasks"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/dealFailRemoteUpgradeTasks"
const Disabled = false
const EndPointName = "AppService.dealFailRemoteUpgradeTasks"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/faultService/dealFaultOrder"
const Disabled = false
const EndPointName = "AppService.dealFaultOrder"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/dealGroupStringDisableOrEnable"
const Disabled = false
const EndPointName = "AppService.dealGroupStringDisableOrEnable"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/commonService/dealNumberOfServiceCalls2Mysql"
const Disabled = false
const EndPointName = "AppService.dealNumberOfServiceCalls2Mysql"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/dealParamSettingAfterComplete"
const Disabled = false
const EndPointName = "AppService.dealParamSettingAfterComplete"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/powerStationService/dealPsDataSupplement"
const Disabled = false
const EndPointName = "AppService.dealPsDataSupplement"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/reportService/dealPsReportEmailSend"
const Disabled = false
const EndPointName = "AppService.dealPsReportEmailSend"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/dealRemoteUpgrade"
const Disabled = false
const EndPointName = "AppService.dealRemoteUpgrade"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/dealSnElectrifyCheck"
const Disabled = false
const EndPointName = "AppService.dealSnElectrifyCheck"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/dealSysDeviceSimFlowInfo"
const Disabled = false
const EndPointName = "AppService.dealSysDeviceSimFlowInfo"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/dealSysDeviceSimInfo"
const Disabled = false
const EndPointName = "AppService.dealSysDeviceSimInfo"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/definiteTimeDealSnExpRemind"
const Disabled = false
const EndPointName = "AppService.definiteTimeDealSnExpRemind"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/definiteTimeDealSnStatus"
const Disabled = false
const EndPointName = "AppService.definiteTimeDealSnStatus"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

View File

@ -10,9 +10,10 @@ import (
const Url = "/v1/devService/delDeviceRepair"
const Disabled = false
const EndPointName = "AppService.delDeviceRepair"
type RequestData struct {
}
}
func (rd RequestData) IsValid() error {
return GoStruct.VerifyOptionsRequired(rd)

Some files were not shown because too many files have changed in this diff Show More