diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-11 01:48:57 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-11 01:48:57 (GMT) |
commit | 2426db0f7625668434fbcc1722cc13a1bdf67e1b (patch) | |
tree | fc347fa5e6bba0596e731bc97d1fe17c1263300d | |
parent | 4d1fa3997cdc5c98e25008fcbdde84e47901a254 (diff) |
added RemovCart and AddCut commands
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 42 |
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) |