From 392c7940af93db0b57f54fe2d763b7a3f0f0abd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulo=20Sima=CC=83o?= Date: Mon, 11 Oct 2021 18:21:47 -0300 Subject: [PATCH] added getmyjson to replaycli --- api/replay/cli.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/replay/cli.go b/api/replay/cli.go index 8d73636..9e8ba53 100644 --- a/api/replay/cli.go +++ b/api/replay/cli.go @@ -1,6 +1,7 @@ package replay import ( + "encoding/json" "fmt" "os" "time" @@ -110,6 +111,14 @@ func (c *Cli) QueueGetData(id string) (ret []byte, err error) { func (c *Cli) QueueGetMyData() ([]byte, error) { return c.QueueGetData(os.Getenv("REPLAY_QUEUEID")) } +func (c *Cli) QueueGetMyJson(i interface{}) error { + bs, err := c.QueueGetData(os.Getenv("REPLAY_QUEUEID")) + if err != nil { + return err + } + err = json.Unmarshal(bs, i) + return err +} func (c *Cli) QueueAbort() error { return c.HttpCli().JsonGet("/api/v1/queue/abort", nil) }