summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-11 01:48:57 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-11 01:48:57 (GMT)
commit2426db0f7625668434fbcc1722cc13a1bdf67e1b (patch)
treefc347fa5e6bba0596e731bc97d1fe17c1263300d /src
parent4d1fa3997cdc5c98e25008fcbdde84e47901a254 (diff)
added RemovCart and AddCut commands
Diffstat (limited to 'src')
-rw-r--r--src/helsinki.at/rhimport/importer.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go
index c7b1a66..8995717 100644
--- a/src/helsinki.at/rhimport/importer.go
+++ b/src/helsinki.at/rhimport/importer.go
@@ -137,6 +137,7 @@ func send_post_request(url string, b *bytes.Buffer, contenttype string) (err err
return
}
+
func add_cart(ctx *ImportContext) (err error) {
var b bytes.Buffer
w := multipart.NewWriter(&b)
@@ -165,6 +166,47 @@ func add_cart(ctx *ImportContext) (err error) {
return send_post_request(ctx.Config.RDXportEndpoint, &b, w.FormDataContentType())
}
+func add_cut(ctx *ImportContext) (err error) {
+ var b bytes.Buffer
+ w := multipart.NewWriter(&b)
+
+ if err = w.WriteField("COMMAND", "10"); err != nil {
+ return
+ }
+ if err = w.WriteField("LOGIN_NAME", ctx.UserName); err != nil {
+ return
+ }
+ if err = w.WriteField("PASSWORD", ctx.Password); err != nil {
+ return
+ }
+ if err = w.WriteField("CART_NUMBER", fmt.Sprintf("%d", ctx.Cart)); err != nil {
+ return
+ }
+ w.Close()
+ return send_post_request(ctx.Config.RDXportEndpoint, &b, w.FormDataContentType())
+}
+
+func remove_cart(ctx *ImportContext) (err error) {
+ var b bytes.Buffer
+ w := multipart.NewWriter(&b)
+
+ if err = w.WriteField("COMMAND", "13"); err != nil {
+ return
+ }
+ if err = w.WriteField("LOGIN_NAME", ctx.UserName); err != nil {
+ return
+ }
+ if err = w.WriteField("PASSWORD", ctx.Password); err != nil {
+ return
+ }
+ if err = w.WriteField("CART_NUMBER", fmt.Sprintf("%d", ctx.Cart)); err != nil {
+ return
+ }
+ w.Close()
+ return send_post_request(ctx.Config.RDXportEndpoint, &b, w.FormDataContentType())
+}
+
+
func import_audio(ctx *ImportContext) (err error) {
var b bytes.Buffer
w := multipart.NewWriter(&b)