diff options
Diffstat (limited to 'rhimport')
-rw-r--r-- | rhimport/core.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/rhimport/core.go b/rhimport/core.go index 25a4090..1b2423b 100644 --- a/rhimport/core.go +++ b/rhimport/core.go @@ -28,6 +28,7 @@ import ( "fmt" "io/ioutil" "log" + "net/http" "os" "path" @@ -321,3 +322,21 @@ func (ctx *Context) reportProgress(step int, stepName string, current, total flo func (ctx *Context) isCanceled() bool { return ctx.Cancel != nil && len(ctx.Cancel) > 0 } + +func RemoveCart(cart uint, rdxportEndpoint, username, password string) (err error) { + conf := &Config{} + conf.RDXportEndpoint = rdxportEndpoint + ctx := NewContext(conf, nil, nil, nil) + ctx.Cart = cart + ctx.UserName = username + ctx.Password = password + + res := &Result{ResponseCode: http.StatusOK} + if err = removeCart(ctx, res); err != nil { + return err + } + if res.ResponseCode != http.StatusOK { + return fmt.Errorf("Error removing cart %d: %s", cart, res.ErrorString) + } + return nil +} |