order3000 1.10.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.cjs CHANGED
@@ -627,6 +627,33 @@ class BasketsResource extends BaseResource {
627
627
  }
628
628
  }
629
629
 
630
+ class BeveragesResource extends BaseResource {
631
+ constructor(tokenManager, baseUrl) {
632
+ super(tokenManager, baseUrl, "/beverages");
633
+ }
634
+ /**
635
+ * Upload an asset image for a beverage. The SDK builds the multipart body
636
+ * internally — pass a Buffer/Uint8Array, the original filename, the MIME type,
637
+ * and optional discovery `tags` (e.g. `['lunch-menu']`). The asset is stored,
638
+ * tagged, and linked to the beverage via `beverage_assets`; returns the new
639
+ * asset and its public URL. The beverage is addressed by its accessor.
640
+ */
641
+ async uploadAsset(idOrAccessor, file) {
642
+ const form = new FormData();
643
+ form.append(
644
+ "file",
645
+ new Blob([new Uint8Array(file.data)], { type: file.contentType }),
646
+ file.filename
647
+ );
648
+ if (file.tags?.length) form.append("tags", file.tags.join(","));
649
+ return this.requestMultipart(
650
+ "POST",
651
+ `/${encodeURIComponent(idOrAccessor)}/assets`,
652
+ form
653
+ );
654
+ }
655
+ }
656
+
630
657
  class CalloutsResource extends BaseResource {
631
658
  constructor(tokenManager, baseUrl) {
632
659
  super(tokenManager, baseUrl, "/callouts");
@@ -668,6 +695,56 @@ class CalloutsResource extends BaseResource {
668
695
  }
669
696
  }
670
697
 
698
+ class DishesResource extends BaseResource {
699
+ constructor(tokenManager, baseUrl) {
700
+ super(tokenManager, baseUrl, "/dishes");
701
+ }
702
+ /**
703
+ * Fetch a dish by its `accessor` slug (localized name/description, dietary
704
+ * flags, price, assets with public URLs). Pair with `patch` for a safe
705
+ * read-modify-write rename that preserves untouched locales + flags.
706
+ */
707
+ async get(accessor) {
708
+ return this.request(
709
+ "GET",
710
+ `/${encodeURIComponent(accessor)}`
711
+ );
712
+ }
713
+ /**
714
+ * Edit a dish by id. `editDish` replaces the fields it receives (localized
715
+ * `name` is required), so callers wanting a partial change should read the
716
+ * dish with `get` first and merge. Returns the updated dish row.
717
+ */
718
+ async patch(dishId, body) {
719
+ return this.request(
720
+ "PATCH",
721
+ `/${encodeURIComponent(dishId)}`,
722
+ body
723
+ );
724
+ }
725
+ /**
726
+ * Upload an asset image for a dish. The SDK builds the multipart body
727
+ * internally — pass a Buffer/Uint8Array, the original filename, the MIME type,
728
+ * and optional discovery `tags` (e.g. `['lunch-menu']`). The asset is stored,
729
+ * tagged, and linked to the dish via `dish_assets`; returns the new asset and
730
+ * its public URL. The dish is addressed by its accessor.
731
+ */
732
+ async uploadAsset(idOrAccessor, file) {
733
+ const form = new FormData();
734
+ form.append(
735
+ "file",
736
+ new Blob([new Uint8Array(file.data)], { type: file.contentType }),
737
+ file.filename
738
+ );
739
+ if (file.tags?.length) form.append("tags", file.tags.join(","));
740
+ return this.requestMultipart(
741
+ "POST",
742
+ `/${encodeURIComponent(idOrAccessor)}/assets`,
743
+ form
744
+ );
745
+ }
746
+ }
747
+
671
748
  class EventsResource extends BaseResource {
672
749
  constructor(tokenManager, baseUrl) {
673
750
  super(tokenManager, baseUrl, "/events");
@@ -1624,7 +1701,9 @@ class O3KClient {
1624
1701
  __publicField(this, "articles");
1625
1702
  __publicField(this, "assets");
1626
1703
  __publicField(this, "baskets");
1704
+ __publicField(this, "beverages");
1627
1705
  __publicField(this, "callouts");
1706
+ __publicField(this, "dishes");
1628
1707
  __publicField(this, "events");
1629
1708
  __publicField(this, "menus");
1630
1709
  __publicField(this, "orders");
@@ -1651,7 +1730,9 @@ class O3KClient {
1651
1730
  this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
1652
1731
  this.assets = new AssetsResource(this.tokenManager, this.baseUrl);
1653
1732
  this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
1733
+ this.beverages = new BeveragesResource(this.tokenManager, this.baseUrl);
1654
1734
  this.callouts = new CalloutsResource(this.tokenManager, this.baseUrl);
1735
+ this.dishes = new DishesResource(this.tokenManager, this.baseUrl);
1655
1736
  this.events = new EventsResource(this.tokenManager, this.baseUrl);
1656
1737
  this.menus = new MenusResource(this.tokenManager, this.baseUrl);
1657
1738
  this.orders = new OrdersResource(this.tokenManager, this.baseUrl);