Merge remote-tracking branch 'origin/master'

# Conflicts:
#	api/dataapi/lib_test.go
master
Paulo Simão 2021-11-25 16:49:42 -03:00
commit d80a2568ac
1 changed files with 8 additions and 17 deletions

View File

@ -6,6 +6,7 @@ import (
"time"
"go.digitalcircle.com.br/open/httpcli"
"go.digitalcircle.com.br/open/replaycli-go/api/replay"
)
type DataApiOp string
@ -41,33 +42,23 @@ func (c *Cli) Do(request *DataAPIRequest) (response *DataAPIResponse, err error)
return
}
func NewCli(apikey string) *Cli {
func NewCli() *Cli {
ret := &Cli{Httpcli: httpcli.NewCli()}
ret.Httpcli.AddHeader("X-API-KEY", apikey)
ret.Httpcli.SetBasePath("https://dataapi.digitalcircle.com.br")
return ret
}
func LCR_Create() {
c := NewCli("RnJpIDA1IE5vdiAyMDIxIDExOjE1OjIyIEFNIFVUQwo")
_, err := c.Do(&DataAPIRequest{
Col: "LCR_Bot",
Op: CREATE,
Data: map[string]interface{}{
"Registro": "1",
},
})
rcon := replay.NewCli()
apikey, err := rcon.ConfigGet("API_KEY")
if err != nil {
panic(err)
}
ret.Httpcli.AddHeader("X-API-KEY", apikey)
ret.Httpcli.SetBasePath("https://dataapi.digitalcircle.com.br")
return ret
}
func RegistrarExec(table string, check bool) {
rp := replay.NewCli()
rp.ConfigGet("API_KEY")
//Para robôs, age como contador e registra cada repetição no mês
c := NewCli("RnJpIDA1IE5vdiAyMDIxIDExOjE1OjIyIEFNIFVUQwo")
c := NewCli()
var registros int
var erro int
current := time.Now().Format("2006-01")