Skip to content

Order & shopping list CLI#8

Merged
gwillem merged 7 commits into
mainfrom
wdg/order
Feb 23, 2026
Merged

Order & shopping list CLI#8
gwillem merged 7 commits into
mainfrom
wdg/order

Conversation

@gwillem

@gwillem gwillem commented Feb 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add order command: bare lists open orders, show order contents, add products by ID or search, rm products (reopens submitted orders automatically)
  • Add list command: bare lists shopping lists with UUIDs, show items, add products with quantity, rm by product ID
  • Add search command for product search with tabular output
  • Standardize all resource commands to consistent <resource> [show|add|rm] <id> pattern
  • Fix AddToFavoriteList to send quantity field
  • Replace broken REST item removal with GraphQL favoriteListProductsDeleteV2
  • Fix GetProductsByIDs response decoding (bare array, not wrapped object)
  • Fix getShoppingList to populate items via GraphQL

CLI conventions

appie <resource>                              Overview (list all, showing IDs)
appie <resource> show <target>                Detail view
appie <resource> add <target> <item> [flags]  Add to target
appie <resource> rm <target> <item>           Remove from target

Test plan

  • Unit tests for findList exact UUID match and rejection of prefixes
  • Unit tests for order details parsing (order_test.go)
  • Unit tests for shopping list items and list fetching (shoppinglist_test.go)
  • Integration test for shopping list items (TestGetShoppingListItems)
  • Manual: appie order, appie order show <id>, appie order add <id> <product>, appie order rm <id> <product-id>
  • Manual: appie list, appie list show <uuid>, appie list add <uuid> <product> -n 3, appie list rm <uuid> <product-id>
  • Manual: appie receipt, appie receipt show <txn-id>
  • Manual: appie search <query>

- Add `appie order` (show active/next order), `order list`, `order use`
- Add GetOrderDetails for per-item pricing via taxonomy endpoint
- Use API-provided TotalPrice/TotalDiscount for correct totals
- Deduplicate types: remove imageResponse, inline Address/DeliverySlot
- Add Order.Subtotal() method and testdata fixture
Accepts a numeric product ID or search term. Single match adds
directly; multiple matches show a price-sorted table with sizes.
Also fixes duplicate error printing in main.go (go-flags' PrintErrors
already handles it).
Adds `appie search <query> -n N` (default 20 results). Extracts
printProducts helper from order add for reuse.
Add GetShoppingListItems via favoriteListV2 GraphQL query, fix
getShoppingList to populate items (unbreaks ClearShoppingList and
ShoppingListToOrder), and fix GetProductsByIDs response decoding.

Also fix duplicate integration test names for receipts.
All resource commands now follow a consistent pattern:
- bare command shows overview with IDs
- show <id> for detail view
- add <id> <item> for mutations
- rm <id> <item> for removal

order: replace list/use/add with show/add/rm subcommands,
  add ensureOrderOpen helper that reopens and sets order ID
list: replace name-based prefix matching with exact UUID,
  use positional list-id for show/add/rm instead of -l flag
receipt: extract show subcommand from optional positional arg

Also fix favorite list API:
- RemoveFromFavoriteList via GraphQL (favoriteListProductsDeleteV2)
  replacing broken REST v3 endpoint
- AddToFavoriteList now sends quantity field
Bare `appie receipt <id>` silently ignored the argument due to
subcommands-optional. Now all resource commands reject unexpected
positional args with a hint to use `show`.
@gwillem gwillem merged commit 6608381 into main Feb 23, 2026
1 check passed
@gwillem gwillem changed the title WIP: Order & shopping list CLI Order & shopping list CLI Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant