This commit is contained in:
MickMake 2022-02-22 10:56:05 +11:00
parent 55a2c00316
commit 1f12cb82df
1233 changed files with 4183 additions and 5975 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
bin/GoSungro
bin/GoSungrow

View File

@ -1,5 +1,5 @@
################################################################################
project_name: GoSungro
project_name: GoSungrow
################################################################################
@ -14,7 +14,7 @@ builds:
- env:
- CGO_ENABLED=0
binary: GoSungro
binary: GoSungrow
goos:
- linux
@ -33,7 +33,7 @@ archives:
-
# ID of this archive.
# Defaults to `default`.
#id: GoSungro-archive
#id: GoSungrow-archive
# Builds reference which build instances should be archived in this archive.
#builds:

7
.idea/codeStyles/Project.xml generated Normal file
View File

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<GoCodeStyleSettings>
<option name="LOCAL_PACKAGE_PREFIXES" />
</GoCodeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

1282
.idea/workspace.xml generated

File diff suppressed because it is too large Load Diff

View File

@ -31,15 +31,15 @@ ENV SUNGRO_DIFF_CMD ${SUNGRO_DIFF_CMD}
ARG TZ
ENV TZ ${TZ}
COPY dist/GoSungro_linux_amd64/GoSungro /usr/local/bin/GoSungro
COPY dist/GoSungrow_linux_amd64/GoSungrow /usr/local/bin/GoSungrow
COPY .ssh/ /root/.ssh/
RUN chmod a+x /usr/local/bin/GoSungro && \
RUN chmod a+x /usr/local/bin/GoSungrow && \
chmod 500 /root/.ssh && \
chmod 400 /root/.ssh/gosungro_rsa /root/.ssh/gosungro_rsa.pub && \
apk add --no-cache colordiff tzdata
# echo '00 07 * * * /usr/local/bin/GoSungro sync default' > /etc/crontabs/root
# echo '00 07 * * * /usr/local/bin/GoSungrow sync default' > /etc/crontabs/root
#ENTRYPOINT ["/usr/local/bin/GoSungro"]
#ENTRYPOINT ["/usr/local/bin/GoSungrow"]
#CMD ["crond", "-f", "-l", "2", "-L", "/var/log/cronlogs"]
CMD ["/usr/local/bin/GoSungro", "cron", "run", "00", "07", ".", ".", ".", "sync", "default"]
CMD ["/usr/local/bin/GoSungrow", "cron", "run", "00", "07", ".", ".", ".", "sync", "default"]

View File

@ -34,7 +34,7 @@ ENV TZ ${TZ}
RUN wget -O /DockerfileRemote.sh --header "PRIVATE-TOKEN: ${GO_REPO_TOKEN}" https://mickmake.io/api/v4/projects/docker%2Fsungro//repository/files/Dockerfile.sh/raw?ref=master && \
/bin/sh /DockerfileRemote.sh
#ENTRYPOINT ["/usr/local/bin/GoSungro"]
#ENTRYPOINT ["/usr/local/bin/GoSungrow"]
#CMD ["crond", "-f", "-l", "2", "-L", "/var/log/cronlogs"]
CMD ["/usr/local/bin/GoSungro", "cron", "run", "00", "07", ".", ".", ".", "sync", "default"]
CMD ["/usr/local/bin/GoSungrow", "cron", "run", "00", "07", ".", ".", ".", "sync", "default"]

View File

@ -2,8 +2,8 @@
mkdir -p /usr/local/bin
wget -O /usr/local/bin/GoSungro --header "PRIVATE-TOKEN: ${GO_REPO_TOKEN}" https://mickmake.io/api/v4/projects/docker%2Fsungro/repository/files/dist%2FGoSungro_linux_amd64%2FGoSungro/raw?ref=master
chmod a+x /usr/local/bin/GoSungro
wget -O /usr/local/bin/GoSungrow --header "PRIVATE-TOKEN: ${GO_REPO_TOKEN}" https://mickmake.io/api/v4/projects/docker%2Fsungro/repository/files/dist%2FGoSungrow_linux_amd64%2FGoSungrow/raw?ref=master
chmod a+x /usr/local/bin/GoSungrow
mkdir -p /root/.ssh
chmod 500 /root/.ssh
@ -13,7 +13,7 @@ wget -O /root/.ssh/gosungro_rsa.pub --header "PRIVATE-TOKEN: ${GO_REPO_TOKEN}" h
chmod 400 /root/.ssh/gosungro_rsa /root/.ssh/gosungro_rsa.pub
echo '00 07 * * * /usr/local/bin/GoSungro sync default' > /etc/crontabs/root
echo '00 07 * * * /usr/local/bin/GoSungrow sync default' > /etc/crontabs/root
apk add --no-cache colordiff tzdata

108
README.md
View File

