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