summaryrefslogtreecommitdiff
path: root/src/cardmarket/handlers/vacation.go
diff options
context:
space:
mode:
authorDJ O'Leary <dijitol@proton.me>2026-09-07 03:13:01 +0200
committerDJ O'Leary <dijitol@proton.me>2026-09-07 03:13:01 +0200
commit2f61b07aea82fa0f5b98686bdfeba2e297c7b21b (patch)
treeb55f588e935b11decd782e7bd0a6c98f060e1654 /src/cardmarket/handlers/vacation.go
parent5d3efcc64fc9664e061b44659f85aeec03a56685 (diff)
refactor(cardmarket): move handlers to own directoryHEADmain
Diffstat (limited to 'src/cardmarket/handlers/vacation.go')
-rw-r--r--src/cardmarket/handlers/vacation.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/cardmarket/handlers/vacation.go b/src/cardmarket/handlers/vacation.go
new file mode 100644
index 0000000..59528ed
--- /dev/null
+++ b/src/cardmarket/handlers/vacation.go
@@ -0,0 +1,47 @@
+package handlers
+
+import (
+ "context"
+
+ "codeberg.org/dijitol/trading_post/src/cardmarket"
+)
+
+func SetVacationState(
+ ctx context.Context,
+ c *cardmarket.ApiClient,
+ onVacation bool,
+ cancelOrders, relistItems *bool,
+) error {
+ params := make(map[string]string, 3)
+
+ if onVacation {
+ params["onVacation"] = "true"
+ } else {
+ params["onVacation"] = "false"
+ }
+
+ if cancelOrders != nil {
+ if *cancelOrders {
+ params["cancelOrders"] = "true"
+ if relistItems != nil && *relistItems {
+ params["relistItems"] = "true"
+ }
+ } else {
+ params["cancelOrders"] = "false"
+ params["relistItems"] = "false"
+ }
+ }
+
+ if err := c.Put(
+ ctx,
+ "/account/vacation",
+ params,
+ "",
+ nil,
+ nil,
+ ); err != nil {
+ return err
+ }
+
+ return nil
+}