replaycli-go/api/cli.go

33 lines
657 B
Go
Raw Normal View History

2021-09-30 00:00:49 +00:00
package api
import (
"go.digitalcircle.com.br/open/httpcli"
2021-10-31 09:37:05 +00:00
"go.digitalcircle.com.br/open/replaycli-go/ipcmux"
"go.digitalcircle.com.br/open/replaycli-go/util"
2021-09-30 00:00:49 +00:00
"os"
)
type ApiCli struct {
cli *httpcli.Cli
2021-09-30 00:00:49 +00:00
}
func (a *ApiCli) HttpCli() *httpcli.Cli {
return a.cli
2021-09-30 00:00:49 +00:00
}
func NewApiCli() *ApiCli {
ret := &ApiCli{cli: httpcli.C()}
ret.cli.SetBasePath(util.Addr())
2021-09-30 00:00:49 +00:00
apikey = os.Getenv("REPLAY_APIKEY")
ret.cli.AddHeader("X-API-KEY", apikey)
2021-09-30 00:00:49 +00:00
return ret
}
2021-10-31 09:37:05 +00:00
func NewApiIPCCli() *ApiCli {
ret := &ApiCli{cli: httpcli.NewCli()}
ret.cli.SetCli(ipcmux.NewClient())
apikey = os.Getenv("REPLAY_APIKEY")
ret.cli.AddHeader("X-API-KEY", apikey)
return ret
}