separated httpcli from replaycli. Added config methods
This commit is contained in:
+5
-9
@@ -11,11 +11,7 @@ const (
|
||||
)
|
||||
|
||||
type Cli struct {
|
||||
cli *api.Cli
|
||||
}
|
||||
|
||||
func (c *Cli) HttpCli() *api.Cli {
|
||||
return c.cli
|
||||
*api.ApiCli
|
||||
}
|
||||
|
||||
type Req struct {
|
||||
@@ -32,7 +28,7 @@ func (c *Cli) Read(fname string, sheet string) ([][]string, error) {
|
||||
Sheet: sheet,
|
||||
}
|
||||
res := make([][]string, 0)
|
||||
err := c.cli.HttpJsonPost("/ipc/excel/read", req, &res)
|
||||
err := c.HttpCli().JsonPost("/ipc/excel/read", req, &res)
|
||||
return res, err
|
||||
}
|
||||
func (c *Cli) Write(fname string, sheet string, cell string, val string, celtype string) error {
|
||||
@@ -44,7 +40,7 @@ func (c *Cli) Write(fname string, sheet string, cell string, val string, celtype
|
||||
Celtype: celtype,
|
||||
}
|
||||
res := ""
|
||||
err := c.cli.HttpJsonPost("/ipc/excel/write", req, &res)
|
||||
err := c.HttpCli().JsonPost("/ipc/excel/write", req, &res)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -54,11 +50,11 @@ func (c *Cli) New(fname string, sheet string) (string, error) {
|
||||
Sheet: sheet,
|
||||
}
|
||||
res := ""
|
||||
err := c.cli.HttpJsonPost("/ipc/excel/new", req, &res)
|
||||
err := c.HttpCli().JsonPost("/ipc/excel/new", req, &res)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func NewCli() *Cli {
|
||||
ret := &Cli{cli: api.NewCli()}
|
||||
ret := &Cli{ApiCli: api.NewApiCli()}
|
||||
return ret
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user