diff options
-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) |