Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MickMake committed Feb 14, 2022
1 parent 281052e commit 62af223
Show file tree
Hide file tree
Showing 51 changed files with 2,493 additions and 2,269 deletions.
153 changes: 111 additions & 42 deletions .idea/workspace.xml

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion cmd/cmd_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"GoSungro/Only"
"GoSungro/iSolarCloud/sungro/AppService/login"
"fmt"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -56,7 +57,7 @@ func cmdApiListFunc(cmd *cobra.Command, args []string) {
Cmd.Error = SunGro.ListEndpoints("")

case args[0] == "areas":
Cmd.Error = SunGro.ListAreas()
SunGro.ListAreas()

default:
Cmd.Error = SunGro.ListEndpoints(args[0])
Expand Down Expand Up @@ -86,8 +87,18 @@ func cmdApiGetFunc(cmd *cobra.Command, args []string) {
args[1] = "AppService"
}

// foo := AppService.Init()
// bar := foo.GetEndPoints()
// fmt.Printf("%v\n", bar)
hey := SunGro.GetEndpoint(args[1], args[0])
hey.SetRequest(login.Request {
UserAccount: "",
UserPassword: "",
})
fmt.Printf("HEY:%v\n", hey)
fmt.Printf("HEY:%v\n", hey.GetError())
fmt.Printf("HEY:%s\n", hey.GetRequest())
fmt.Printf("HEY:%s\n", hey.GetData())
if Cmd.Error != nil {
break
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cmd

import (
"GoSungro/Only"
"GoSungro/iSolarCloud"
"GoSungro/iSolarCloud/sungro"
"GoSungro/mmGit"
"fmt"
"github.com/spf13/cobra"
Expand All @@ -14,7 +14,7 @@ import (
)


var SunGro *iSolarCloud.SunGro
var SunGro *sungro.SunGro
var Git *mmGit.Git
var Cmd CommandArgs
var rootViper *viper.Viper
Expand Down
43 changes: 19 additions & 24 deletions cmd/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package cmd

import (
"GoSungro/Only"
"GoSungro/google"
"GoSungro/iSolarCloud"
"GoSungro/iSolarCloud/web"
"GoSungro/iSolarCloud/sungro"
"GoSungro/iSolarCloud/sungro/web"
"GoSungro/lsgo"
"GoSungro/mmGit"
"errors"
Expand Down Expand Up @@ -107,7 +106,7 @@ func (ca *CommandArgs) ProcessArgs(cmd *cobra.Command, args []string) error {
for range Only.Once {
ca.Args = args

SunGro = iSolarCloud.NewSunGro(ca.ApiUrl)
SunGro = sungro.NewSunGro(ca.ApiUrl)
if SunGro.Error != nil {
break
}
Expand All @@ -133,9 +132,9 @@ func (ca *CommandArgs) ProcessArgs(cmd *cobra.Command, args []string) error {
ca.Error = writeConfig()
}

if Cmd.GoogleSheetUpdate {
SunGro.OutputType = iSolarCloud.TypeGoogle
}
// if Cmd.GoogleSheetUpdate {
// SunGro.OutputType = iSolarCloud.TypeGoogle
// }

//Git.Error = Cmd.GitSet()
//if Cmd.Error != nil {
Expand Down Expand Up @@ -256,14 +255,12 @@ func (ca *CommandArgs) GitSave(entities ...string) error {
fmt.Printf("Saving %d entities from the SunGro to Git...\n", len(entities))

//SunGro.OutputType = iSolarCloud.StringTypeJson
SunGro.OutputType = iSolarCloud.TypeJson
//domain := SunGro.VerifyDomain("")
//user := SunGro.VerifyUser("")
// SunGro.OutputType = iSolarCloud.TypeJson

for _, entity := range entities {
// Remove plurals.
entity = strings.TrimSuffix(entity, "s")
SunGro.OutputString = ""
// SunGro.OutputString = ""

switch entity {
case "domain":
Expand All @@ -274,7 +271,7 @@ func (ca *CommandArgs) GitSave(entities ...string) error {
}

jf := AddJsonSuffix(entity)
Cmd.Error = Git.SaveFile(jf, []byte(SunGro.OutputString))
Cmd.Error = Git.SaveFile(jf, []byte(ca.OutputFile))
if Cmd.Error != nil {
break
}
Expand All @@ -290,9 +287,7 @@ func (ca *CommandArgs) GitSave(entities ...string) error {
func (ca *CommandArgs) GoogleUpdate(entities ...string) error {

for range Only.Once {
SunGro.OutputType = iSolarCloud.TypeGoogle
//domain := SunGro.VerifyDomain("")
//user := SunGro.VerifyUser("")
// SunGro.OutputType = iSolarCloud.TypeGoogle

if len(entities) == 0 {
entities = DefaultAreas
Expand All @@ -308,15 +303,15 @@ func (ca *CommandArgs) GoogleUpdate(entities ...string) error {
}
}

sheet := google.Sheet {
Id: "",
Credentials: nil,
SheetName: entity,
Range: "",
Data: SunGro.OutputArray,
}
sheet.Set(sheet)
ca.Error = sheet.WriteSheet()
// sheet := google.Sheet {
// Id: "",
// Credentials: nil,
// SheetName: entity,
// Range: "",
// Data: ca.OutputFile,
// }
// sheet.Set(sheet)
// ca.Error = sheet.WriteSheet()
if ca.Error != nil {
break
}
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ require (
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/ungerik/pkgreflect v0.0.0-20170905122726-bfeb2a931863 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ungerik/pkgreflect v0.0.0-20170905122726-bfeb2a931863 h1:dHyLkSlucRGhdxes0MgPD3ssqaKuP/UgatG9Y+MtHT4=
github.com/ungerik/pkgreflect v0.0.0-20170905122726-bfeb2a931863/go.mod h1:7BUOYDBcsUKbB1yDwkUV8YpTj4Z5jEylGg9rvcRXR3A=
github.com/willf/pad v0.0.0-20200313202418-172aa767f2a4 h1:Y+IMUhhlO9FLTZpNrUAMWOr7Lh0tHDKu0nrDVhp6A7o=
github.com/willf/pad v0.0.0-20200313202418-172aa767f2a4/go.mod h1:+pVHwmjc9CH7ugBFxESIwQkXkVj0gUj4cFp63TLwP1Y=
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
Expand Down

This file was deleted.

33 changes: 0 additions & 33 deletions iSolarCloud/AppService/getPowerDevicePointNames/init.go

This file was deleted.

21 changes: 0 additions & 21 deletions iSolarCloud/AppService/getPowerDevicePointNames/pkgreflect.go

This file was deleted.

0 comments on commit 62af223

Please sign in to comment.