@ -1,4 +1,4 @@
# GoSungro - iSolarCloud API written in GoLang.
# GoSungrow - iSolarCloud API written in GoLang.
## What is it?
@ -9,9 +9,9 @@ Note:
- [iSolarCloud](https://isolarcloud.com) has no interest in developing a public API.
- Their "API" implementation is so broken with security and coding issues, I'm surprised it hasn't been exploited yet.
![alt text](https://github.com/MickMake/GoSungro/blob/master/docs/iSolarCloudLogin.png?raw=true)
![alt text](https://github.com/MickMake/GoSungrow/blob/master/docs/iSolarCloudLogin.png?raw=true)
![alt text](https://github.com/MickMake/GoSungro/blob/master/docs/iSolarCloud.png?raw=true)
![alt text](https://github.com/MickMake/GoSungrow/blob/master/docs/iSolarCloud.png?raw=true)
## What state is it in?
@ -26,8 +26,8 @@ It's tricky as their "API" changes regularly.
## What does it do?
This GoLang package does several things:
1. Update a GitHub repo with SunGro PV data, (provide full revision history for any changes made to the SunGro PV).
2. Update a Google sheet with SunGro PV data.
1. Update a GitHub repo with SunGrow PV data, (provide full revision history for any changes made to the SunGrow PV).
2. Update a Google sheet with SunGrow PV data.
3. Provides ready access to all API calls via a simple get/put framework.
To be added:
@ -38,36 +38,38 @@ To be added:
### Fetch PV data from the API.
```
./bin/GoSungro api get findPsType '{"ps_id":"1129147"}'
./bin/GoSungro api get getPsDetailWithPsType '{"ps_id":"1129147"}'
./bin/GoSungro api get getPowerStatistics '{"ps_id":"1129147"}'
./bin/GoSungro api get getPowerDevicePointNames '{"device_type":"1"}'
./bin/GoSungro api get getPowerDevicePointNames '{"device_type":"2"}'
./bin/GoSungro api get getPowerDevicePointNames '{"device_type":"7"}'
./bin/GoSungro api get getPsList
./bin/GoSungro api get WebAppService.showPSView '{"ps_id":"1129147"}'
./bin/GoSungrow api get findPsType '{"ps_id":"1129147"}'
./bin/GoSungrow api get getPsDetailWithPsType '{"ps_id":"1129147"}'
./bin/GoSungrow api get getPowerStatistics '{"ps_id":"1129147"}'
./bin/GoSungrow api get getPowerDevicePointNames '{"device_type":"1"}'
./bin/GoSungrow api get getPowerDevicePointNames '{"device_type":"2"}'
./bin/GoSungrow api get getPowerDevicePointNames '{"device_type":"7"}'
./bin/GoSungrow api get getPsList
./bin/GoSungrow api get WebAppService.showPSView '{"ps_id":"1129147"}'
./bin/GoSungrow api get queryMutiPointDataList '{"ps_key":"1129147_14_1_1,1129147_14_1_1,1129147_14_1_1,1129147_14_1_1,1129147_14_1_1,1129147_14_1_1,1129147_14_1_1,1129147_14_1_1,1129147_14_1_1,1129147_11_0_0","points":"p13150,p13126,p13142,p13143,p13019,p13141,p13121,p13003,p13149,p83106","minute_interval":"5","start_time_stamp":"20220215000000","end_time_stamp":"20220215235900", "ps_id":"1129147"}'
./bin/GoSungrow api get getHouseholdStoragePsReport '{"date_id":"2022","date_type":"4","ps_id":"1129147"}'
```
### Record statistics data from SUNGRO to GitHub. (Will clone if not existing.)
### Record statistics data from iSolarCloud to GitHub. (Will clone if not existing.)
% GoSungro git sync 'Updating statistics' statistics
% GoSungrow git sync 'Updating statistics' statistics
### Record all changes made to GitHub.
% GoSungro git sync 'Update everything'
% GoSungrow git sync 'Update everything'
### Record changes with default commit message.
% GoSungro git sync default
% GoSungrow git sync default
### Record changes made every 30 minutes.
% GoSungro cron run ./30 . . . . git sync default
% GoSungrow cron run ./30 . . . . git sync default
### List files in repo, (identical to ls).
```
% GoSungro git ls -l
% GoSungrow git ls -l
- rw- r-- r-- admin-mickh admin-mickh 51B 10.Jan'22 13:31 README.md
- rw- rw- r-- admin-mickh admin-mickh 15.60K 10.Jan'22 13:31 contact.json
- rw- rw- r-- admin-mickh admin-mickh 496B 10.Jan'22 13:31 department.json
@ -82,55 +84,55 @@ To be added:
### Show changes made to a JSON file.
% GoSungro git diff devices.json
% GoSungrow git diff devices.json
### Other available Gitlab commands.
Clone repo.
% GoSungro git clone
% GoSungrow git clone
Pull repo.
% GoSungro git pull
% GoSungrow git pull
Add files to repo.
% GoSungro git add .
% GoSungrow git add .
Push repo.
% GoSungro git push
% GoSungrow git push
Commit changes to repo.
% GoSungro git commit 'this is a commit message'
% GoSungrow git commit 'this is a commit message'
### Config file.
Show current config.
% GoSungro config read
% GoSungrow config read
Change diff command used in compares.
% GoSungro --diff-cmd='sdiff' config write
% GoSungrow --diff-cmd='sdiff' config write
Change Git repo directory.
% GoSungro --git-dir=/some/other/directory config write
% GoSungrow --git-dir=/some/other/directory config write
Change Git repo url.
% GoSungro --git-url=https://github.com/MickMake/iSolarCloudData config write
% GoSungrow --git-url=https://github.com/MickMake/iSolarCloudData config write
Change SUNGRO API token.
Change iSolarCloud API token.
% GoSungro --cf-token='this is a token string' config write
% GoSungrow --cf-token='this is a token string' config write
## Flags available for all commands:
```
--config string GoSungro: config file. (default "$HOME/.GoSungro/config.json")
--debug GoSungro: Debug mode.
--config string GoSungrow: config file. (default "$HOME/.GoSungrow/config.json")
--debug GoSungrow: Debug mode.
--diff-cmd string Git: Command for diffs. (default "tkdiff")
--git-dir string Git: Local repo directory.
--git-password string Git: Repo password.
@ -139,11 +141,11 @@ Change SUNGRO API token.
--git-token string Git: Repo token string.
--git-username string Git: Repo username.
--google-sheet string Google: Sheet URL for updates.
--host string SUNGRO: Provider API URL. (default "https://augateway.isolarcloud.com")
-p, --password string SUNGRO: Extension password.
-q, --quiet SUNGRO: Silence all messages.
--timeout duration SUNGRO: API timeout. (default 30s)
-u, --user string SUNGRO: Extension username.
--host string iSolarCloud: Provider API URL. (default "https://augateway.isolarcloud.com")
-p, --password string iSolarCloud: Extension password.
-q, --quiet iSolarCloud: Silence all messages.
--timeout duration iSolarCloud: API timeout. (default 30s)
-u, --user string iSolarCloud: Extension username.
```
## Using environment variables instad of flags.
@ -151,21 +153,21 @@ Change SUNGRO API token.
+----------------+------------+---------------------+--------------------------------+-----------------------------------------------+
| FLAG | SHORT FLAG | ENVIRONMENT | DESCRIPTION | DEFAULT |
+----------------+------------+---------------------+--------------------------------+-----------------------------------------------+
| --user | -u | SUNGRO_USER | SUNGRO: API username. | |
| --password | -p | SUNGRO_PASSWORD | SUNGRO: API password. | |
| --host | | SUNGRO_HOST | SUNGRO: Provider API URL. | https://augateway.isolarcloud.com |
| --timeout | | SUNGRO_TIMEOUT | SUNGRO: API timeout. | 30s |
| --google-sheet | | SUNGRO_GOOGLE_SHEET | Google: Sheet URL for updates. | |
| --git-repo | | SUNGRO_GIT_REPO | Git: Repo url for updates. | |
| --git-dir | | SUNGRO_GIT_DIR | Git: Local repo directory. | |
| --git-username | | SUNGRO_GIT_USERNAME | Git: Repo username. | |
| --git-password | | SUNGRO_GIT_PASSWORD | Git: Repo password. | |
| --git-sshkey | | SUNGRO_GIT_SSHKEY | Git: Repo SSH keyfile. | |
| --git-token | | SUNGRO_GIT_TOKEN | Git: Repo token string. | |
| --diff-cmd | | SUNGRO_DIFF_CMD | Git: Command for diffs. | tkdiff |
| --config | | SUNGRO_CONFIG | GoSungro: config file. | $HOME/.GoSungro/config.json |
| --debug | | SUNGRO_DEBUG | GoSungro: Debug mode. | false |
| --quiet | -q | SUNGRO_QUIET | GoSungro: Silence all messages.| false |
| --user | -u | SUNGROW_USER | SUNGRO: API username. | |
| --password | -p | SUNGROW_PASSWORD | SUNGRO: API password. | |
| --host | | SUNGROW_HOST | SUNGRO: Provider API URL. | https://augateway.isolarcloud.com |
| --timeout | | SUNGROW_TIMEOUT | SUNGRO: API timeout. | 30s |
| --google-sheet | | SUNGROW_GOOGLE_SHEET | Google: Sheet URL for updates. | |
| --git-repo | | SUNGROW_GIT_REPO | Git: Repo url for updates. | |
| --git-dir | | SUNGROW_GIT_DIR | Git: Local repo directory. | |
| --git-username | | SUNGROW_GIT_USERNAME | Git: Repo username. | |
| --git-password | | SUNGROW_GIT_PASSWORD | Git: Repo password. | |
| --git-sshkey | | SUNGROW_GIT_SSHKEY | Git: Repo SSH keyfile. | |
| --git-token | | SUNGROW_GIT_TOKEN | Git: Repo token string. | |
| --diff-cmd | | SUNGROW_DIFF_CMD | Git: Command for diffs. | tkdiff |
| --config | | SUNGROW_CONFIG | GoSungrow: config file. | $HOME/.GoSungrow/config.json |
| --debug | | SUNGROW_DEBUG | GoSungrow: Debug mode. | false |
| --quiet | -q | SUNGROW_QUIET | GoSungrow: Silence all messages.| false |
+----------------+------------+------------------+--------------------------------+--------------------------------------------------+
```

View File

@ -1,12 +1,12 @@
#!/bin/bash
SUNGRO_GIT_TOKEN="$(jq -r '."git-token"' $HOME/.GoSungro/config.json)"
SUNGRO_HOST="$(jq -r '.host' $HOME/.GoSungro/config.json)"
SUNGRO_ID="$(jq -r '.id' $HOME/.GoSungro/config.json)"
SUNGRO_PASSWORD="$(jq -r '.password' $HOME/.GoSungro/config.json)"
SUNGRO_SECRET="$(jq -r '.secret' $HOME/.GoSungro/config.json)"
SUNGRO_USER="$(jq -r '.user' $HOME/.GoSungro/config.json)"
SUNGRO_GIT_REPO="$(jq -r '."git-repo"' $HOME/.GoSungro/config.json)"
SUNGRO_GIT_TOKEN="$(jq -r '."git-token"' $HOME/.GoSungrow/config.json)"
SUNGRO_HOST="$(jq -r '.host' $HOME/.GoSungrow/config.json)"
SUNGRO_ID="$(jq -r '.id' $HOME/.GoSungrow/config.json)"
SUNGRO_PASSWORD="$(jq -r '.password' $HOME/.GoSungrow/config.json)"
SUNGRO_SECRET="$(jq -r '.secret' $HOME/.GoSungrow/config.json)"
SUNGRO_USER="$(jq -r '.user' $HOME/.GoSungrow/config.json)"
SUNGRO_GIT_REPO="$(jq -r '."git-repo"' $HOME/.GoSungrow/config.json)"
SUNGRO_GIT_DIR="/SUNGRO"
SUNGRO_DIFF_CMD="tkdiff"
# SUNGRO_GIT_TOKEN SUNGRO_HOST SUNGRO_ID SUNGRO_PASSWORD SUNGRO_SECRET SUNGRO_USER SUNGRO_DIFF_CMD
@ -25,6 +25,6 @@ docker build -t gosungro \
--build-arg "SUNGRO_DIFF_CMD=${SUNGRO_DIFF_CMD}" \
.
docker run --rm -it gosungro:latest /usr/local/bin/GoSungro help
docker run --rm -it gosungro:latest /usr/local/bin/GoSungrow help
docker run --rm -it gosungro:latest /bin/sh

View File

@ -1,110 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/contact"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasContacts = []string{"contacts"}
// ******************************************************************************** //
var cmdCountContacts = &cobra.Command{
Use: web.GetStructName(contact.Contact{}),
Aliases: aliasContacts,
Short: fmt.Sprintf("Count all Contacts"),
Long: fmt.Sprintf("Count all Contacts"),
Example: fmt.Sprintf("%s count contact", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountContactsFunc,
Args: cobra.RangeArgs(0, 2),
}
//goland:noinspection GoUnusedParameter
func cmdCountContactsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(2, args)
Cmd.Error = SunGro.CountContacts(args[0], args[1])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListContacts = &cobra.Command{
Use: web.GetStructName(contact.Contact{}),
Aliases: aliasContacts,
Short: fmt.Sprintf("* List all Contacts"),
Long: fmt.Sprintf("* List all Contacts"),
//Example: fmt.Sprintf("%s ls contact", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListContactsFunc,
Args: cobra.RangeArgs(0, 2),
}
//goland:noinspection GoUnusedParameter
func cmdListContactsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(2, args)
Cmd.Error = SunGro.ListContacts(args[0], args[1])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadContacts = &cobra.Command{
Use: web.GetStructName(contact.Contact{}),
Aliases: aliasContacts,
Short: fmt.Sprintf("Read all Contacts"),
Long: fmt.Sprintf("Read all Contacts"),
Example: fmt.Sprintf("%s ls contact", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadContactsFunc,
Args: cobra.RangeArgs(0, 2),
}
//goland:noinspection GoUnusedParameter
func cmdReadContactsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(2, args)
Cmd.Error = SunGro.ReadContacts(args[0], args[1])
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateContacts = &cobra.Command{
// Use: web.GetStructName(contact.Contact{}),
// Aliases: aliasContacts,
// Short: fmt.Sprintf("Update Google sheet: Contacts"),
// Long: fmt.Sprintf("Update Google sheet: Contacts"),
// Example: fmt.Sprintf("%s update contact", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateContactsFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateContactsFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("contact")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,110 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/department"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasDepartments = []string{"departments", "dept"}
// ******************************************************************************** //
var cmdCountDepartments = &cobra.Command{
Use: web.GetStructName(department.Department{}),
Aliases: aliasDepartments,
Short: fmt.Sprintf("* Count all departments"),
Long: fmt.Sprintf("* Count all departments "),
//Example: fmt.Sprintf("%s count departments", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountDepartmentsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountDepartmentsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.CountDepartments(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListDepartments = &cobra.Command{
Use: web.GetStructName(department.Department{}),
Aliases: aliasDepartments,
Short: fmt.Sprintf("List all departments"),
Long: fmt.Sprintf("List all departments "),
Example: fmt.Sprintf("%s ls departments", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListDepartmentsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListDepartmentsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ListDepartments(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadDepartments = &cobra.Command{
Use: web.GetStructName(department.Department{}),
Aliases: aliasDepartments,
Short: fmt.Sprintf("Read all departments"),
Long: fmt.Sprintf("Read all departments "),
Example: fmt.Sprintf("%s ls departments", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadDepartmentsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadDepartmentsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ReadDepartments(args[0])
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateDepartments = &cobra.Command{
// Use: web.GetStructName(department.Department{}),
// Aliases: aliasDepartments,
// Short: fmt.Sprintf("Update Google sheet: departments"),
// Long: fmt.Sprintf("Update Google sheet: departments "),
// Example: fmt.Sprintf("%s update departments", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateDepartmentsFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateDepartmentsFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("department")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,110 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/device"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasDevices = []string{"devices", "dev"}
// ******************************************************************************** //
var cmdCountDevices = &cobra.Command{
Use: web.GetStructName(device.Device{}),
Aliases: aliasDevices,
Short: fmt.Sprintf("Count all devices"),
Long: fmt.Sprintf("Count all devices "),
Example: fmt.Sprintf("%s count devices", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountDevicesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountDevicesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.CountDevices(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListDevices = &cobra.Command{
Use: web.GetStructName(device.Device{}),
Aliases: aliasDevices,
Short: fmt.Sprintf("List all devices"),
Long: fmt.Sprintf("List all devices "),
Example: fmt.Sprintf("%s ls devices", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListDevicesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListDevicesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ListDevices(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadDevices = &cobra.Command{
Use: web.GetStructName(device.Device{}),
Aliases: aliasDevices,
Short: fmt.Sprintf("Read all device models"),
Long: fmt.Sprintf("Read all device models "),
Example: fmt.Sprintf("%s read models", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadDevicesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadDevicesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ReadDevices(args[0])
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateDevices = &cobra.Command{
// Use: web.GetStructName(device.Device{}),
// Aliases: aliasDevices,
// Short: fmt.Sprintf("Update Google sheet: devices"),
// Long: fmt.Sprintf("Update Google sheet: devices "),
// Example: fmt.Sprintf("%s update devices", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run:cmdUpdateDevicesFunc,
// Args: cobra.RangeArgs(0, 1),
//}
////goland:noinspection GoUnusedParameter
//func cmdUpdateDevicesFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("device")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,107 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/deviceModel"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasModels = []string{"models", "mod"}
// ******************************************************************************** //
var cmdCountModels = &cobra.Command{
Use: web.GetStructName(deviceModel.Model{}),
Aliases: aliasModels,
Short: fmt.Sprintf("Count all device models"),
Long: fmt.Sprintf("Count all device models "),
Example: fmt.Sprintf("%s count models", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountModelsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountModelsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.CountModels()
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListModels = &cobra.Command{
Use: web.GetStructName(deviceModel.Model{}),
Aliases: aliasModels,
Short: fmt.Sprintf("List all device models"),
Long: fmt.Sprintf("List all device models "),
Example: fmt.Sprintf("%s ls models", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListModelsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListModelsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.ListModels()
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadModels = &cobra.Command{
Use: web.GetStructName(deviceModel.Model{}),
Aliases: aliasModels,
Short: fmt.Sprintf("Read all device profiles"),
Long: fmt.Sprintf("Read all device profiles"),
Example: fmt.Sprintf("%s read profiles", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadModelsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadModelsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.ReadModels()
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateModels = &cobra.Command{
// Use: web.GetStructName(deviceModel.Model{}),
// Aliases: aliasModels,
// Short: fmt.Sprintf("Update Google sheet: device models"),
// Long: fmt.Sprintf("Update Google sheet: device models "),
// Example: fmt.Sprintf("%s update models", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateModelsFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateModelsFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("model")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,107 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/deviceProfile"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasProfiles = []string{"profiles", "prof"}
// ******************************************************************************** //
var cmdCountProfiles = &cobra.Command{
Use: web.GetStructName(deviceProfile.Profile{}),
Aliases: aliasProfiles,
Short: fmt.Sprintf("Count all device profiles"),
Long: fmt.Sprintf("Count all device profiles"),
Example: fmt.Sprintf("%s count profiles", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountProfilesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountProfilesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.CountProfiles()
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListProfiles = &cobra.Command{
Use: web.GetStructName(deviceProfile.Profile{}),
Aliases: aliasProfiles,
Short: fmt.Sprintf("* List all device profiles"),
Long: fmt.Sprintf("* List all device profiles"),
//Example: fmt.Sprintf("%s ls profiles", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListProfilesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListProfilesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.ListProfiles()
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadProfiles = &cobra.Command{
Use: web.GetStructName(deviceProfile.Profile{}),
Aliases: aliasProfiles,
Short: fmt.Sprintf("Read all device profiles"),
Long: fmt.Sprintf("Read all device profiles"),
Example: fmt.Sprintf("%s ls profiles", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadProfilesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadProfilesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.ReadProfiles()
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateProfiles = &cobra.Command{
// Use: web.GetStructName(deviceProfile.Profile{}),
// Aliases: aliasProfiles,
// Short: fmt.Sprintf("Update Google sheet: device profiles"),
// Long: fmt.Sprintf("Update Google sheet: device profiles"),
// Example: fmt.Sprintf("%s update profiles", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateProfilesFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateProfilesFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("profile")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,110 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/domain"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasDomains = []string{"domains"}
// ******************************************************************************** //
var cmdCountDomain = &cobra.Command{
Use: web.GetStructName(domain.Domain{}),
Aliases: aliasDomains,
Short: fmt.Sprintf("Count info on domain."),
Long: fmt.Sprintf("Count info on domain. "),
Example: fmt.Sprintf("%s count domain", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountDomainFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountDomainFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.CountDomain(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListDomain = &cobra.Command{
Use: web.GetStructName(domain.Domain{}),
Aliases: aliasDomains,
Short: fmt.Sprintf("* List info on domain."),
Long: fmt.Sprintf("* List info on domain. "),
//Example: fmt.Sprintf("%s ls domain", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListDomainFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListDomainFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ListDomain(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadDomain = &cobra.Command{
Use: web.GetStructName(domain.Domain{}),
Aliases: aliasDomains,
Short: fmt.Sprintf("Read all Domains"),
Long: fmt.Sprintf("Read all Domains"),
Example: fmt.Sprintf("%s read contact", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadDomainsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadDomainsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ReadDomain(args[0])
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateDomain = &cobra.Command{
// Use: web.GetStructName(domain.ApiAppKey{}),
// Aliases: aliasDomains,
// Short: fmt.Sprintf("Update Google sheet: domain."),
// Long: fmt.Sprintf("Update Google sheet: domain. "),
// Example: fmt.Sprintf("%s update domain", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateDomainFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateDomainFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("domain")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,110 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/mac"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasMacs = []string{"macs"}
// ******************************************************************************** //
var cmdCountMacs = &cobra.Command{
Use: web.GetStructName(mac.Mac{}),
Aliases: aliasMacs,
Short: fmt.Sprintf("Count all Macs"),
Long: fmt.Sprintf("Count all Macs"),
Example: fmt.Sprintf("%s count mac", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountMacsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountMacsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.CountMacs(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListMacs = &cobra.Command{
Use: web.GetStructName(mac.Mac{}),
Aliases: aliasMacs,
Short: fmt.Sprintf("List all Macs"),
Long: fmt.Sprintf("List all Macs"),
Example: fmt.Sprintf("%s ls mac", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListMacsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListMacsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ListMacs(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadMacs = &cobra.Command{
Use: web.GetStructName(mac.Mac{}),
Aliases: aliasMacs,
Short: fmt.Sprintf("Read all Macs"),
Long: fmt.Sprintf("Read all Macs"),
Example: fmt.Sprintf("%s read mac", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadMacsFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadMacsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ReadMacs(args[0])
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateMacs = &cobra.Command{
// Use: web.GetStructName(mac.Mac{}),
// Aliases: aliasMacs,
// Short: fmt.Sprintf("Update Google sheet: Macs"),
// Long: fmt.Sprintf("Update Google sheet: Macs"),
// Example: fmt.Sprintf("%s update ndp", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateMacsFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateMacsFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("macs")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,108 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/ndpServer"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasNdpServers = []string{"ndpservers", "ndp"}
// ******************************************************************************** //
var cmdCountNdpServers = &cobra.Command{
Use: web.GetStructName(ndpServer.Ndp{}),
Aliases: aliasNdpServers,
Short: fmt.Sprintf("Count all NdpServers"),
Long: fmt.Sprintf("Count all NdpServers"),
Example: fmt.Sprintf("%s count ndp", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountNdpServersFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountNdpServersFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.CountNdpServers()
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListNdpServers = &cobra.Command{
Use: web.GetStructName(ndpServer.Ndp{}),
Aliases: aliasNdpServers,
Short: fmt.Sprintf("List all NdpServers"),
Long: fmt.Sprintf("List all NdpServers"),
Example: fmt.Sprintf("%s ls ndp", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListNdpServersFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListNdpServersFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.ListNdpServer()
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadNdpServers = &cobra.Command{
Use: web.GetStructName(ndpServer.Ndp{}),
Aliases: aliasNdpServers,
Short: fmt.Sprintf("Read all NdpServers"),
Long: fmt.Sprintf("Read all NdpServers"),
Example: fmt.Sprintf("%s read profiles", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadNdpServersFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadNdpServersFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.ReadNdpServer()
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateNdpServers = &cobra.Command{
// Use: web.GetStructName(ndpServer.Ndp{}),
// Aliases: aliasNdpServers,
// Short: fmt.Sprintf("Update Google sheet: NdpServers"),
// Long: fmt.Sprintf("Update Google sheet: NdpServers"),
// Example: fmt.Sprintf("%s update ndp", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateNdpServersFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateNdpServersFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("ndpserver")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,110 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/presence"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasPresence = []string{"state", "online"}
// ******************************************************************************** //
var cmdCountPresence = &cobra.Command{
Use: web.GetStructName(presence.Presence{}),
Aliases: aliasPresence,
Short: fmt.Sprintf("* Count all presence"),
Long: fmt.Sprintf("* Count all presence "),
//Example: fmt.Sprintf("%s count presence", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountPresenceFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountPresenceFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.CountPresence(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListPresence = &cobra.Command{
Use: web.GetStructName(presence.Presence{}),
Aliases: aliasPresence,
Short: fmt.Sprintf("List all presence"),
Long: fmt.Sprintf("List all presence "),
Example: fmt.Sprintf("%s ls presence", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListPresenceFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListPresenceFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ListPresence(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadPresence = &cobra.Command{
Use: web.GetStructName(presence.Presence{}),
Aliases: aliasPresence,
Short: fmt.Sprintf("* Read all presence"),
Long: fmt.Sprintf("* Read all presence "),
//Example: fmt.Sprintf("%s ls presence", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadPresenceFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadPresenceFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ReadPresence(args[0])
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdatePresence = &cobra.Command{
// Use: web.GetStructName(presence.Presence{}),
// Aliases: aliasPresence,
// Short: fmt.Sprintf("Update Google sheet: presence"),
// Long: fmt.Sprintf("Update Google sheet: presence "),
// Example: fmt.Sprintf("%s update presence", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdatePresenceFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdatePresenceFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("presence")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,110 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/site"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasSites = []string{"sites"}
// ******************************************************************************** //
var cmdCountSites = &cobra.Command{
Use: web.GetStructName(site.Site{}),
Aliases: aliasSites,
Short: fmt.Sprintf("Count all sites"),
Long: fmt.Sprintf("Count all sites "),
Example: fmt.Sprintf("%s count sites", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountSitesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountSitesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.CountSites(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListSites = &cobra.Command{
Use: web.GetStructName(site.Site{}),
Aliases: aliasSites,
Short: fmt.Sprintf("List all sites"),
Long: fmt.Sprintf("List all sites "),
Example: fmt.Sprintf("%s ls sites", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListSitesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListSitesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ListSites(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadSites = &cobra.Command{
Use: web.GetStructName(site.Site{}),
Aliases: aliasSites,
Short: fmt.Sprintf("Read all sites"),
Long: fmt.Sprintf("Read all sites "),
Example: fmt.Sprintf("%s read sites", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadSitesFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdReadSitesFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ReadSites(args[0])
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateSites = &cobra.Command{
// Use: web.GetStructName(site.Site{}),
// Aliases: aliasSites,
// Short: fmt.Sprintf("Update Google sheet: sites"),
// Long: fmt.Sprintf("Update Google sheet: sites "),
// Example: fmt.Sprintf("%s update sites", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateSitesFunc,
// Args: cobra.RangeArgs(0, 2),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateSitesFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("site")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,110 +0,0 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/subscriber"
"GoSungro/iSolarCloud/web"
"fmt"
"github.com/spf13/cobra"
)
var aliasSubscribers = []string{"users", "user", "subscribers", "sub"}
// ******************************************************************************** //
var cmdCountUsers = &cobra.Command{
Use: web.GetStructName(subscriber.Subscriber{}),
Aliases: aliasSubscribers,
Short: fmt.Sprintf("Count all users"),
Long: fmt.Sprintf("Count all users "),
Example: fmt.Sprintf("%s count users", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdCountUsersFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdCountUsersFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.CountUsers(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdListUsers = &cobra.Command{
Use: web.GetStructName(subscriber.Subscriber{}),
Aliases: aliasSubscribers,
Short: fmt.Sprintf("List all users"),
Long: fmt.Sprintf("List all users "),
Example: fmt.Sprintf("%s ls users", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdListUsersFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdListUsersFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(1, args)
Cmd.Error = SunGro.ListUsers(args[0])
if Cmd.Error != nil {
break
}
}
}
// ******************************************************************************** //
var cmdReadUsers = &cobra.Command{
Use: web.GetStructName(subscriber.Subscriber{}),
Aliases: aliasSubscribers,
Short: fmt.Sprintf("Read all users"),
Long: fmt.Sprintf("Read all users "),
Example: fmt.Sprintf("%s ls users", DefaultBinaryName),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdReadUsersFunc,
Args: cobra.RangeArgs(0, 2),
}
//goland:noinspection GoUnusedParameter
func cmdReadUsersFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
args = fillArray(2, args)
Cmd.Error = SunGro.ReadUsers(args[0], args[1])
if Cmd.Error != nil {
break
}
}
}
//// ******************************************************************************** //
//var cmdUpdateUsers = &cobra.Command{
// Use: web.GetStructName(subscriber.Subscriber{}),
// Aliases: aliasSubscribers,
// Short: fmt.Sprintf("Update Google sheet: users"),
// Long: fmt.Sprintf("Update Google sheet: users "),
// Example: fmt.Sprintf("%s update users", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdUpdateUsersFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdUpdateUsersFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// Cmd.Error = Cmd.GoogleUpdate("user")
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,16 +1,15 @@
package cmd
import (
"GoSungro/Only"
"GoSungrow/Only"
"fmt"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command {
var rootCmd = &cobra.Command{
Use: DefaultBinaryName,
Short: fmt.Sprintf("%s - Manage an SunGro instance", DefaultBinaryName),
Long: fmt.Sprintf("%s - Manage an SunGro instance", DefaultBinaryName),
Short: fmt.Sprintf("%s - Manage an SunGrow instance", DefaultBinaryName),
Long: fmt.Sprintf("%s - Manage an SunGrow instance", DefaultBinaryName),
Run: gbRootFunc,
TraverseChildren: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
@ -18,6 +17,7 @@ var rootCmd = &cobra.Command {
return initConfig(cmd)
},
}
func gbRootFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
if len(args) == 0 {

View File

@ -1,9 +1,9 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/sungro/AppService/login"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/sungro/AppService/login"
"fmt"
"github.com/spf13/cobra"
)
@ -12,14 +12,14 @@ import (
var cmdApi = &cobra.Command{
Use: "api",
Aliases: []string{},
Short: fmt.Sprintf("Interact with the SunGro api."),
Long: fmt.Sprintf("Interact with the SunGro api."),
Short: fmt.Sprintf("Interact with the SunGrow api."),
Long: fmt.Sprintf("Interact with the SunGrow api."),
Example: PrintExamples("api", "get <endpoint>", "put <endpoint>"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
Run: cmdApiFunc,
Args: cobra.MinimumNArgs(1),
PreRunE: Cmd.ProcessArgs,
Run: cmdApiFunc,
Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
@ -41,7 +41,7 @@ var cmdApiList = &cobra.Command{
Example: PrintExamples("api ls", "", "areas", "endpoints", "<area name>"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
PreRunE: Cmd.SunGrowArgs,
Run: cmdApiListFunc,
Args: cobra.RangeArgs(0, 1),
}
@ -55,13 +55,13 @@ func cmdApiListFunc(cmd *cobra.Command, args []string) {
_ = cmd.Help()
case args[0] == "endpoints":
Cmd.Error = SunGro.ListEndpoints("")
Cmd.Error = SunGrow.ListEndpoints("")
case args[0] == "areas":
SunGro.ListAreas()
SunGrow.ListAreas()
default:
Cmd.Error = SunGro.ListEndpoints(args[0])
Cmd.Error = SunGrow.ListEndpoints(args[0])
}
}
}
@ -75,7 +75,7 @@ var cmdApiGet = &cobra.Command{
Example: PrintExamples("api get", "<endpoint> [area]"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
PreRunE: Cmd.SunGrowArgs,
Run: cmdApiGetFunc,
Args: cobra.MinimumNArgs(1),
}
@ -88,9 +88,9 @@ func cmdApiGetFunc(cmd *cobra.Command, args []string) {
// args[1] = "{}"
// }
ep := SunGro.GetEndpoint(args[0])
if SunGro.Error != nil {
Cmd.Error = SunGro.Error
ep := SunGrow.GetEndpoint(args[0])
if SunGrow.Error != nil {
Cmd.Error = SunGrow.Error
break
}
if ep.IsError() {
@ -134,7 +134,7 @@ var cmdApiLogin = &cobra.Command{
Example: PrintExamples("api login", ""),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
PreRunE: Cmd.SunGrowArgs,
Run: cmdApiLoginFunc,
Args: cobra.MinimumNArgs(0),
}
@ -142,7 +142,7 @@ var cmdApiLogin = &cobra.Command{
//goland:noinspection GoUnusedParameter
func cmdApiLoginFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.Login(login.SunGroAuth{
Cmd.Error = SunGrow.Login(login.SunGrowAuth{
AppKey: Cmd.ApiAppKey,
UserAccount: Cmd.ApiUsername,
UserPassword: Cmd.ApiPassword,
@ -153,11 +153,11 @@ func cmdApiLoginFunc(cmd *cobra.Command, args []string) {
break
}
SunGro.Auth.Print()
SunGrow.Auth.Print()
if SunGro.HasTokenChanged() {
Cmd.ApiLastLogin = SunGro.GetLastLogin()
Cmd.ApiToken = SunGro.GetToken()
if SunGrow.HasTokenChanged() {
Cmd.ApiLastLogin = SunGrow.GetLastLogin()
Cmd.ApiToken = SunGrow.GetToken()
Cmd.Error = writeConfig()
}
}
@ -172,7 +172,7 @@ var cmdApiPut = &cobra.Command{
Example: PrintExamples("api put", "<endpoint> <value>"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
PreRunE: Cmd.SunGrowArgs,
Run: cmdApiPutFunc,
Args: cobra.RangeArgs(0, 1),
}
@ -182,7 +182,7 @@ func cmdApiPutFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
fmt.Println("Not yet implemented.")
// args = fillArray(1, args)
// Cmd.Error = SunGro.Init()
// Cmd.Error = SunGrow.Init()
// if Cmd.Error != nil {
// break
// }

View File

@ -1,79 +0,0 @@
package cmd
//
//var aliasCharts = []string{"charts"}
//
//// ******************************************************************************** //
//var cmdCountCharts = &cobra.Command{
// Use: web.GetStructName(domain.Domain{}),
// Aliases: aliasCharts,
// Short: fmt.Sprintf("Count all Charts"),
// Long: fmt.Sprintf("Count all Charts"),
// Example: fmt.Sprintf("%s count contact", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdCountChartsFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdCountChartsFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// args = fillArray(1, args)
// Cmd.Error = SunGro.Init()
// if Cmd.Error != nil {
// break
// }
// }
//}
//
//// ******************************************************************************** //
//var cmdListCharts = &cobra.Command{
// Use: web.GetStructName(domain.Domain{}),
// Aliases: aliasCharts,
// Short: fmt.Sprintf("List all Charts"),
// Long: fmt.Sprintf("List all Charts"),
// Example: fmt.Sprintf("%s ls contact", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdListChartsFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdListChartsFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// args = fillArray(1, args)
// Cmd.Error = SunGro.Init()
// if Cmd.Error != nil {
// break
// }
// }
//}
//
//// ******************************************************************************** //
//var cmdReadCharts = &cobra.Command{
// Use: web.GetStructName(domain.Domain{}),
// Aliases: aliasCharts,
// Short: fmt.Sprintf("Read all Charts"),
// Long: fmt.Sprintf("Read all Charts"),
// Example: fmt.Sprintf("%s ls contact", DefaultBinaryName),
// DisableFlagParsing: false,
// DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
// Run: cmdReadChartsFunc,
// Args: cobra.RangeArgs(0, 1),
//}
//
////goland:noinspection GoUnusedParameter
//func cmdReadChartsFunc(cmd *cobra.Command, args []string) {
// for range Only.Once {
// args = fillArray(1, args)
// Cmd.Error = SunGro.Init()
// if Cmd.Error != nil {
// break
// }
// }
//}

View File

@ -1,7 +1,7 @@
package cmd
import (
"GoSungro/Only"
"GoSungrow/Only"
"fmt"
"github.com/spf13/cobra"
"os"

View File

@ -1,7 +1,7 @@
package cmd
import (
"GoSungro/Only"
"GoSungrow/Only"
"fmt"
"github.com/go-co-op/gocron"
"github.com/spf13/cobra"

View File

@ -1,27 +1,27 @@
package cmd
import (
"GoSungro/Only"
"GoSungrow/Only"
"fmt"
"github.com/spf13/cobra"
"os/user"
"strings"
)
// ******************************************************************************** //
var cmdGit = &cobra.Command{
Use: "git",
Use: "git",
//Aliases: []string{""},
Short: fmt.Sprintf("Git related commands."),
Long: fmt.Sprintf("Git related commands. "),
Example: PrintExamples("git", "clone", "ls -la", "diff generate.org.au.json", "commit"),
Example: PrintExamples("git", "clone", "ls -la", "diff foo.json", "commit"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdGitFunc,
//Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdGitFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -31,23 +31,26 @@ func cmdGitFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdSave = &cobra.Command{
Use: "save [area]",
Aliases: []string{},
Short: fmt.Sprintf("Save SunGro areas as JSON files."),
Long: fmt.Sprintf("Save SunGro areas as JSON files."),
Example: PrintExamples("save", "all", "site", "presence", "device"),
Short: fmt.Sprintf("Save SunGrow areas as JSON files."),
Long: fmt.Sprintf("Save SunGrow areas as JSON files."),
Example: PrintExamples("save", "all", "unit", "device"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdSaveFunc,
Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdSaveFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
fmt.Println("Not yet implemented.")
return
if len(args) == 0 {
args = DefaultAreas
}
@ -67,10 +70,9 @@ func cmdSaveFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGitClone = &cobra.Command{
Use: "clone",
Use: "clone",
//Aliases: []string{"ls"},
Short: fmt.Sprintf("Clone git repo."),
Long: fmt.Sprintf("Clone git repo. "),
@ -81,6 +83,7 @@ var cmdGitClone = &cobra.Command{
Run: cmdGitCloneFunc,
//Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdGitCloneFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -91,10 +94,9 @@ func cmdGitCloneFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGitCommit = &cobra.Command{
Use: "commit [message]",
Use: "commit [message]",
//Aliases: []string{"ls"},
Short: fmt.Sprintf("Commit git changes."),
Long: fmt.Sprintf("Commit git changes. "),
@ -105,6 +107,7 @@ var cmdGitCommit = &cobra.Command{
Run: cmdGitCommitFunc,
Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdGitCommitFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -126,20 +129,20 @@ func cmdGitCommitFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGitAdd = &cobra.Command{
Use: "add <filename>",
Use: "add <filename>",
//Aliases: []string{"write"},
Short: fmt.Sprintf("Add files to Git repo."),
Long: fmt.Sprintf("Add files to Git repo. "),
Example: PrintExamples("git add", ".", "generate.org.au.json"),
Example: PrintExamples("git add", ".", "foo.json"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdGitAddFunc,
Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdGitAddFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -161,10 +164,9 @@ func cmdGitAddFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGitPull = &cobra.Command{
Use: "pull",
Use: "pull",
//Aliases: []string{"write"},
Short: fmt.Sprintf("Pull Git repo."),
Long: fmt.Sprintf("Pull Git repo. "),
@ -175,6 +177,7 @@ var cmdGitPull = &cobra.Command{
Run: cmdGitPullFunc,
Args: cobra.MaximumNArgs(0),
}
//goland:noinspection GoUnusedParameter
func cmdGitPullFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -190,10 +193,9 @@ func cmdGitPullFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGitPush = &cobra.Command{
Use: "push",
Use: "push",
//Aliases: []string{"write"},
Short: fmt.Sprintf("Push Git repo."),
Long: fmt.Sprintf("Push Git repo. "),
@ -204,6 +206,7 @@ var cmdGitPush = &cobra.Command{
Run: cmdGitPushFunc,
Args: cobra.MaximumNArgs(0),
}
//goland:noinspection GoUnusedParameter
func cmdGitPushFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -219,20 +222,20 @@ func cmdGitPushFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGitDiff = &cobra.Command{
Use: "diff <filename>",
Use: "diff <filename>",
//Aliases: []string{"write"},
Short: fmt.Sprintf("Show diffs between current and last version."),
Long: fmt.Sprintf("Show diffs between current and last version. "),
Example: PrintExamples("git diff", "generate.org.au.json"),
Example: PrintExamples("git diff", "foo.json"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdGitDiffFunc,
Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdGitDiffFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -255,7 +258,6 @@ func cmdGitDiffFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGitLs = &cobra.Command{
Use: "ls <filename>",
@ -269,6 +271,7 @@ var cmdGitLs = &cobra.Command{
Run: cmdGitLsFunc,
//Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdGitLsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -280,13 +283,12 @@ func cmdGitLsFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGitSync = &cobra.Command{
Use: "sync <commit msg | default> [area]",
Aliases: []string{},
Short: fmt.Sprintf("Sync SunGro to Git repo."),
Long: fmt.Sprintf("Sync SunGro to Git repo."),
Short: fmt.Sprintf("Sync SunGrow to Git repo."),
Long: fmt.Sprintf("Sync SunGrow to Git repo."),
Example: PrintExamples("sync", "default", "'updated everything'", "'this is an update' users"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
@ -294,9 +296,13 @@ var cmdGitSync = &cobra.Command{
Run: cmdGitSyncFunc,
Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdGitSyncFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
fmt.Println("Not yet implemented.")
return
if len(args) < 1 {
Cmd.Error = cmd.Help()
break
@ -304,13 +310,13 @@ func cmdGitSyncFunc(cmd *cobra.Command, args []string) {
var msg string
switch {
case args[0] == "":
fallthrough
case args[0] == "default":
u, _ := user.Current()
msg = fmt.Sprintf("Regular sync by %s", u.Username)
default:
msg = args[0]
case args[0] == "":
fallthrough
case args[0] == "default":
u, _ := user.Current()
msg = fmt.Sprintf("Regular sync by %s", u.Username)
default:
msg = args[0]
}
args = args[1:]

View File

@ -1,28 +1,31 @@
package cmd
import (
"GoSungro/Only"
"GoSungrow/Only"
"fmt"
"github.com/spf13/cobra"
)
// ******************************************************************************** //
var cmdGoogle = &cobra.Command{
Use: "google",
//Aliases: []string{"refresh"},
Use: "google",
// Aliases: []string{"refresh"},
Short: fmt.Sprintf("Update and view Google sheets."),
Long: fmt.Sprintf("Update and view Google sheets."),
Example: PrintExamples("google", "update all", "update users"),
Example: PrintExamples("google", "update all", "update devices"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdGoogleFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdGoogleFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
fmt.Println("Not yet implemented.")
return
switch {
case len(args) == 0:
Cmd.Error = cmd.Help()
@ -37,33 +40,36 @@ func cmdGoogleFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdGoogleSync = &cobra.Command{
Use: "update",
//Aliases: []string{"refresh"},
Use: "update",
// Aliases: []string{"refresh"},
Short: fmt.Sprintf("Update Google sheets."),
Long: fmt.Sprintf("Update Google sheets."),
Example: PrintExamples("google update", "all", "presence", "user"),
Example: PrintExamples("google update", "all", "device", "unit"),
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
PreRunE: Cmd.ProcessArgs,
Run: cmdGoogleSyncFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdGoogleSyncFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
fmt.Println("Not yet implemented.")
return
switch {
case len(args) == 0:
Cmd.Error = cmd.Help()
case len(args) == 0:
Cmd.Error = cmd.Help()
case args[0] == "all":
Cmd.Error = Cmd.GoogleUpdate()
case args[0] == "all":
Cmd.Error = Cmd.GoogleUpdate()
default:
fmt.Println("Unknown sub-command.")
_ = cmd.Help()
default:
fmt.Println("Unknown sub-command.")
_ = cmd.Help()
}
}
}

View File

@ -1,7 +1,7 @@
package cmd
import (
"GoSungro/Only"
"GoSungrow/Only"
"fmt"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
@ -10,7 +10,6 @@ import (
"strings"
)
const DefaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}}
{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
@ -46,7 +45,7 @@ const DefaultFlagHelpTemplate = `{{if .HasAvailableInheritedFlags}}Flags availab
// ******************************************************************************** //
var cmdHelpFlags = &cobra.Command{
Use: "help-all",
Use: "help-all",
//Aliases: []string{"flags"},
Short: fmt.Sprintf("Extended help"),
Long: fmt.Sprintf("Extended help"),
@ -56,6 +55,7 @@ var cmdHelpFlags = &cobra.Command{
Run: cmdHelpFlagsFunc,
Args: cobra.RangeArgs(0, 0),
}
//goland:noinspection GoUnusedParameter
func cmdHelpFlagsFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -155,30 +155,30 @@ func PrintFlagEnv(flag string) string {
return ret
}
func ExtendedHelp() {
func ExtendedHelp() {
var str = `
DefaultBinaryName - Over The Wire SunGro to Gitlab syncing tool.
DefaultBinaryName - Over The Wire SunGrow to Gitlab syncing tool.
This tool does several things:
1. Pull a Gitlab repo that holds SunGro data.
2. Fetch all data available from the SunGro.
1. Pull a Gitlab repo that holds SunGrow data.
2. Fetch all data available from the SunGrow.
3. Save this data as a JSON file.
4. Commit changes to the Gitlab repo.
5. Push changes to remote.
It is intended to provide full revision history for any changes made to the SunGro.
It is intended to provide full revision history for any changes made to the SunGrow.
Use case example:
# Record changes made to user data on SunGro. (Will clone if not existing.)
# Record changes made to user data on SunGrow. (Will clone if not existing.)
% DefaultBinaryName sync 'Updated users' users
# Record changes made to all SunGro manually.
# Record changes made to all SunGrow manually.
% DefaultBinaryName sync 'Updated all zones'
# Record changes made to the SunGro with default commit message.
# Record changes made to the SunGrow with default commit message.
% DefaultBinaryName sync default
# Record changes made to the SunGro via every 30 minutes.
# Record changes made to the SunGrow via every 30 minutes.
% DefaultBinaryName cron run ./30 . . . . sync default
# Show changes made to a zone JSON file.
@ -213,7 +213,7 @@ Use case example:
Change Git repo url.
% DefaultBinaryName --git-url=https://github.com/MickMake/iSolarData config write
Change SunGro API token.
Change SunGrow API token.
% DefaultBinaryName --cf-token='this is a token string' config write
`

View File

@ -1,7 +1,7 @@
package cmd
import (
"GoSungro/Only"
"GoSungrow/Only"
"fmt"
"github.com/spf13/cobra"
)

View File

@ -1,8 +1,8 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/defaults"
"GoSungrow/Only"
"GoSungrow/defaults"
"fmt"
"github.com/spf13/cobra"
)

View File

@ -1,9 +1,9 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/sungro"
"GoSungro/mmGit"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/sungro"
"GoSungrow/mmGit"
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
@ -13,7 +13,7 @@ import (
"strings"
)
var SunGro *sungro.SunGro
var SunGrow *sungro.SunGrow
var Git *mmGit.Git
var Cmd CommandArgs
var rootViper *viper.Viper
@ -41,20 +41,20 @@ func init() {
Cmd.ConfigFile = filepath.Join(Cmd.ConfigDir, defaultConfigFile)
Cmd.ApiTokenFile = filepath.Join(Cmd.ConfigDir, defaultTokenFile)
rootCmd.PersistentFlags().StringVarP(&Cmd.ApiUsername, flagApiUsername, "u", "", fmt.Sprintf("SunGro: api username."))
rootCmd.PersistentFlags().StringVarP(&Cmd.ApiUsername, flagApiUsername, "u", "", fmt.Sprintf("SunGrow: api username."))
rootViper.SetDefault(flagApiUsername, "")
rootCmd.PersistentFlags().StringVarP(&Cmd.ApiPassword, flagApiPassword, "p", "", fmt.Sprintf("SunGro: api password."))
rootCmd.PersistentFlags().StringVarP(&Cmd.ApiPassword, flagApiPassword, "p", "", fmt.Sprintf("SunGrow: api password."))
rootViper.SetDefault(flagApiPassword, "")
rootCmd.PersistentFlags().StringVarP(&Cmd.ApiAppKey, flagApiAppKey, "", "", fmt.Sprintf("SunGro: api application key."))
rootViper.SetDefault(flagApiAppKey, "")
rootCmd.PersistentFlags().StringVarP(&Cmd.ApiAppKey, flagApiAppKey, "", defaultApiAppKey, fmt.Sprintf("SunGrow: api application key."))
rootViper.SetDefault(flagApiAppKey, defaultApiAppKey)
rootCmd.PersistentFlags().StringVarP(&Cmd.ApiUrl, flagApiUrl, "", defaultHost, fmt.Sprintf("SunGro: Provider API URL."))
rootViper.SetDefault(flagApiUrl, "")
rootCmd.PersistentFlags().DurationVarP(&Cmd.ApiTimeout, flagApiTimeout, "", defaultTimeout, fmt.Sprintf("SunGro: API timeout."))
rootViper.SetDefault(flagApiTimeout, "")
rootCmd.PersistentFlags().StringVar(&Cmd.ApiLastLogin, flagApiLastLogin, "", "SunGro: last login.")
rootCmd.PersistentFlags().StringVarP(&Cmd.ApiUrl, flagApiUrl, "", defaultHost, fmt.Sprintf("SunGrow: Provider API URL."))
rootViper.SetDefault(flagApiUrl, defaultHost)
rootCmd.PersistentFlags().DurationVarP(&Cmd.ApiTimeout, flagApiTimeout, "", defaultTimeout, fmt.Sprintf("SunGrow: API timeout."))
rootViper.SetDefault(flagApiTimeout, defaultTimeout)
rootCmd.PersistentFlags().StringVar(&Cmd.ApiLastLogin, flagApiLastLogin, "", "SunGrow: last login.")
rootViper.SetDefault(flagApiLastLogin, "")
_ = rootCmd.PersistentFlags().MarkHidden(flagApiLastLogin)
//_ = rootCmd.PersistentFlags().MarkHidden(flagApiLastLogin)
rootCmd.PersistentFlags().StringVarP(&Cmd.GoogleSheet, flagGoogleSheet, "", "", fmt.Sprintf("Google: Sheet URL for updates."))
rootViper.SetDefault(flagGoogleSheet, "")
@ -116,14 +116,15 @@ func InitCommands() error {
var err error
for range Only.Once {
rootCmd.AddCommand(cmdConfig, cmdApi, cmdGit, cmdMqtt, cmdCron, cmdVersion, cmdHelpFlags)
rootCmd.AddCommand(cmdConfig, cmdApi, cmdGit, cmdMqtt, cmdGoogle, cmdCron, cmdVersion, cmdHelpFlags)
cmdConfig.AddCommand(cmdConfigWrite, cmdConfigRead)
cmdGit.AddCommand(cmdGitSync, cmdSave, cmdGitLs, cmdGitDiff, cmdGitClone, cmdGitPull, cmdGitPush, cmdGitCommit, cmdGitAdd)
cmdGoogle.AddCommand(cmdGoogleSync)
cmdMqtt.AddCommand(cmdMqttSync)
cmdCron.AddCommand(cmdCronRun, cmdCronAdd, cmdCronRemove, cmdCronList)
cmdApi.AddCommand(cmdApiList, cmdApiLogin, cmdApiPut, cmdApiGet)
cmdApi.PersistentFlags().BoolVarP(&Cmd.ApiGetRaw, flagApiGetRaw, "", false, fmt.Sprintf("SunGro: api raw data, (not parsed nor evaluated)."))
cmdApi.PersistentFlags().BoolVarP(&Cmd.ApiGetRaw, flagApiGetRaw, "", false, fmt.Sprintf("SunGrow: api raw data, (not parsed nor evaluated)."))
rootViper.SetDefault(flagApiGetRaw, false)
// foo := rootCmd.HelpTemplate()

View File

@ -1,11 +1,11 @@
package cmd
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/sungro"
"GoSungro/iSolarCloud/sungro/AppService/login"
"GoSungro/lsgo"
"GoSungro/mmGit"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/sungro"
"GoSungrow/iSolarCloud/sungro/AppService/login"
"GoSungrow/lsgo"
"GoSungrow/mmGit"
"errors"
"fmt"
"github.com/spf13/cobra"
@ -16,8 +16,8 @@ import (
//goland:noinspection SpellCheckingInspection
const (
DefaultBinaryName = "GoSungro"
EnvPrefix = "SunGro"
DefaultBinaryName = "GoSungrow"
EnvPrefix = "SunGrow"
defaultConfigFile = "config.json"
defaultTokenFile = "AuthToken.json"
@ -44,9 +44,10 @@ const (
flagGitRepoDir = "git-dir"
flagGitDiffCmd = "diff-cmd"
defaultHost = "https://augateway.isolarcloud.com"
defaultUsername = "harry@potter.net"
defaultPassword = "hogwarts"
defaultHost = "https://augateway.isolarcloud.com"
defaultUsername = "harry@potter.net"
defaultPassword = "hogwarts"
defaultApiAppKey = "93D72E60331ABDCDC7B39ADC2D1F32B3"
defaultTimeout = time.Duration(time.Second * 30)
)
@ -103,22 +104,47 @@ func (ca *CommandArgs) IsValid() error {
return ca.Error
}
//goland:noinspection GoUnusedParameter
func (ca *CommandArgs) ProcessArgs(cmd *cobra.Command, args []string) error {
for range Only.Once {
ca.Args = args
SunGro = sungro.NewSunGro(ca.ApiUrl)
if SunGro.Error != nil {
SunGrow = sungro.NewSunGro(ca.ApiUrl)
if SunGrow.Error != nil {
break
}
Cmd.Error = SunGro.Init()
Cmd.Error = SunGrow.Init()
if Cmd.Error != nil {
break
}
Cmd.Error = SunGro.Login(login.SunGroAuth{
if ca.ApiAppKey == "" {
ca.ApiAppKey = defaultApiAppKey
}
// if Cmd.GoogleSheetUpdate {
// SunGrow.OutputType = iSolarCloud.TypeGoogle
// }
// Git.Error = Cmd.GitSet()
// if Cmd.Error != nil {
// break
// }
ca.Valid = true
}
return ca.Error
}
func (ca *CommandArgs) SunGrowArgs(cmd *cobra.Command, args []string) error {
for range Only.Once {
Cmd.Error = Cmd.ProcessArgs(cmd, args)
if Cmd.Error != nil {
break
}
Cmd.Error = SunGrow.Login(login.SunGrowAuth{
AppKey: ca.ApiAppKey,
UserAccount: ca.ApiUsername,
UserPassword: ca.ApiPassword,
@ -130,17 +156,17 @@ func (ca *CommandArgs) ProcessArgs(cmd *cobra.Command, args []string) error {
}
if Cmd.Debug {
SunGro.Auth.Print()
SunGrow.Auth.Print()
}
if SunGro.HasTokenChanged() {
ca.ApiLastLogin = SunGro.GetLastLogin()
ca.ApiToken = SunGro.GetToken()
if SunGrow.HasTokenChanged() {
ca.ApiLastLogin = SunGrow.GetLastLogin()
ca.ApiToken = SunGrow.GetToken()
ca.Error = writeConfig()
}
// if Cmd.GoogleSheetUpdate {
// SunGro.OutputType = iSolarCloud.TypeGoogle
// SunGrow.OutputType = iSolarCloud.TypeGoogle
// }
// Git.Error = Cmd.GitSet()
@ -259,21 +285,21 @@ func (ca *CommandArgs) GitSave(entities ...string) error {
if len(entities) == 0 {
entities = DefaultAreas
}
fmt.Printf("Saving %d entities from the SunGro to Git...\n", len(entities))
fmt.Printf("Saving %d entities from the SunGrow to Git...\n", len(entities))
// SunGro.OutputType = iSolarCloud.StringTypeJson
// SunGro.OutputType = iSolarCloud.TypeJson
// SunGrow.OutputType = iSolarCloud.StringTypeJson
// SunGrow.OutputType = iSolarCloud.TypeJson
for _, entity := range entities {
// Remove plurals.
entity = strings.TrimSuffix(entity, "s")
// SunGro.OutputString = ""
// SunGrow.OutputString = ""
switch entity {
case "domain":
SunGro.Error = SunGro.Init()
SunGrow.Error = SunGrow.Init()
}
if SunGro.Error != nil {
if SunGrow.Error != nil {
break
}
@ -293,17 +319,17 @@ func (ca *CommandArgs) GitSave(entities ...string) error {
func (ca *CommandArgs) GoogleUpdate(entities ...string) error {
for range Only.Once {
// SunGro.OutputType = iSolarCloud.TypeGoogle
// SunGrow.OutputType = iSolarCloud.TypeGoogle
if len(entities) == 0 {
entities = DefaultAreas
}
fmt.Printf("Saving %d entities from the SunGro to Google Docs...\n", len(entities))
fmt.Printf("Saving %d entities from the SunGrow to Google Docs...\n", len(entities))
for _, entity := range entities {
switch entity {
case "domain":
ca.Error = SunGro.Init()
ca.Error = SunGrow.Init()
if ca.Error != nil {
break
}

View File

@ -1,9 +1,9 @@
./bin/GoSungro api get findPsType '{"ps_id":"1129147"}'
./bin/GoSungro api get getPsDetailWithPsType '{"ps_id":"1129147"}'
./bin/GoSungro api get getPowerStatistics '{"ps_id":"1129147"}'
./bin/GoSungro api get getPowerDevicePointNames '{"device_type":"1"}'
./bin/GoSungro api get getPowerDevicePointNames '{"device_type":"2"}'
./bin/GoSungro api get getPowerDevicePointNames '{"device_type":"7"}'
./bin/GoSungro api get getPsList
./bin/GoSungro api get WebAppService.showPSView '{"ps_id":"1129147"}'
./bin/GoSungrow api get findPsType '{"ps_id":"1129147"}'
./bin/GoSungrow api get getPsDetailWithPsType '{"ps_id":"1129147"}'
./bin/GoSungrow api get getPowerStatistics '{"ps_id":"1129147"}'
./bin/GoSungrow api get getPowerDevicePointNames '{"device_type":"1"}'
./bin/GoSungrow api get getPowerDevicePointNames '{"device_type":"2"}'
./bin/GoSungrow api get getPowerDevicePointNames '{"device_type":"7"}'
./bin/GoSungrow api get getPsList
./bin/GoSungrow api get WebAppService.showPSView '{"ps_id":"1129147"}'

2
go.mod
View File

@ -1,4 +1,4 @@
module GoSungro
module GoSungrow
go 1.17

View File

@ -1,7 +1,7 @@
package google
import (
"GoSungro/Only"
"GoSungrow/Only"
"context"
"encoding/json"
"errors"

View File

@ -1,7 +1,7 @@
package google
import (
"GoSungro/Only"
"GoSungrow/Only"
"context"
"errors"
"fmt"
@ -77,7 +77,7 @@ func (s *Sheet) Verify() bool {
s.TokenFile = ""
break
}
s.TokenFile = filepath.Join(s.TokenFile, ".GoSungro", DefaultAuthTokenFile)
s.TokenFile = filepath.Join(s.TokenFile, ".GoSungrow", DefaultAuthTokenFile)
}
ok = true

View File

@ -1,129 +0,0 @@
package apiReflect
// Old Get method
// func (w *ApiRoot) Get(endpoint api.EndPoint) (api.EndPoint, error) {
// // func (w *ApiRoot) Get(u *url.URL, request interface{}) (interface{}, error) {
// // func (w *ApiRoot) Get(action interface{}) error {
// for range Only.Once {
// if w.Url == nil {
// w.Error = errors.New("SUNGRO API URL is invalid")
// break
// }
//
// request := endpoint.RequestRef()
// w.Error = reflect.VerifyOptionsRequired(request)
// if w.Error != nil {
// break
// }
//
// // objectName, actionName := GetNameOld(action)
// // httpRequest := FindInStruct(action, "RequestCommon")
// // httpResponse := FindInStruct(action, "ResponseCommon")
// //
// // objectName := GetStructName(object)
// // if objectName == "" {
// // w.Error = errors.New("invalid object name to structure")
// // break
// // }
// //
// // actionName := GetStructName(action)
// // if objectName == "" {
// // w.Error = errors.New("invalid action name to structure")
// // break
// // }
// //
// // requestString := Query(httpRequest)
// // if objectName == "" {
// // w.Error = errors.New("invalid httpRequest string for structure")
// // break
// // }
// //
// // responseString := Query(httpResponse)
// // if objectName == "" {
// // w.Error = errors.New("invalid httpResponse string for structure")
// // break
// // }
// //
// // u := fmt.Sprintf("%s?format=json&object=%s&action=%s%s",
// // w.Url.String(),
// // objectName,
// // actionName,
// // queryString,
// // )
//
// p, _ := json.Marshal(request)
//
// // w.httpRequest, w.Error = http.NewRequest("GET", u, nil)
// // if w.Error != nil {
// // break
// // }
// //
// // w.httpRequest.Header.Set("Authorization", w.Auth.GetAuthHeader())
//
// postUrl := fmt.Sprintf("%s%s", w.Url.String(), endpoint.GetUrl())
//
// for range Only.Twice {
// w.httpResponse, w.Error = http.Post(postUrl, "application/json", bytes.NewBuffer(p))
// if w.Error != nil {
// break
// }
//
// if strings.Contains(w.httpResponse.Status, "The access token provided is invalid") {
// // 401 Unauthorized The access token provided is invalid.
// // Will first attempt a refresh of the token OR re-login.
// w.Error = w.Auth.Login(&login.SunGroAuth {
// Expiry: "",
// AppKey: "",
// UserAccount: "",
// UserPassword: "",
// })
// if w.Error != nil {
// w.Error = errors.New(w.httpResponse.Status)
// break
// }
// //w.Error = errors.New(fmt.Sprintf("API httpResponse is %s", w.httpResponse.Status))
// continue
// }
//
// if w.httpResponse.StatusCode == 401 {
// w.Error = errors.New(w.httpResponse.Status)
// break
// }
//
// // All OK.
// break
// }
// //goland:noinspection GoUnhandledErrorResult
// defer w.httpResponse.Body.Close()
// if w.Error != nil {
// break
// }
//
// if w.httpResponse.StatusCode != 200 {
// w.Error = errors.New(fmt.Sprintf("API httpResponse is %s", w.httpResponse.Status))
// break
// }
//
// w.Body, w.Error = ioutil.ReadAll(w.httpResponse.Body)
// if w.Error != nil {
// break
// }
//
// if len(w.Body) == 0 {
// w.Error = errors.New("empty httpResponse")
// break
// }
//
// endpoint = endpoint.SetResponse(w.Body)
// w.Error = endpoint.IsResponseValid()
//
// if w.Error != nil {
// fmt.Printf("ERROR: Body is:\n%s\n", w.Body)
// break
// }
// }
//
// return endpoint, w.Error
// }

View File

@ -1,7 +1,7 @@
package apiReflect
import (
"GoSungro/Only"
"GoSungrow/Only"
"encoding/json"
"errors"
"fmt"

View File

@ -4,6 +4,7 @@ type EndPoint interface {
GetArea() AreaName
GetName() EndPointName
GetUrl() EndPointUrl
IsDisabled() bool
Help() string
Call() EndPoint

View File

@ -1,12 +1,13 @@
package nullEndPoint
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"errors"
"fmt"
)
const Url = ""
const Name = "nullEndPoint"
const Url = "%URL%"
const Disabled = true
type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
@ -22,4 +23,35 @@ func (rd RequestData) Help() string {
}
type ResultData struct {
Dummy string `json:"dummy"`
}
func (e *ResultData) IsValid() error {
var err error
switch {
case e.Dummy == "":
break
default:
err = errors.New(fmt.Sprintf("unknown error '%s'", e.Dummy))
}
return err
}
//type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
// if len(data) == 0 {
// break
// }
// var pd DecodeResultData
//
// // Store ResultData
// _ = json.Unmarshal(data, &pd)
// e.Dummy = pd.Dummy
// }
//
// return err
//}

View File

@ -1,9 +1,9 @@
package nullEndPoint
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"
@ -71,6 +71,10 @@ func (e EndPoint) Help() string {
return ret
}
func (e EndPoint) IsDisabled() bool {
return Disabled
}
func (e EndPoint) GetArea() api.AreaName {
return e.Area
}
@ -87,8 +91,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {
@ -136,10 +144,6 @@ func (e EndPoint) SetRequestByJson(j api.Json) api.EndPoint {
if e.Error != nil {
break
}
e.Error = e.IsRequestValid()
if e.Error != nil {
break
}
}
return e
}
@ -154,13 +158,13 @@ func (e EndPoint) GetRequestJson() api.Json {
func (e EndPoint) IsRequestValid() error {
for range Only.Once {
req := e.GetRequest()
// req := e.Request.RequestCommon
e.Error = req.RequestCommon.IsValid()
//req := e.GetRequest()
//req := e.Request.RequestCommon
e.Error = e.Request.RequestCommon.IsValid()
if e.Error != nil {
break
}
e.Error = req.RequestData.IsValid()
e.Error = e.Request.RequestData.IsValid()
if e.Error != nil {
break
}
@ -170,13 +174,10 @@ func (e EndPoint) IsRequestValid() error {
func (e EndPoint) SetResponse(ref []byte) api.EndPoint {
for range Only.Once {
// r := e.GetResponse()
// e.Error = json.Unmarshal(ref, &r)
e.Error = json.Unmarshal(ref, &e.Response)
if e.Error != nil {
break
}
// e.ResponseCommon = r
}
return e
}
@ -191,12 +192,14 @@ func (e EndPoint) ResponseRef() interface{} {
func (e EndPoint) IsResponseValid() error {
for range Only.Once {
// resp := e.GetResponse()
// e.Error = resp.ResponseCommon.IsValid()
e.Error = e.Response.ResponseCommon.IsValid()
if e.Error != nil {
break
}
e.Error = e.Response.ResultData.IsValid()
if e.Error != nil {
break
}
}
return e.Error
}
@ -215,4 +218,20 @@ func (e EndPoint) ResponseString() string {
func (e EndPoint) MarshalJSON() ([]byte, error) {
return api.MarshalJSON(e)
// return json.Marshal(&struct {
// Area string `json:"area"`
// EndPoint string `json:"endpoint"`
// Host string `json:"api_host"`
// Url string `json:"endpoint_url"`
// Request interface{} `json:"request"`
// Response interface{} `json:"response"`
// }{
// Area: string(e.Area),
// EndPoint: string(e.Name),
// Host: e.ApiRoot.Url.String(),
// Url: e.Url.String(),
// Request: e.Request,
// Response: e.Response,
// })
}

View File

@ -1,7 +1,7 @@
package api
import (
"GoSungro/Only"
"GoSungrow/Only"
"errors"
"fmt"
)

View File

@ -1,7 +1,7 @@
package api
import (
"GoSungro/Only"
"GoSungrow/Only"
"errors"
"fmt"
"github.com/olekukonko/tablewriter"

View File

@ -1,7 +1,7 @@
package api
import (
"GoSungro/Only"
"GoSungrow/Only"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package api
import (
"GoSungro/Only"
"GoSungrow/Only"
"bytes"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package api
import (
"GoSungro/Only"
"GoSungrow/Only"
"errors"
"fmt"
"strings"

View File

@ -1,13 +1,12 @@
package api
import (
"GoSungro/Only"
"GoSungrow/Only"
"errors"
"fmt"
"strings"
)
type Response struct {
ResponseCommon
}
@ -19,7 +18,6 @@ type ResponseCommon struct {
ResultMsg string `json:"result_msg"`
}
func (req ResponseCommon) IsValid() error {
var err error
for range Only.Once {
@ -27,14 +25,17 @@ func (req ResponseCommon) IsValid() error {
if err != nil {
break
}
err = req.CheckResultCode()
if err != nil {
break
}
err = CheckString("ReqSerialNum", req.ReqSerialNum)
if err != nil {
break
}
// if req.ResultData == nil {
// err = errors.New("zero results")
// break
@ -47,12 +48,12 @@ func (req ResponseCommon) IsTokenValid() bool {
var ok bool
for range Only.Once {
switch {
case req.ResultMsg == "success":
ok = true
case req.ResultMsg == "er_token_login_invalid":
ok = false
default:
ok = false
case req.ResultMsg == "success":
ok = true
case req.ResultMsg == "er_token_login_invalid":
ok = false
default:
ok = false
}
}
return ok
@ -70,20 +71,20 @@ func (req ResponseCommon) CheckResultCode() error {
var err error
for range Only.Once {
switch req.ResultCode {
case "1":
err = nil
case "-1":
err = errors.New(fmt.Sprintf("error '%s'", req.ResultCode))
case "010":
err = errors.New(fmt.Sprintf("error '%s'", req.ResultCode))
case "000":
err = errors.New(fmt.Sprintf("error '%s'", req.ResultCode))
case "201":
err = errors.New(fmt.Sprintf("error '%s'", req.ResultCode))
case "E00003":
err = errors.New(fmt.Sprintf("need to login again '%s'", req.ResultCode))
default:
err = errors.New(fmt.Sprintf("unknown error '%s'", req.ResultCode))
case "1":
err = nil
case "-1":
err = errors.New(fmt.Sprintf("error '%s'", req.ResultCode))
case "010":
err = errors.New(fmt.Sprintf("error '%s'", req.ResultCode))
case "000":
err = errors.New(fmt.Sprintf("error '%s'", req.ResultCode))
case "201":
err = errors.New(fmt.Sprintf("error '%s'", req.ResultCode))
case "E00003":
err = errors.New(fmt.Sprintf("need to login again '%s'", req.ResultCode))
default:
err = errors.New(fmt.Sprintf("unknown error '%s'", req.ResultCode))
}
}
return err
@ -93,20 +94,22 @@ func (req ResponseCommon) CheckResultMessage() error {
var err error
for range Only.Once {
switch {
case req.ResultMsg == "success":
err = nil
case req.ResultMsg == "er_invalid_appkey":
err = errors.New(fmt.Sprintf("appkey is incorrect '%s'", req.ResultMsg))
case req.ResultMsg == "er_token_login_invalid":
err = errors.New(fmt.Sprintf("need to login again '%s'", req.ResultMsg))
case req.ResultMsg == "er_parameter_value_invalid":
err = errors.New(fmt.Sprintf("incorrect request data '%s'", req.ResultMsg))
case req.ResultMsg == "er_unknown_exception":
err = errors.New(fmt.Sprintf("API error '%s'", req.ResultMsg))
case strings.HasPrefix(req.ResultMsg, "Parameter:"):
err = errors.New(fmt.Sprintf("incorrect request data '%s'", req.ResultMsg))
default:
err = errors.New(fmt.Sprintf("unknown error '%s'", req.ResultMsg))
case req.ResultMsg == "success":
err = nil
case req.ResultMsg == `账号不存在`:
err = errors.New(fmt.Sprintf("Account does not exist '%s'", req.ResultMsg))
case req.ResultMsg == "er_invalid_appkey":
err = errors.New(fmt.Sprintf("appkey is incorrect '%s'", req.ResultMsg))
case req.ResultMsg == "er_token_login_invalid":
err = errors.New(fmt.Sprintf("need to login again '%s'", req.ResultMsg))
case req.ResultMsg == "er_parameter_value_invalid":
err = errors.New(fmt.Sprintf("incorrect request data '%s'", req.ResultMsg))
case req.ResultMsg == "er_unknown_exception":
err = errors.New(fmt.Sprintf("API error '%s'", req.ResultMsg))
case strings.HasPrefix(req.ResultMsg, "Parameter:"):
err = errors.New(fmt.Sprintf("incorrect request data '%s'", req.ResultMsg))
default:
err = errors.New(fmt.Sprintf("unknown error '%s'", req.ResultMsg))
}
}
return err

View File

@ -1,7 +1,7 @@
package api
import (
"GoSungro/Only"
"GoSungrow/Only"
"encoding/json"
"errors"
"fmt"

View File

@ -1,8 +1,8 @@
package api
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"fmt"
"net/url"

View File

@ -1,9 +1,9 @@
package api
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api/apiReflect"
// "GoSungro/iSolarCloud/sungro/AppService/login"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api/apiReflect"
// "GoSungrow/iSolarCloud/sungro/AppService/login"
"bytes"
"encoding/json"
"errors"
@ -12,11 +12,10 @@ import (
"net/http"
)
type Web struct {
Url EndPointUrl
Body []byte
Error error
Url EndPointUrl
Body []byte
Error error
retry int
client http.Client
@ -38,7 +37,7 @@ func (w *Web) Get(endpoint EndPoint) EndPoint {
for range Only.Once {
w.Error = w.Url.IsValid()
if w.Error != nil {
w.Error = errors.New("SUNGRO API URL is invalid")
w.Error = errors.New("SUNGRO API EndPoint not yet implemented")
break
}

View File

@ -1,8 +1,8 @@
package web
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/sungro/AppService/login"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/sungro/AppService/login"
"bytes"
"encoding/json"
"errors"

View File

@ -1,257 +0,0 @@
package web
// const (
// DateTimeFormat = "2006-01-02T15:04:05"
// DefaultAuthTokenFile = "SunGroAuthToken.json"
// )
//
// var (
// TokenRequestUrl = "/v1/userService/login"
// )
//
// type SunGroAuth struct {
// Expiry string
//
// AppKey string
// UserAccount string
// UserPassword string
// }
//
// type Auth struct {
// // Url *url.URL
// // RequestCommon login.RequestCommon
// // ResponseCommon login.ResponseCommon
//
// api.EndPoint
//
// File string
// Expiry time.Time
// newToken bool
// retry int
//
// Error error
// }
//
//
// func (t *Auth) Auth(auth *SunGroAuth) error {
// for range Only.Once {
// _ = t.readTokenFile()
//
// t.Error = t.Verify(auth)
// if t.Error != nil {
// break
// }
//
// t.Error = t.RetrieveToken()
// if t.Error != nil {
// break
// }
// }
//
// return t.Error
// }
//
// func (t *Auth) Verify(auth *SunGroAuth) error {
// for range Only.Once {
// if auth == nil {
// // If nil, then assume we haven't set anything.
// break
// }
//
// if auth.AppKey == "" {
// t.Error = errors.New("API AppKey")
// break
// }
// if auth.UserAccount == "" {
// t.Error = errors.New("empty Client ApiUsername")
// break
// }
// if auth.UserPassword == "" {
// t.Error = errors.New("empty Client ApiPassword")
// break
// }
//
// if t.ResponseCommon.ResultData.Auth == "" {
// t.newToken = true
// }
//
// if auth.Expiry == "" {
// auth.Expiry = time.Now().Format(DateTimeFormat)
// }
// t.Expiry, t.Error = time.Parse(DateTimeFormat, auth.Expiry)
// if t.Error != nil {
// t.newToken = true
// }
//
// t.RequestCommon = login.RequestCommon {
// Appkey: auth.AppKey,
// SysCode: "900",
// UserAccount: auth.UserAccount,
// UserPassword: auth.UserPassword,
// }
//
// t.HasTokenExpired()
// }
//
// return t.Error
// }
//
// func (t *Auth) RetrieveToken() error {
// for range Only.Once {
// t.HasTokenExpired()
// if !t.newToken {
// break
// }
//
// u := fmt.Sprintf("%s%s",
// t.Url.String(),
// TokenRequestUrl,
// )
// //p, _ := json.Marshal(map[string]string {
// // "user_account": t.RequestCommon.UserAccount,
// // "user_password": t.RequestCommon.UserPassword,
// // "appkey": t.RequestCommon.AppKey,
// // "sys_code": "900",
// //})
// p, _ := json.Marshal(t.RequestCommon)
//
// var httpResponse *http.ResponseCommon
// httpResponse, t.Error = http.Post(u, "application/json", bytes.NewBuffer(p))
// if t.Error != nil {
// break
// }
// //goland:noinspection GoUnhandledErrorResult
// defer httpResponse.Body.Close()
// if httpResponse.StatusCode != 200 {
// t.Error = errors.New(fmt.Sprintf("Status Code is %d", httpResponse.StatusCode))
// break
// }
//
// var body []byte
// body, t.Error = ioutil.ReadAll(httpResponse.Body)
// if t.Error != nil {
// break
// }
//
// t.Error = json.Unmarshal(body, &t.ResponseCommon)
// if t.Error != nil {
// break
// }
//
// t.Expiry = time.Now()
//
// t.Error = t.saveToken()
// if t.Error != nil {
// break
// }
// }
//
// return t.Error
// }
//
// func (t *Auth) HasTokenExpired() bool {
// for range Only.Once {
// if t.Expiry.Before(time.Now()) {
// t.newToken = true
// break
// }
//
// if t.ResponseCommon.ResultData.Auth == "" {
// t.newToken = true
// break
// }
// }
//
// return t.newToken
// }
//
// func (t *Auth) HasTokenChanged() bool {
// ok := t.newToken
// if t.newToken {
// t.newToken = false
// }
// return ok
// }
//
// // func (t *Auth) GetAuthHeader() string {
// // var ret string
// //
// // for range Only.Once {
// // //if t.ResponseCommon.TokenType == "" {
// // // break
// // //}
// // //
// // //if t.ResponseCommon.AccessToken == "" {
// // // break
// // //}
// // //
// // //ret = t.ResponseCommon.TokenType + " " + t.ResponseCommon.AccessToken
// // }
// //
// // return ret
// // }
//
// func (t *Auth) GetToken() string {
// //return fmt.Sprintf("%s %s", t.ResponseCommon.TokenType, t.ResponseCommon.AccessToken)
// return ""
// }
//
// func (t *Auth) GetTokenExpiry() time.Time {
// return t.Expiry
// }
//
// // Retrieves a token from a local file.
// func (t *Auth) readTokenFile() error {
// for range Only.Once {
// if t.File == "" {
// t.File, t.Error = os.UserHomeDir()
// if t.Error != nil {
// t.File = ""
// break
// }
// t.File = filepath.Join(t.File, ".GoSungro", DefaultAuthTokenFile)
// }
//
// var f *os.File
// f, t.Error = os.Open(t.File)
// if t.Error != nil {
// break
// }
//
// //goland:noinspection GoUnhandledErrorResult
// defer f.Close()
// //ret = &oauth2.token{}
// t.Error = json.NewDecoder(f).Decode(&t.ResponseCommon)
// }
//
// return t.Error
// }
//
// // Saves a token to a file path.
// func (t *Auth) saveToken() error {
// for range Only.Once {
// if t.File == "" {
// t.File, t.Error = os.UserHomeDir()
// if t.Error != nil {
// t.File = ""
// break
// }
// t.File = filepath.Join(t.File, ".GoSungro", DefaultAuthTokenFile)
// }
//
// fmt.Printf("Saving token file to: %s\n", t.File)
// var f *os.File
// f, t.Error = os.OpenFile(t.File, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
// if t.Error != nil {
// t.Error = errors.New(fmt.Sprintf("Unable to cache SUNGRO oauth token: %v", t.Error))
// break
// }
//
// //goland:noinspection GoUnhandledErrorResult
// defer f.Close()
// t.Error = json.NewEncoder(f).Encode(t.ResponseCommon.ResultData)
// }
//
// return t.Error
// }

View File

@ -1,21 +1,19 @@
package iSolarCloud
// var SunGro sungro.SunGro
const (
TypeGit = iota
TypeJson = iota
TypeHuman = iota
TypeGoogle = iota
StringTypeGit = "git"
StringTypeJson = "json"
StringTypeHuman = "human"
StringTypeGit = "git"
StringTypeJson = "json"
StringTypeHuman = "human"
StringTypeGoogle = "google"
)
type OutputType int
func (out *OutputType) IsGit() bool {
if *out == TypeGit {
return true

View File

@ -2,7 +2,7 @@
package AliSmsService
import (
"GoSungro/iSolarCloud/api"
"GoSungrow/iSolarCloud/api"
"fmt"
)

View File

@ -1,27 +0,0 @@
package nullEndPoint
import (
"GoSungro/iSolarCloud/api/apiReflect"
"fmt"
)
const Url = ""
type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
}
func (rd RequestData) IsValid() error {
return apiReflect.VerifyOptionsRequired(rd)
}
func (rd RequestData) Help() string {
ret := fmt.Sprintf("")
return ret
}
type ResultData struct {
}

View File

@ -1,221 +0,0 @@
package nullEndPoint
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Response Response
}
type Request struct {
api.RequestCommon
RequestData
}
type Response struct {
api.ResponseCommon
ResultData ResultData `json:"result_data"`
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
Url: api.SetUrl(Url),
Request: Request{},
Response: Response{},
Error: nil,
},
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
func (e EndPoint) Init(apiRoot *api.Web) *EndPoint {
ret := Init(apiRoot)
return &ret
}
func (e EndPoint) GetRequest() Request {
return e.Request
}
func (e EndPoint) GetResponse() Response {
return e.Response
}
func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
func (e EndPoint) Help() string {
ret := apiReflect.HelpOptions(e.Request.RequestData)
ret += fmt.Sprintf("JSON request:\t%s\n", e.GetRequestJson())
ret += e.Request.Help()
return ret
}
func (e EndPoint) GetArea() api.AreaName {
return e.Area
}
func (e EndPoint) GetName() api.EndPointName {
return e.Name
}
func (e EndPoint) GetUrl() api.EndPointUrl {
return e.Url
}
func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {
e.EndPointStruct.Error = errors.New(fmt.Sprintf(format, a...))
return e
}
func (e EndPoint) GetError() error {
return e.EndPointStruct.Error
}
func (e EndPoint) IsError() bool {
if e.Error != nil {
return true
}
return false
}
func (e EndPoint) SetRequest(ref interface{}) api.EndPoint {
for range Only.Once {
if apiReflect.GetPkgType(ref) == "api.RequestCommon" {
e.Request.RequestCommon = ref.(api.RequestCommon)
break
}
if apiReflect.GetType(ref) == "RequestData" {
e.Request.RequestData = ref.(RequestData)
e.Error = e.IsRequestValid()
break
}
e.Error = apiReflect.DoPkgTypesMatch(e.Request, ref)
if e.Error != nil {
break
}
e.Request = ref.(Request)
}
return e
}
func (e EndPoint) SetRequestByJson(j api.Json) api.EndPoint {
for range Only.Once {
e.Error = json.Unmarshal([]byte(j), &e.Request.RequestData)
if e.Error != nil {
break
}
e.Error = e.IsRequestValid()
if e.Error != nil {
break
}
}
return e
}
func (e EndPoint) RequestRef() interface{} {
return e.Request
}
func (e EndPoint) GetRequestJson() api.Json {
return api.GetAsJson(e.Request.RequestData)
}
func (e EndPoint) IsRequestValid() error {
for range Only.Once {
req := e.GetRequest()
// req := e.Request.RequestCommon
e.Error = req.RequestCommon.IsValid()
if e.Error != nil {
break
}
e.Error = req.RequestData.IsValid()
if e.Error != nil {
break
}
}
return e.Error
}
func (e EndPoint) SetResponse(ref []byte) api.EndPoint {
for range Only.Once {
// r := e.GetResponse()
// e.Error = json.Unmarshal(ref, &r)
e.Error = json.Unmarshal(ref, &e.Response)
if e.Error != nil {
break
}
// e.ResponseCommon = r
}
return e
}
func (e EndPoint) GetResponseJson() api.Json {
return api.GetAsPrettyJson(e.Response)
}
func (e EndPoint) ResponseRef() interface{} {
return e.Response
}
func (e EndPoint) IsResponseValid() error {
for range Only.Once {
// resp := e.GetResponse()
// e.Error = resp.ResponseCommon.IsValid()
e.Error = e.Response.ResponseCommon.IsValid()
if e.Error != nil {
break
}
}
return e.Error
}
func (e EndPoint) String() string {
return api.GetEndPointString(e)
}
func (e EndPoint) RequestString() string {
return api.GetRequestString(e.Request)
}
func (e EndPoint) ResponseString() string {
return api.GetRequestString(e.Response)
}
func (e EndPoint) MarshalJSON() ([]byte, error) {
return api.MarshalJSON(e)
}

View File

@ -1,7 +1,7 @@
package acceptPsSharing
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package acceptPsSharing
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package activateEmail
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package activateEmail
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addConfig
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addConfig
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addDeviceRepair
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addDeviceRepair
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addDeviceToStructureForHousehold
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addDeviceToStructureForHousehold
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addDeviceToStructureForHouseholdByPsIdS
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addDeviceToStructureForHouseholdByPsIdS
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addFault
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addFault
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addFaultOrder
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addFaultOrder
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addFaultPlan
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addFaultPlan
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addFaultRepairSteps
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addFaultRepairSteps
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addHouseholdEvaluation
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addHouseholdEvaluation
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addHouseholdLeaveMessage
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addHouseholdLeaveMessage
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addHouseholdOpinionFeedback
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addHouseholdOpinionFeedback
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addHouseholdWorkOrder
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addHouseholdWorkOrder
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addOnDutyInfo
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addOnDutyInfo
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addOperRule
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addOperRule
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addOrDelPsStructure
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addOrDelPsStructure
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addOrderStep
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addOrderStep
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addPowerStationForHousehold
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addPowerStationForHousehold
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addPowerStationInfo
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addPowerStationInfo
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addReportConfigEmail
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

View File

@ -1,9 +1,9 @@
package addReportConfigEmail
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/Only"
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"

View File

@ -1,7 +1,7 @@
package addSysAdvancedParam
import (
"GoSungro/iSolarCloud/api/apiReflect"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)

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