improvements

master
Paulo Simão 2021-11-25 16:49:24 -03:00
parent ccae321dc9
commit aee712a88a
5 changed files with 28 additions and 4 deletions

View File

@ -0,0 +1,22 @@
package apiproxy
import (
"log"
"os"
"testing"
)
func TestCli_Do(t *testing.T) {
os.Setenv("REPLAY_APIKEY", "DONTBOTHER")
os.Setenv("REPLAY_ADDR", "https://localhost:8443")
c := NewCli()
res, err := c.Do(&APIProxyRequest{
Method: "GET",
Url: "https://www.slashdot.org",
})
if err != nil {
t.Fatal(err.Error())
}
log.Printf("%#v", res)
}

View File

@ -41,14 +41,12 @@ func (c *Cli) Eval(id string, s string) (map[string]interface{}, error) {
json.Unmarshal(bs, &ret)
return ret, err
}
func (c *Cli) Wait(id string, s string, to int) (string, error) {
ret := ""
bs, err := c.HttpCli().RawPost(fmt.Sprintf("/ipc/chrome/wait/%s?to=%d", id, to), []byte(s))
json.Unmarshal(bs, &ret)
return ret, err
}
func (c *Cli) Send(id string, m string, ps map[string]interface{}) (string, error) {
ret := ""
in := map[string]interface{}{

View File

@ -1,6 +1,7 @@
package dataapi
import (
"go.digitalcircle.com.br/open/replaycli-go/api/replay"
"strconv"
"time"
@ -63,6 +64,8 @@ func LCR_Create() {
}
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")
var registros int

View File

@ -2,6 +2,7 @@ package dataapi_test
import (
"log"
"os"
"strconv"
"testing"
"time"
@ -10,7 +11,8 @@ import (
)
func TestAPIRetrieve(t *testing.T) {
c := dataapi.NewCli("RnJpIDA1IE5vdiAyMDIxIDExOjE1OjIyIEFNIFVUQwo")
apikey := os.Getenv("DATAAPI_APIKEY")
c := dataapi.NewCli(apikey)
res, err := c.Do(&dataapi.DataAPIRequest{
Col: "teste3",
Op: dataapi.RETRIEVE,

View File

@ -43,7 +43,6 @@ func (c *Cli) Write(fname string, sheet string, cell string, val string, celtype
err := c.HttpCli().JsonPost("/ipc/excel/write", req, &res)
return err
}
func (c *Cli) New(fname string, sheet string) (string, error) {
req := &Req{
File: fname,