summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-01-28 01:38:38 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-01-28 01:38:38 (GMT)
commit20366f869beaa6b3332b2fe49d20cf01f5082a5d (patch)
treee600e2f8e780397a15d4cb50e25fec65e6d9599e
parentf8b3c8c2ca2a51100c7b7649acf5aa90a47623bc (diff)
added simple Function to remove carts
-rw-r--r--rhimport/core.go19
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
+}