### Install appie-go Library Source: https://github.com/aaearon/appie-go/blob/main/README.md Use 'go get' to install the appie-go library for your Go project. ```bash go get github.com/gwillem/appie-go ``` -------------------------------- ### Install Appie Go Library and CLI Source: https://context7.com/aaearon/appie-go/llms.txt Instructions for installing the Appie Go library using `go get` and the CLI tool using `go install`. ```bash # Library go get github.com/gwillem/appie-go # CLI tool go install github.com/gwillem/appie-go/cmd/appie@latest ``` -------------------------------- ### Appie Go Usage Example Source: https://github.com/aaearon/appie-go/blob/main/plan.md Example demonstrating how to initialize the Appie client, refresh authentication tokens, search for products, add items to an order, and save configuration. ```go package main import ( "context" "fmt" "log" appie "github.com/gwillem/appie-go" ) func main() { // Load client from config file client, err := appie.NewWithConfig(".appie.json") if err != nil { log.Fatal(err) } ctx := context.Background() // Refresh token if needed if err := client.RefreshToken(ctx); err != nil { log.Fatal(err) } // Search for products products, err := client.SearchProducts(ctx, "melk", 10) if err != nil { log.Fatal(err) } for _, p := range products { fmt.Printf("%s - €%.2f\n", p.Title, p.Price.Now) } // Add to order err = client.AddToOrder(ctx, []appie.OrderItem{ {ProductID: products[0].ID, Quantity: 1}, }) if err != nil { log.Fatal(err) } // Save updated tokens client.SaveConfig() } ``` -------------------------------- ### appie CLI Usage Examples Source: https://github.com/aaearon/appie-go/blob/main/README.md Provides examples of common appie CLI commands for login, product search, accessing last-chance bargains, managing receipts, orders, and shopping lists. Configuration can be overridden with the -c flag. ```bash # Login to Albert Heijn (opens browser for OAuth) appie login # Search products appie search "pindakaas" appie search --bonus "kaas" # only bonus products # Last-chance bargains (laatste kans koopjes) appie koopjes 3521GZ # by postal code # Receipts appie receipt # list recent receipts appie receipt show # show items, discounts, payment # Orders appie order # list open orders appie order show # show order contents appie order add # add product (by ID or search term) appie order rm # remove product # Shopping lists appie list # list all shopping lists appie list show # show items in a list appie list add # add product (by ID or search term) appie list rm # remove product ``` -------------------------------- ### Product Search Response Example Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example structure of a product returned from the search endpoint. Includes details like pricing, bonus information, and availability. ```json { "webshopId": 436752, "hqId": 60727, "title": "AH Biologisch Rundergehakt", "salesUnitSize": "300 g", "unitPriceDescription": "normale prijs per kg €20.97", "images": [ {"width": 800, "height": 800, "url": "https://static.ah.nl/..."} ], "currentPrice": 5.66, "priceBeforeBonus": 6.29, "isBonus": true, "bonusMechanism": "10% KORTING", "mainCategory": "Vlees", "subCategory": "Rundergehakt", "brand": "AH Biologisch", "nutriscore": "D", "availableOnline": true, "isPreviouslyBought": true, "orderAvailabilityStatus": "IN_ASSORTMENT", "isOrderable": true, "propertyIcons": ["biologisch"], "discountLabels": [ {"code": "DISCOUNT_PERCENTAGE", "defaultDescription": "10% korting", "percentage": 10} ] } ``` -------------------------------- ### FetchOrderTrackTrace Variables Example Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example JSON object for variables required by the FetchOrderTrackTrace query. ```json { "orderId": 229775812 } ``` -------------------------------- ### Install appie CLI Tool Source: https://github.com/aaearon/appie-go/blob/main/README.md Installs the 'appie' command-line interface tool using 'go install'. This tool allows interaction with the Albert Heijn API from the terminal. ```bash go install github.com/gwillem/appie-go/cmd/appie@latest ``` -------------------------------- ### FetchOrderTrackTrace GraphQL Response Example Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example JSON response for the FetchOrderTrackTrace query, showing delivery status and details. ```json { "data": { "order": { "__typename": "Order", "delivery": { "__typename": "Delivery", "trackAndTraceV2": { "__typename": "TrackAndTraceV2", "orderId": 229775812, "type": "DELIVERED", "orderType": "HOME_DELIVERY", "message": "Je boodschappen zijn bezorgd.", "etaBlock": null } } } } } ``` -------------------------------- ### FetchMember GraphQL Response Example Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example JSON response for the FetchMember query, illustrating the structure of member data. ```json { "data": { "member": { "id": 27993385, "emailAddress": "user@example.com", "gender": "MALE", "dateOfBirth": "1985-03-15", "phoneNumber": "+31612345678", "isB2B": false, "name": { "first": "Jan", "last": "de Vries" }, "address": { "street": "Hoofdstraat", "houseNumber": 42, "houseNumberExtra": "A", "postalCode": "1234AB", "city": "AMSTERDAM", "countryCode": "NL" }, "cards": { "bonus": "2620123456789", "gall": null, "airmiles": null }, "customerProfileAudiences": ["segment1", "segment2"] } } } ``` -------------------------------- ### Get Webflow Config (v2) Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieve configuration settings for Webflow. ```http GET /mobile-services/v2/webflow ``` -------------------------------- ### Get Spotlight Bonus Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves bonus products that are currently in the spotlight. ```APIDOC ### Get Spotlight Bonus #### Description Retrieves bonus products that are currently in the spotlight. ### Method GET ### Endpoint /mobile-services/bonuspage/v2/section/spotlight?application=AHWEBSHOP&date= ### Parameters #### Query Parameters - **application** (string) - Required - The application context (e.g., 'AHWEBSHOP'). - **date** (string) - Required - The date for which to retrieve products in 'YYYY-MM-DD' format. ``` -------------------------------- ### Get Products by IDs Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieve product details by their IDs. ```APIDOC ## GET /mobile-services/product/search/v2/products ### Description Retrieve product details by their IDs. ### Method GET ### Endpoint /mobile-services/product/search/v2/products ### Query Parameters - **ids** (string) - Required - One or more product IDs. - **sortOn** (string) - Optional - Sorting order. Use `INPUT_PRODUCT_IDS` to maintain the order of provided IDs. ### Request Example ``` GET /mobile-services/product/search/v2/products?ids=603740&ids=603734&sortOn=INPUT_PRODUCT_IDS ``` ``` -------------------------------- ### Fetch UI Entry Points Variables Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example variables for the `FetchEntryPoints` GraphQL query, specifying the component name and version. ```json { "name": "my-ah-lane-nl", "version": "9.28" } ``` -------------------------------- ### Retrieve Shopping Lists with Appie-Go Source: https://context7.com/aaearon/appie-go/llms.txt Use GetShoppingLists to fetch all user lists and GetShoppingListItems to retrieve items for a specific list. This example demonstrates iterating through lists and their items. ```go package main import ( "context" "fmt" "log" appie "github.com/gwillem/appie-go" ) func main() { client, _ := appie.NewWithConfig("~/.config/appie/config.json") ctx := context.Background() lists, err := client.GetShoppingLists(ctx, 0) if err != nil { log.Fatal(err) } for _, l := range lists { fmt.Printf("%-40s %-20s %d items\n", l.ID, l.Name, l.ItemCount) items, err := client.GetShoppingListItems(ctx, l.ID) if err != nil { log.Printf(" items: %v", err) continue } for _, item := range items { fmt.Printf(" ProductID=%-6d qty=%d\n", item.ProductID, item.Quantity) } } // Output: // a1b2c3d4-... Boodschappen 12 items // ProductID=371880 qty=2 // ProductID=192450 qty=1 } ``` -------------------------------- ### List Shopping Lists Overview Source: https://github.com/aaearon/appie-go/blob/main/doc/cli.md Displays a summary of all available shopping lists, showing their IDs, names, and item counts. Use this to get an overview of your lists. ```bash $ appie list a1b2c3d4-e5f6-7890-abcd-ef1234567890 Boodschappen 12 items e5f6a7b8-c9d0-1234-5678-abcdef012345 Weekmenu 5 items ``` -------------------------------- ### Get Cross-sells Recommendations (v2) Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Request product recommendations for cross-selling. This endpoint requires details about the desired limit, experiment ID, product ID, and items currently in the basket. ```http POST /mobile-services/v2/recommendations/crosssells ``` ```json { "limit": 6, "experimentId": "exp-var-with-category", "productId": 165625, "propensityFilter": true, "basketItems": [ { "productId": 165625, "position": 2, "quantity": 1 } ] } ``` -------------------------------- ### FetchRecommendedRecipes Response Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example JSON response for the `FetchRecommendedRecipes` query, showing recipe recommendations, member preferences, and available weeks. ```json { "data": { "recommendations": { "memberPreferencePreviewOptions": [ { "href": "https://www.ah.nl/allerhande/voorkeuren?mobile=true&dieet=FLEXITARISCH", "label": "Mix van vlees, vis en groente", "value": "FLEXITARIAN", "image": { "url": "https://static.ah.nl/static/preferences/flexitarian.png", "width": 87, "height": 87 } } ], "recipeRecommendations": [ { "id": "12345", "recipe": { "id": 12345, "title": "Pasta carbonara", "time": { "cook": 25 }, "nutriScore": "B" } } ], "bonusRecipes": [], "servingSize": 2, "availableWeeks": [ { "startDate": "2026-02-09", "endDate": "2026-02-15", "activeWeek": true } ] } } } ``` -------------------------------- ### Fetch Store Variables Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example variables for the `FetchStore` GraphQL query, specifying the `storeId` for the store to be fetched. ```json { "storeId": 1527 } ``` -------------------------------- ### Get Product Detail Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves detailed information about a specific product using its webshop ID. ```APIDOC ## GET /mobile-services/product/detail/v4/fir/ ### Description Retrieves detailed information about a specific product. ### Method GET ### Endpoint /mobile-services/product/detail/v4/fir/ ### Parameters #### Path Parameters - **webshopId** (string) - Required - The unique identifier for the webshop product. ### Response #### Success Response (200) - **productId** (integer) - The product's unique identifier. - **productCard** (object) - Contains detailed product information including title, brand, images, pricing, and nutritional data. - **properties** (array) - Additional product properties. - **tradeItem** (object) - Trade-specific item details. - **disclaimerText** (string) - Any disclaimers related to the product. ``` -------------------------------- ### Get All Lists (v3) Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Fetches all shopping lists associated with a user. The `productId` parameter is required but does not filter the results. ```http GET /mobile-services/lists/v3/lists?productId= ``` -------------------------------- ### Login Source: https://context7.com/aaearon/appie-go/llms.txt Initiates an OAuth browser login flow. It starts a local reverse proxy, opens the system browser to the AH login page, waits for the authorization code, and exchanges it for access and refresh tokens. Tokens are automatically saved if a configuration path is provided. ```APIDOC ## `Login` — OAuth Browser Login Starts a local reverse proxy, opens the system browser to the AH login page, waits for the OAuth authorization code, and exchanges it for access + refresh tokens. Tokens are auto-saved when a config path is set. ```go package main import ( "context" "fmt" "log" appie "github.com/gwillem/appie-go" ) func main() { // Config path enables auto-save and auto-load on next run client, err := appie.NewWithConfig("~/.config/appie/config.json") if err != nil { log.Fatal(err) } ctx := context.Background() if !client.IsAuthenticated() { if err := client.Login(ctx); err != nil { log.Fatalf("login: %v", err) } fmt.Println("login successful") } else { fmt.Println("already authenticated (loaded from config)") } } ``` ``` -------------------------------- ### Get Favorite Store Response Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example JSON response for the `GetFavoriteStore` query, detailing the address, opening hours, geolocation, phone number, store type, and available services of the user's favorite store. ```json { "data": { "storesFavouriteStore": { "id": 1527, "address": { "street": "Nachtegaalstraat", "houseNumber": 48, "postalCode": "3581AD", "city": "Utrecht" }, "openingDays": [ { "date": "2026-02-03", "openingHour": { "openFrom": "08:00", "openUntil": "22:00" } } ], "geoLocation": { "latitude": 52.09, "longitude": 5.12 }, "phone": "030-2345678", "storeType": "AH", "services": [{ "code": "PICKUP" }, { "code": "SELFSERVICE" }] } } } ``` -------------------------------- ### Appie Go Client Initialization and Configuration Source: https://github.com/aaearon/appie-go/blob/main/plan.md Functions for creating and configuring the Appie client, including loading from a file and saving configuration. ```go // client.go func New(opts ...Option) *Client func NewWithConfig(configPath string) (*Client, error) func (c *Client) LoadConfig(path string) error func (c *Client) SaveConfig() error func (c *Client) IsAuthenticated() bool ``` -------------------------------- ### Construct Appie Go Client Source: https://context7.com/aaearon/appie-go/llms.txt Demonstrates creating an anonymous client with default settings, a client with custom HTTP client and logger, and a client that loads persisted tokens from a JSON file for authenticated access. ```go package main import ( "log" appie "github.com/gwillem/appie-go" ) func main() { // Minimal anonymous client anonClient := appie.New() // Client with custom HTTP client and verbose logger customClient := appie.New( appie.WithHTTPClient(myHTTPClient), appie.WithLogger(log.Default()), ) // Client that loads saved tokens from disk (tokens auto-refreshed) authClient, err := appie.NewWithConfig("~/.config/appie/config.json") if err != nil { log.Fatal(err) } _ = anonClient _ = customClient _ = authClient } ``` -------------------------------- ### Search Products Source: https://context7.com/aaearon/appie-go/llms.txt Demonstrates basic product search by query string and limit, and filtered search for bonus products using `SearchProductsFiltered` with `SearchOptions`. Ensure an anonymous token is obtained or the client is authenticated before use. ```go package main import ( "context" "fmt" "log" appie "github.com/gwillem/appie-go" ) func main() { client := appie.New() ctx := context.Background() if err := client.GetAnonymousToken(ctx); err != nil { log.Fatal(err) } // Basic search products, err := client.SearchProducts(ctx, "pindakaas", 5) if err != nil { log.Fatal(err) } for _, p := range products { fmt.Printf("%6d %-35s %8s €%.2f\n", p.ID, p.Title, p.UnitSize, p.Price.Now) } // Output: // 192450 AH Biologisch pindakaas 350 g €2.89 // 371880 AH Pindakaas naturel 600 g €3.59 // Bonus-only search bonusProducts, err := client.SearchProductsFiltered(ctx, appie.SearchOptions{ Query: "kaas", Limit: 10, Bonus: true, }) if err != nil { log.Fatal(err) } for _, p := range bonusProducts { fmt.Printf("% -30s %s → €%.2f\n", p.Title, p.BonusMechanism, p.Price.Now) } } ``` -------------------------------- ### Client Initialization Source: https://github.com/aaearon/appie-go/blob/main/plan.md Functions for creating and configuring the Appie client. ```APIDOC ## Client Initialization ### Description Functions for creating and configuring the Appie client. ### Functions - `New(opts ...Option) *Client`: Creates a new client with provided options. - `NewWithConfig(configPath string) (*Client, error)`: Creates a new client and loads configuration from a file. - `LoadConfig(path string) error`: Loads client configuration from a specified file path. - `SaveConfig() error`: Saves the current client configuration. ``` -------------------------------- ### Authenticated Access with appie-go Source: https://github.com/aaearon/appie-go/blob/main/README.md Shows how to initialize the appie-go client with configuration and log in to access authenticated features. The client automatically handles token refresh. ```go client, err := appie.NewWithConfig(".appie.json") ctx := context.Background() if err := client.Login(ctx); err != nil { log.Fatal(err) } // Tokens are auto-saved when configPath is set ``` -------------------------------- ### ContentCuratedListItemInput Source: https://github.com/aaearon/appie-go/blob/main/doc/graphql-schema-20260118.md Arguments to get product suggestions. ```APIDOC ## ContentCuratedListItemInput ### Description Arguments to get product suggestions. ### Type Input Object ``` -------------------------------- ### Appie Bonus Products Command Source: https://github.com/aaearon/appie-go/blob/main/doc/cli.md List bonus or promotion products. Use -d to specify a date and -s to show only spotlight deals. ```bash -d, --date DATE Bonus date in YYYY-MM-DD format (default: today) -s, --spotlight Show only spotlight/featured deals ``` ```bash $ appie bonus Bonus week 21 feb - 27 feb Product Was Now Discount AH Verse pizza → 4.99 3.49 30% korting Alle Hak 370-720ml → 2.19 1.09 2e halve prijs Dove Douchegel 250ml → 3.29 1.99 1+1 gratis ... (247 products) ``` -------------------------------- ### Run Unit and Integration Tests in Go Source: https://github.com/aaearon/appie-go/blob/main/CLAUDE.md Use `just test` for unit tests and `just integration-test` for integration tests. For specific tests, use `go test` with the `-run` flag. Integration tests require authentication via `.appie.json`. ```bash just test just integration-test # Run a single test go test -run TestSearchProducts -v ./... go test -tags integration -run TestGetBonusProductsBatch -v -count=1 ./... ``` -------------------------------- ### Get Webflow Config Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves the webflow configuration. ```APIDOC ### Get Webflow Config #### Description Retrieves the webflow configuration. ### Method GET ### Endpoint /mobile-services/v2/webflow ``` -------------------------------- ### Get Checkout Info Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves checkout-related information for an order. ```APIDOC ## GET /mobile-services/order/v1//checkout ### Description Retrieves checkout information for a specific order. ### Method GET ### Endpoint /mobile-services/order/v1//checkout ### Parameters #### Path Parameters - **orderId** (string) - Required - The unique identifier for the order. ``` -------------------------------- ### Appie Search Command Source: https://github.com/aaearon/appie-go/blob/main/doc/cli.md Search for products by name, sorted by price. Use product IDs with 'order add' or 'list add'. The -n flag limits results. ```bash -n, --limit NUM Max results (default: 20) --bonus Only show products on bonus/promotion ``` ```bash $ appie search "pindakaas" 192450 AH Biologisch pindakaas 350 g €2.89 371880 AH Pindakaas naturel 600 g €3.59 204835 Calvé Pindakaas 650 g €4.49 ... ``` -------------------------------- ### Client Construction Source: https://context7.com/aaearon/appie-go/llms.txt Demonstrates how to create a new client instance using `New` for a minimal anonymous client or `NewWithConfig` to load persisted tokens from a JSON file. Functional options can be provided for custom HTTP clients and loggers. ```APIDOC ## Client Construction `New` creates a zero-config client. `NewWithConfig` loads persisted tokens from a JSON file and returns a ready-to-use client that survives process restarts. Both accept functional options. ```go package main import ( "log" appie "github.com/gwillem/appie-go" ) func main() { // Minimal anonymous client anonClient := appie.New() // Client with custom HTTP client and verbose logger customClient := appie.New( appie.WithHTTPClient(myHTTPClient), appie.WithLogger(log.Default()), ) // Client that loads saved tokens from disk (tokens auto-refreshed) authClient, err := appie.NewWithConfig("~/.config/appie/config.json") if err != nil { log.Fatal(err) } _ = anonClient _ = customClient _ = authClient } ``` ``` -------------------------------- ### Get Category Sub-categories Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Fetches sub-categories for a given category ID. ```http GET /mobile-services/v1/product-shelves/categories//sub-categories ``` -------------------------------- ### FullfillmentDateRange Source: https://github.com/aaearon/appie-go/blob/main/doc/graphql-schema-20260118.md Date range for fulfillment, including start and end dates. ```APIDOC ## FullfillmentDateRange ### Description Date range start and end date. ### Type Input Object ``` -------------------------------- ### FetchOrderMinimumValueLimits Variables Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Example variables for the `FetchOrderMinimumValueLimits` GraphQL query, specifying an `orderId`. ```json { "orderId": 196321485 } ``` -------------------------------- ### Appie CLI Global Options Source: https://github.com/aaearon/appie-go/blob/main/doc/cli.md Global options that can be applied to any Appie command. Use -c to specify a config file and -v for verbose output. ```bash appie [options] -c, --config PATH Config file (default: ~/.config/appie/config.json) -v, --verbose Verbose output ``` -------------------------------- ### Get Feature Flags Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves feature flag configurations for the iOS platform. ```APIDOC ## Configuration ### Get Feature Flags #### Description Retrieves feature flag configurations for the iOS platform. ### Method GET ### Endpoint /mobile-services/config/v1/features/ios?version=9.28 ### Parameters #### Query Parameters - **version** (string) - Required - The version of the application. ``` -------------------------------- ### Go Build Verification Source: https://github.com/aaearon/appie-go/blob/main/CLAUDE.md Always use `go test ./...` to verify compilation; never use `go build`. ```go go test ./... ``` -------------------------------- ### Get Personal Bonus Products Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves bonus products that are personalized for the user. ```APIDOC ### Get Personal Bonus Products #### Description Retrieves bonus products that are personalized for the user. ### Method GET ### Endpoint /mobile-services/bonuspage/v2/section/personal?application=AHWEBSHOP&date= ### Parameters #### Query Parameters - **application** (string) - Required - The application context (e.g., 'AHWEBSHOP'). - **date** (string) - Required - The date for which to retrieve products in 'YYYY-MM-DD' format. ### Response #### Success Response (200) - **sectionType** (string) - The type of the bonus section. - **sectionDescription** (string) - A description of the bonus section. - **bonusGroupOrProducts** (array) - A list of bonus groups or products. - **bonusGroup** (object) - Details about a bonus group. - **id** (string) - The ID of the bonus group. - **offerId** (integer) - The offer ID. - **segmentDescription** (string) - Description of the bonus segment. - **discountDescription** (string) - Description of the discount. - **category** (string) - The category of the bonus offer. - **promotionType** (string) - The type of promotion. - **segmentType** (string) - The type of segment. - **activationStatus** (string) - The activation status of the bonus. - **bonusStartDate** (string) - The start date of the bonus offer. - **bonusEndDate** (string) - The end date of the bonus offer. - **images** (array) - List of images associated with the bonus offer. ### Response Example ```json { "sectionType": "PO", "sectionDescription": "Persoonlijke Bonus", "bonusGroupOrProducts": [ { "bonusGroup": { "id": "385568", "offerId": 894018, "segmentDescription": "AH Pancakes", "discountDescription": "VOOR 2.00", "category": "Maaltijden, salades", "promotionType": "PERSONAL", "segmentType": "BBOX", "activationStatus": "ACTIVATED", "bonusStartDate": "2026-02-09", "bonusEndDate": "2026-02-15", "images": [] } } ] } ``` ``` -------------------------------- ### Retrieve Promotional Products Source: https://context7.com/aaearon/appie-go/llms.txt Use `GetSpotlightBonusProducts` for featured deals and `GetBonusProducts` for all promotions. `GetBonusGroupProducts` can resolve group-level promotions to individual items. ```go package main import ( "context" "fmt" "log" appie "github.com/gwillem/appie-go" ) func main() { client := appie.New() ctx := context.Background() _ = client.GetAnonymousToken(ctx) spotlight, err := client.GetSpotlightBonusProducts(ctx) if err != nil { log.Fatal(err) } for _, p := range spotlight { fmt.Printf("% -35s €%.2f → €%.2f %s\n", p.Title, p.Price.Was, p.Price.Now, p.BonusMechanism) } // Output: // AH Verse pizza €4.99 → €3.49 30% korting // Dove Douchegel 250ml €3.29 → €1.99 1+1 gratis // Resolve a group-level promotion to individual products all, _ := client.GetBonusProducts(ctx) for _, p := range all { if p.BonusSegmentID != "" && p.ID == 0 { groupProducts, err := client.GetBonusGroupProducts(ctx, p.BonusSegmentID) if err != nil { log.Printf("group %s: %v", p.BonusSegmentID, err) continue } for _, gp := range groupProducts { fmt.Printf(" %s €%.2f\n", gp.Title, gp.Price.Now) } break } } } ``` -------------------------------- ### Get Bonus Metadata Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves metadata related to bonus programs and promotions. ```APIDOC ## Bonus / Promotions ### Get Bonus Metadata #### Description Retrieves metadata related to bonus programs and promotions. ### Method GET ### Endpoint /mobile-services/bonuspage/v3/metadata ``` -------------------------------- ### Get Category Sub-categories Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves a list of sub-categories for a given category ID. ```APIDOC ## GET /mobile-services/v1/product-shelves/categories//sub-categories ### Description Retrieves a list of sub-categories for a given category. ### Method GET ### Endpoint /mobile-services/v1/product-shelves/categories//sub-categories ### Parameters #### Path Parameters - **categoryId** (string) - Required - The unique identifier for the category. ``` -------------------------------- ### FetchEntryPoints Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Fetches UI entry points for the home screen. ```APIDOC ## FetchEntryPoints ### Description Fetches UI entry points for the home screen. ```graphql query FetchEntryPoints($name: String!, $version: String) { entryPointComponent(name: $name, version: $version) { name content { ... } entryPoints { name contentVariant { ... } metadata { group, dismissible } } } } ``` **Variables:** ```json { "name": "my-ah-lane-nl", "version": "9.28" } ``` ``` -------------------------------- ### Batch Product Lookup by IDs Source: https://context7.com/aaearon/appie-go/llms.txt Use `GetProductsByIDs` to fetch multiple products efficiently in a single request. Products are returned in the order of the provided IDs. ```go package main import ( "context" "fmt" "log" appie "github.com/gwillem/appie-go" ) func main() { client := appie.New() ctx := context.Background() _ = client.GetAnonymousToken(ctx) ids := []int{371880, 192450, 204835} products, err := client.GetProductsByIDs(ctx, ids) if err != nil { log.Fatal(err) } for _, p := range products { fmt.Printf("%d %s €%.2f\n", p.ID, p.Title, p.Price.Now) } // Output: // 371880 AH Pindakaas naturel €3.59 // 192450 AH Biologisch pindakaas €2.89 // 204835 Calvé Pindakaas €4.49 } ``` -------------------------------- ### SubscriptionNextSubscription Source: https://github.com/aaearon/appie-go/blob/main/doc/graphql-schema-20260118.md Describes the next subscription in a sequence, including its start date and price. ```APIDOC ## Type: SubscriptionNextSubscription ### Description Description of next subscription. ### Fields - `id`: ID - `code`: String - `description`: String - `startDate`: String - `price`: Money ``` -------------------------------- ### Anonymous Product Browsing with appie-go Source: https://github.com/aaearon/appie-go/blob/main/README.md Demonstrates how to browse products anonymously using the appie-go client. Requires obtaining an anonymous token before searching. ```go package main import ( "context" "fmt" "log" appie "github.com/gwillem/appie-go" ) func main() { client := appie.New() ctx := context.Background() // Get anonymous token for product browsing if err := client.GetAnonymousToken(ctx); err != nil { log.Fatal(err) } // Search for products products, err := client.SearchProducts(ctx, "hagelslag", 5) if err != nil { log.Fatal(err) } for _, p := range products { fmt.Printf("%s - €%.2f\n", p.Title, p.Price.Now) } } ``` -------------------------------- ### Get Cross-sells Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves product recommendations for cross-selling based on the current basket and product. ```APIDOC ## Recommendations ### Get Cross-sells #### Description Retrieves product recommendations for cross-selling based on the current basket and product. ### Method POST ### Endpoint /mobile-services/v2/recommendations/crosssells ### Request Body - **limit** (integer) - Optional - The maximum number of recommendations to return. - **experimentId** (string) - Optional - An identifier for A/B testing experiments. - **productId** (integer) - Optional - The ID of the product for which to get cross-sells. - **propensityFilter** (boolean) - Optional - Whether to apply propensity filtering. - **basketItems** (array) - Optional - A list of items currently in the user's basket. - **productId** (integer) - Required - The product ID of the item. - **position** (integer) - Required - The position of the item in the basket. - **quantity** (integer) - Required - The quantity of the item. ### Request Example ```json { "limit": 6, "experimentId": "exp-var-with-category", "productId": 165625, "propensityFilter": true, "basketItems": [ { "productId": 165625, "position": 2, "quantity": 1 } ] } ``` ### Response #### Success Response (200) - The response format is the same as the 'Get "Don't Forget" Lane' endpoint. ``` -------------------------------- ### Get Receipt Details Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves the detailed information for a specific in-store purchase receipt. ```APIDOC ### Get Receipt Details #### Description Retrieves the detailed information for a specific in-store purchase receipt. ### Method GET ### Endpoint /mobile-services/v2/receipts/ ### Parameters #### Path Parameters - **transactionId** (string) - Required - The unique identifier of the transaction for which to retrieve details. ### Response #### Success Response (200) - **transactionId** (string) - The unique ID of the transaction. - **datetime** (string) - The date and time of the transaction. - **storeId** (integer) - The ID of the store where the purchase was made. - **storeName** (string) - The name of the store. - **total** (number) - The total amount of the receipt. - **receiptItems** (array) - A list of items included in the receipt. - **description** (string) - The description of the item. - **quantity** (integer) - The quantity of the item purchased. - **amount** (number) - The total amount for this item line. - **unitPrice** (number) - The price per unit of the item. - **productId** (integer) - The product ID of the item. ### Response Example ```json { "transactionId": "1234567890", "datetime": "2026-01-20T14:30:00", "storeId": 1234, "storeName": "AH Utrecht Centrum", "total": 45.67, "receiptItems": [ { "description": "AH Halfvolle melk", "quantity": 2, "amount": 2.58, "unitPrice": 1.29, "productId": 12345 } ] } ``` ``` -------------------------------- ### Retrieve Order and Fulfillment Information Source: https://context7.com/aaearon/appie-go/llms.txt Use `GetOrder` for the active cart, `GetFulfillments` for scheduled deliveries, and `GetOrderDetails` for specific order items. Requires configuration with `NewWithConfig`. ```go package main import ( "context" "fmt" "log" appie "github.com/gwillem/appie-go" ) func main() { client, _ := appie.NewWithConfig("~/.config/appie/config.json") ctx := context.Background() // Active cart order, err := client.GetOrder(ctx) if err != nil { log.Fatal(err) } fmt.Printf("Cart: %d items, €%.2f (saved €%.2f)\n", order.TotalCount, order.TotalPrice, order.TotalDiscount) // Scheduled deliveries fulfillments, err := client.GetFulfillments(ctx) if err != nil { log.Fatal(err) } for _, f := range fulfillments { fmt.Printf("Order %d %-12s %s %s €%.2f modifiable=%v\n", f.OrderID, f.StatusDescription, f.Delivery.Slot.DateDisplay, f.Delivery.Slot.TimeDisplay, f.TotalPrice, f.Modifiable) } // Output: // Order 1234567 SUBMITTED dinsdag 25 feb 18:00-20:00 €87.30 modifiable=true // Full item list for a submitted order details, err := client.GetOrderDetails(ctx, 1234567) if err != nil { log.Fatal(err) } for _, item := range details.Items { fmt.Printf(" %2dx %-30s €%.2f\n", item.Quantity, item.Product.Title, item.Product.Price.Now) } } ``` -------------------------------- ### Fetch UI Entry Points GraphQL Query Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md GraphQL query to fetch UI entry points for the home screen, allowing for dynamic content loading. Specify the `name` and optionally the `version` of the component to retrieve. ```graphql query FetchEntryPoints($name: String!, $version: String) { entryPointComponent(name: $name, version: $version) { name content { ... } entryPoints { name contentVariant { ... } metadata { group, dismissible } } } } ``` -------------------------------- ### Get Bonus Metadata Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Endpoint to retrieve metadata related to bonus programs and promotions. ```http GET /mobile-services/bonuspage/v3/metadata ``` -------------------------------- ### Get Active Order Summary Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves a summary of active orders, with options to sort. ```http GET /mobile-services/order/v1/summaries/active?sortBy=DEFAULT ``` -------------------------------- ### Get Previously Bought Bonus Products Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves bonus products that the user has previously purchased. ```APIDOC ### Get Previously Bought Bonus Products #### Description Retrieves bonus products that the user has previously purchased. ### Method GET ### Endpoint /mobile-services/bonuspage/v2/section/previously-bought?application=AHWEBSHOP&date= ### Parameters #### Query Parameters - **application** (string) - Required - The application context (e.g., 'AHWEBSHOP'). - **date** (string) - Required - The date for which to retrieve products in 'YYYY-MM-DD' format. ### Response #### Success Response (200) - **sectionType** (string) - The type of the bonus section. - **sectionDescription** (string) - A description of the bonus section. - **bonusGroupOrProducts** (array) - A list of bonus groups or products. - **bonusGroup** (object) - Details about a bonus group. - **id** (string) - The ID of the bonus group. - **offerId** (integer) - The offer ID. - **segmentDescription** (string) - Description of the bonus segment. - **discountDescription** (string) - Description of the discount. - **category** (string) - The category of the bonus offer. - **promotionType** (string) - The type of promotion. - **segmentType** (string) - The type of segment. - **activationStatus** (string) - The activation status of the bonus. - **bonusStartDate** (string) - The start date of the bonus offer. - **bonusEndDate** (string) - The end date of the bonus offer. - **images** (array) - List of images associated with the bonus offer. ### Response Example ```json { "sectionType": "PO", "sectionDescription": "Persoonlijke Bonus", "bonusGroupOrProducts": [ { "bonusGroup": { "id": "385568", "offerId": 894018, "segmentDescription": "AH Pancakes", "discountDescription": "VOOR 2.00", "category": "Maaltijden, salades", "promotionType": "PERSONAL", "segmentType": "BBOX", "activationStatus": "ACTIVATED", "bonusStartDate": "2026-02-09", "bonusEndDate": "2026-02-15", "images": [] } } ] } ``` ``` -------------------------------- ### Get Bonus Section Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves a specific section of bonus offers based on category and date. ```APIDOC ### Get Bonus Section #### Description Retrieves a specific section of bonus offers based on category and date. ### Method GET ### Endpoint /mobile-services/bonuspage/v2/section?application=AHWEBSHOP&category=&date=&promotionType=NATIONAL ### Parameters #### Query Parameters - **application** (string) - Required - The application context (e.g., 'AHWEBSHOP'). - **category** (string) - Required - The category of bonus offers to retrieve. - **date** (string) - Required - The date for which to retrieve offers in 'YYYY-MM-DD' format. - **promotionType** (string) - Optional - The type of promotion (e.g., 'NATIONAL'). ``` -------------------------------- ### Appie Order List Command Source: https://github.com/aaearon/appie-go/blob/main/doc/cli.md List all open or scheduled orders (fulfillments), showing status, delivery details, and total cost. ```bash $ appie order Order Status Delivery Total 1234567 SUBMITTED dinsdag 25 feb 18:00-20:00 87.30 1234590 SUBMITTED vrijdag 28 feb 08:00-10:00 42.15 ``` -------------------------------- ### Get All Receipts Source: https://github.com/aaearon/appie-go/blob/main/doc/albertheijn_api.md Retrieves a list of all in-store purchase receipts from physical Albert Heijn stores. ```APIDOC ## Receipts (Kassabonnen) ### Description In-store purchase receipts from physical AH stores. ### Get All Receipts #### Description Retrieves a list of all in-store purchase receipts from physical Albert Heijn stores. ### Method GET ### Endpoint /mobile-services/v1/receipts ### Response #### Success Response (200) - **receipts** (array) - A list of receipts. - **transactionId** (string) - The unique ID of the transaction. - **datetime** (string) - The date and time of the transaction. - **storeId** (integer) - The ID of the store where the purchase was made. - **storeName** (string) - The name of the store. - **total** (number) - The total amount of the receipt. ### Response Example ```json { "receipts": [ { "transactionId": "1234567890", "datetime": "2026-01-20T14:30:00", "storeId": 1234, "storeName": "AH Utrecht Centrum", "total": 45.67 } ] } ``` ``` -------------------------------- ### ProductsInput Source: https://github.com/aaearon/appie-go/blob/main/doc/graphql-schema-20260118.md Input for 'products' query. Optionally has a date. ```APIDOC ## ProductsInput ### Description Input for 'products' query. Optionally has a date. ```