Skip to content

Commit

Permalink
v2.3.2 - Refactor #2
Browse files Browse the repository at this point in the history
  • Loading branch information
MickMake committed Oct 24, 2022
1 parent 154951f commit 19351d5
Show file tree
Hide file tree
Showing 1,023 changed files with 12,692 additions and 1,779 deletions.
1,143 changes: 1,083 additions & 60 deletions .idea/workspace.xml

Large diffs are not rendered by default.

44 changes: 28 additions & 16 deletions cmd/cmd_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {

// ********************************************************************************
var cmdDataGet = &cobra.Command{
Use: "get",
Use: "get < [area.]<endpoint> | <command> >",
Aliases: []string{output.StringTypeTable},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get high-level data from iSolarCloud (table)"),
Expand All @@ -88,11 +88,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Args: cobra.MinimumNArgs(0),
}
c.SelfCmd.AddCommand(cmdDataGet)
cmdDataGet.Example = cmdHelp.PrintExamples(cmdDataGet, "[area.]<endpoint>")
cmdDataGet.Example = cmdHelp.PrintExamples(cmdDataGet, "queryDeviceList", "WebAppService.showPSView", "stats")

// ********************************************************************************
var cmdDataRaw = &cobra.Command{
Use: output.StringTypeRaw,
Use: output.StringTypeRaw + " < [area.]<endpoint> | <command> >",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get high-level data from iSolarCloud (raw)"),
Expand All @@ -118,7 +118,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {

// ********************************************************************************
var cmdDataJson = &cobra.Command{
Use: output.StringTypeJson,
Use: output.StringTypeJson + " < [area.]<endpoint> | <command> >",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get high-level data from iSolarCloud (json)"),
Expand All @@ -140,11 +140,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Args: cobra.MinimumNArgs(0),
}
c.SelfCmd.AddCommand(cmdDataJson)
cmdDataJson.Example = cmdHelp.PrintExamples(cmdDataJson, "[area.]<endpoint>")
cmdDataJson.Example = cmdHelp.PrintExamples(cmdDataJson, "queryDeviceList", "WebAppService.showPSView", "stats")

// ********************************************************************************
var cmdDataCsv = &cobra.Command{
Use: output.StringTypeCsv,
Use: output.StringTypeCsv + " < [area.]<endpoint> | <command> >",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get high-level data from iSolarCloud (json)"),
Expand All @@ -166,11 +166,11 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Args: cobra.MinimumNArgs(0),
}
c.SelfCmd.AddCommand(cmdDataCsv)
cmdDataCsv.Example = cmdHelp.PrintExamples(cmdDataCsv, "[area.]<endpoint>")
cmdDataCsv.Example = cmdHelp.PrintExamples(cmdDataCsv, "queryDeviceList", "WebAppService.showPSView", "stats")

// ********************************************************************************
var cmdDataGraph = &cobra.Command{
Use: output.StringTypeGraph,
Use: output.StringTypeGraph + " < [area.]<endpoint> | <command> >",
Aliases: []string{},
Annotations: map[string]string{"group": "Data"},
Short: fmt.Sprintf("Get high-level data from iSolarCloud (graph)"),
Expand All @@ -192,7 +192,7 @@ func (c *CmdData) AttachCommand(cmd *cobra.Command) *cobra.Command {
Args: cobra.MinimumNArgs(0),
}
c.SelfCmd.AddCommand(cmdDataGraph)
cmdDataGraph.Example = cmdHelp.PrintExamples(cmdDataGraph, "[area.]<endpoint> ''")
cmdDataGraph.Example = cmdHelp.PrintExamples(cmdDataGraph, "queryDeviceList", "WebAppService.showPSView", "stats")
}
return c.SelfCmd
}
Expand All @@ -212,11 +212,18 @@ func SplitArg(arg string) []string {
return ret
}

const (
argEndpoints = 0
argPsIds = 1
argDate = 2
argReportType = 3
argFaultTypeCode = 4
)
func (c *CmdData) GetEndpoints(cmd *cobra.Command, args []string) error {
// endpoints string, psIds string, date string
for range Only.Once {
cmds.Api.SunGrow.SetOutputType(cmd.Use)
args = cmdConfig.FillArray(4, args)
args = cmdConfig.FillArray(5, args)

for i := range args {
if args[i] == "." {
Expand All @@ -225,26 +232,31 @@ func (c *CmdData) GetEndpoints(cmd *cobra.Command, args []string) error {
}

var e []string
if args[0] != "" {
e = SplitArg(args[0])
if args[argEndpoints] != "" {
e = SplitArg(args[argEndpoints])
}

var p []valueTypes.Integer
for _, psId := range SplitArg(args[1]) {
for _, psId := range SplitArg(args[argPsIds]) {
if psId == "" {
continue
}
p = append(p, valueTypes.SetIntegerString(psId))
}

d := valueTypes.SetDateTimeString(args[2])
d := valueTypes.SetDateTimeString(args[argDate])

rt := args[3]
rt := args[argReportType]
if rt == "" {
rt = "1"
}

c.Error = cmds.Api.SunGrow.GetEndpoints(e, p, *d, rt)
ftc := args[argFaultTypeCode]
// if ftc == "" {
// ftc = "1"
// }

c.Error = cmds.Api.SunGrow.GetEndpoints(e, p, *d, rt, ftc)
}

return c.Error
Expand Down
2 changes: 1 addition & 1 deletion cmd/cmd_mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func (ca *Cmds) MqttCron() error {
}

for _, endpoint := range All {
response := data.Get(endpoint, iSolarCloud.SunGrowDataRequest{ PsId: psId })
response := data.GetByApi(endpoint, iSolarCloud.SunGrowDataRequest{ PsId: psId })
ca.Error = ca.Update(endpoint, response.Data, newDay)
if ca.Error != nil {
break
Expand Down
10 changes: 10 additions & 0 deletions iSolarCloud/AliSmsService/msgDownwardStatusReceipt/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/acceptPsSharing/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/activateEmail/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addConfig/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addDeviceRepair/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addDeviceToStructureForHousehold/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addFault/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addFaultOrder/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addFaultPlan/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addFaultRepairSteps/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addHouseholdEvaluation/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addHouseholdLeaveMessage/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addHouseholdOpinionFeedback/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addHouseholdWorkOrder/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addOnDutyInfo/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addOperRule/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
10 changes: 10 additions & 0 deletions iSolarCloud/AppService/addOrDelPsStructure/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,13 @@ func (e EndPoint) GetEndPointData() api.DataMap {
func (e EndPoint) GetEndPointDataTable() output.Table {
return e.ApiRoot.GetDataTable(e)
}

// SetFilenamePrefix - Produce filename based on area and endpoint name.
func (e EndPoint) SetFilenamePrefix(format string, args ...interface{}) string {
return e.ApiSetFilenamePrefix(format, args...)
}

// GetRequestArgNames -
func (e EndPoint) GetRequestArgNames() map[string]string {
return e.ApiGetRequestArgNames(e.Request.RequestData)
}
Loading

0 comments on commit 19351d5

Please sign in to comment.