Documentation
¶
Overview ¶
Package rewerse provides a Go client for the REWE mobile API.
Before making any API calls, you must initialize the client with a valid certificate using SetCertificate:
err := rewerse.SetCertificate("certificate.pem", "private.key")
if err != nil {
log.Fatal(err)
}
The package is safe for concurrent use after initialization. All API functions are thread-safe once SetCertificate has been called.
Markets ¶
Search for markets by location or get market details:
markets, _ := rewerse.MarketSearch("Mannheim")
details, _ := rewerse.GetMarketDetails("840174")
Products ¶
Search products, browse categories, or get product details:
results, _ := rewerse.GetProducts("840174", "Karotten", nil)
products, _ := rewerse.GetCategoryProducts("840174", "obst-gemuese", nil)
product, _ := rewerse.GetProductByID("840174", "9900011")
Discounts ¶
Get current weekly discounts for a market:
discounts, _ := rewerse.GetDiscounts("840174")
Recipes ¶
Search recipes or get recipe details:
results, _ := rewerse.RecipeSearch(&rewerse.RecipeSearchOpts{SearchTerm: "Pasta"})
details, _ := rewerse.GetRecipeDetails("recipe-uuid")
Basket ¶
Create and manage shopping baskets:
session, _ := rewerse.CreateBasket("840174", "67065", rewerse.ServicePickup)
session.SetItemQuantity("listing-id", 2)
basket, _ := session.GetBasket()
Index ¶
- Variables
- func BuildCustomRequest(host, path string) (req *http.Request, err error)
- func BuildCustomRequestRaw(host, path string) (req *http.Request, err error)
- func BuildDeleteRequest(host, path string) (req *http.Request, err error)
- func BuildPostRequest(host, path string, body io.Reader) (req *http.Request, err error)
- func CloseWithWrap(f io.Closer, e *error)
- func DoRequest(req *http.Request, dest any) (err error)
- func NewUUID() (string, error)
- func SetCertificate(clientCert, clientKey string) error
- type Basket
- type BasketFees
- type BasketSession
- type BasketSummary
- type BeverageSurcharge
- type BulkyGoodsConfig
- type CloseError
- type Discount
- type DiscountCategory
- type Discounts
- type LineItem
- type LineItemProduct
- type Listing
- type Market
- type MarketContent
- type MarketDetails
- type MarketService
- type Markets
- type NutrientInfo
- type NutritionFact
- type PickupMarket
- type PopularSearchTerm
- type PopularSearchTerms
- type Product
- type ProductAttributes
- type ProductDetail
- type ProductFilter
- type ProductOpts
- type ProductResults
- type ProductSuggestion
- type ProductSuggestions
- type RawDiscounts
- type RawOffer
- type RawOfferCategory
- type RawOffersWeek
- type Recall
- type Recalls
- type Recipe
- type RecipeCollection
- type RecipeDetail
- type RecipeDetails
- type RecipeDifficulty
- type RecipeHub
- type RecipeIngredient
- type RecipeIngredients
- type RecipeMetadata
- type RecipeSearchOpts
- type RecipeSearchResults
- type RecipeSorting
- type ServiceConfiguration
- type ServicePortfolio
- type ServiceSelection
- type ServiceType
- type ShopCategory
- type ShopOverview
- type ShopOverviewOpts
- type Staggering
- type Staggerings
- type TimeSlotInformation
- type Violation
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotInitialized = errors.New("certificates not set; call SetCertificate first")
)
Functions ¶
func BuildCustomRequest ¶
BuildCustomRequest creates a request to /api/{path} on the given host
func BuildCustomRequestRaw ¶
BuildCustomRequestRaw creates a GET request to a raw path (without /api prefix)
func BuildDeleteRequest ¶
BuildDeleteRequest creates a DELETE request to /api/{path}
func BuildPostRequest ¶
BuildPostRequest creates a POST request to /api/{path} with JSON body
func CloseWithWrap ¶
func SetCertificate ¶
Types ¶
type Basket ¶
type Basket struct {
// ID is the server-generated basket UUID: "9d134eb6-d29a-40b2-be46-94f3ea3424d0"
ID string `json:"id"`
// Version is used for optimistic locking, increments on each change
Version int `json:"version"`
// OrderID is set when basket is converted to an order
OrderID *string `json:"orderId,omitempty"`
// DeviceID is the server-assigned device identifier
DeviceID string `json:"deviceId"`
ServiceSelection ServiceSelection `json:"serviceSelection"`
ServiceConfiguration ServiceConfiguration `json:"serviceConfiguration"`
Staggerings Staggerings `json:"staggerings"`
LineItems []LineItem `json:"lineItems"`
Violations []Violation `json:"violations"`
Summary BasketSummary `json:"summary"`
TimeSlotInformation TimeSlotInformation `json:"timeSlotInformation"`
}
Basket represents a shopping basket/cart
type BasketFees ¶
type BasketFees struct {
BeverageSurcharge *int `json:"beverageSurcharge,omitempty"`
ReusableBagSurcharge *int `json:"reusableBagSurcharge,omitempty"`
TransportBoxSurcharge *int `json:"transportBoxSurcharge,omitempty"`
ServiceFee *int `json:"serviceFee,omitempty"`
Refund *int `json:"refund,omitempty"`
}
BasketFees contains optional fee components
type BasketSession ¶
type BasketSession struct {
// ID is the server-generated basket UUID
ID string
// DeviceID is the server-assigned device identifier
DeviceID string
// Version tracks basket changes for optimistic locking
Version int
// MarketID is the selected market
MarketID string
// ZipCode is the customer's postal code
ZipCode string
// ServiceType is "PICKUP" or "DELIVERY"
ServiceType ServiceType
}
BasketSession holds the context for basket operations. Create one with CreateBasket, then use it for subsequent operations.
func CreateBasket ¶
func CreateBasket(marketID, zipCode string, serviceType ServiceType) (*BasketSession, error)
CreateBasket creates a new basket session for the given market and service type. The server generates the basket ID and device ID.
func (*BasketSession) GetBasket ¶
func (s *BasketSession) GetBasket() (Basket, error)
GetBasket retrieves the current basket state. Note: Updates s.Version as a side effect for subsequent operations.
func (*BasketSession) RemoveItem ¶
func (s *BasketSession) RemoveItem(listingID string) (Basket, error)
RemoveItem removes an item from the basket entirely
func (*BasketSession) SetItemQuantity ¶
func (s *BasketSession) SetItemQuantity(listingID string, quantity int) (Basket, error)
SetItemQuantity sets the quantity of an item in the basket. Use listingId from product search results (e.g., "8-FP05LLPR-rewe-online-services|48465001-320516"). Setting quantity to 0 removes the item.
type BasketSummary ¶
type BasketSummary struct {
// ArticleCount is the number of distinct products
ArticleCount int `json:"articleCount"`
// ArticlePrice is the subtotal in cents
ArticlePrice int `json:"articlePrice"`
// TotalArticleQuantity is the sum of all quantities
TotalArticleQuantity int `json:"totalArticleQuantity"`
// TotalPrice is the final price including fees in cents
TotalPrice int `json:"totalPrice"`
// TotalPriceExclServiceFee is total minus service fee
TotalPriceExclServiceFee int `json:"totalPriceExclServiceFee"`
// Fees contains fee breakdowns
Fees BasketFees `json:"fees"`
}
BasketSummary contains basket totals
type BeverageSurcharge ¶
type BeverageSurcharge struct {
// SoftLimit threshold before surcharge applies
SoftLimit int `json:"softLimit"`
// HardLimit maximum threshold
HardLimit int `json:"hardLimit"`
// Surcharge amount in cents: 190 = 1.90 EUR
Surcharge int `json:"surcharge"`
// DisplayTexts are German explanations of the surcharge rules
DisplayTexts []string `json:"displayTexts"`
}
BeverageSurcharge contains limits and pricing for beverage crates
type BulkyGoodsConfig ¶
type BulkyGoodsConfig struct {
// HasBeverageSurcharge indicates if beverage surcharges apply
HasBeverageSurcharge bool `json:"hasBeverageSurcharge"`
// BeverageSurcharge contains the surcharge details (nil if none)
BeverageSurcharge *BeverageSurcharge `json:"beverageSurcharge"`
}
BulkyGoodsConfig contains beverage crate limits and surcharges for a market. Endpoint: GET /api/bulky-goods-configuration/{marketCode}/service-types/{serviceType}
func GetBulkyGoodsConfig ¶
func GetBulkyGoodsConfig(marketID string, serviceType ServiceType) (BulkyGoodsConfig, error)
GetBulkyGoodsConfig retrieves beverage crate limits and surcharges for a market. serviceType should be "PICKUP" or "DELIVERY".
type CloseError ¶
type CloseError struct {
OriginalError, CloseError error
}
func (CloseError) Error ¶
func (c CloseError) Error() string
type Discount ¶
type Discount struct {
Title string
Subtitle string
Images []string
PriceRaw string
// Price is the parsed price in euros. Check PriceParseFail before using -
// if true, Price is 0.0 due to parse failure, not because item is free.
Price float64
PriceParseFail bool
Manufacturer string
ArticleNo string
NutriScore string
ProductCategory string
}
Discount is the actual discount with some of the information provided by rewe.
type DiscountCategory ¶
DiscountCategory is the category defined by rewe for the presentation of the discounts. It contains an index for sorting the categories in their intended order and the actual discounts. Calling GroupByProductCategory reorders the discounts by their product category (z. B. "Nahrungsmittel").
type Discounts ¶
type Discounts struct {
Categories []DiscountCategory
ValidUntil time.Time
}
Discounts is the struct that holds cleaned up discount data.
func GetDiscounts ¶
GetDiscounts returns the discounts from the API with less bloat. It contains the discount categories, which in turn contain the actual discounts. I removed various parameters I deemed unnecessary and parsed into different datatypes where it made sense to me. The struct Discounts also provides some helper methods.
func (Discounts) GroupByProductCategory ¶
GroupByProductCategory groups the discounts by their product category and returns the results.
type LineItem ¶
type LineItem struct {
// Quantity is the number of items
Quantity int `json:"quantity"`
// Price is the unit price in cents: 459 = 4.59 EUR
Price int `json:"price"`
// TotalPrice is quantity * price in cents
TotalPrice int `json:"totalPrice"`
// Grammage is the weight/volume info: "150g (1 kg = 30,60 EUR)"
Grammage string `json:"grammage"`
// Product contains product details
Product LineItemProduct `json:"product"`
// Violations are issues with this line item
Violations []Violation `json:"violations"`
}
LineItem represents a product in the basket
type LineItemProduct ¶
type LineItemProduct struct {
ProductID string `json:"productId"`
Title string `json:"title"`
ImageURL string `json:"imageURL"`
ArticleID string `json:"articleId"`
NAN string `json:"nan"`
OrderLimit int `json:"orderLimit"`
Listing Listing `json:"listing"`
Attributes ProductAttributes `json:"attributes"`
}
LineItemProduct contains product info within a line item
type Listing ¶
type Listing struct {
// ListingID is used for basket operations: "8-FP05LLPR-rewe-online-services|48465001-320516"
ListingID string `json:"listingId"`
ListingVersion int `json:"listingVersion"`
CurrentRetailPrice int `json:"currentRetailPrice"`
TotalRefundPrice int `json:"totalRefundPrice"`
Grammage string `json:"grammage"`
}
Listing contains listing-specific info (market-specific pricing)
type Market ¶
type Market struct {
// WWIdent is the market ID: "840174", "831002"
WWIdent string `json:"wwIdent"`
// Name is the store type: "REWE Markt", "REWE Center"
Name string `json:"name"`
// CompanyName is the operating company: "REWE Markt Vuthaj oHG", "REWE Thomas Viering oHG"
CompanyName string `json:"companyName"`
// Phone is the store phone number: "0621-8414498"
Phone string `json:"phone"`
// TypeID is the market type code: "REWE", "CENTER"
TypeID string `json:"typeId"`
// Street is the street address: "Rheingoldstr. 18-20", "Lindenhofstr. 91"
Street string `json:"street"`
// ZipCode is the postal code: "68199", "68161"
ZipCode string `json:"zipCode"`
// City is the city name: "Mannheim / Neckarau", "Mannheim"
City string `json:"city"`
// Location contains GPS coordinates
Location struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
} `json:"location"`
// OpeningStatus contains current open/closed state
OpeningStatus struct {
// OpenState is the status: "OPEN", "CLOSED"
OpenState string `json:"openState"`
// InfoText is the closing time: "bis 22:00 Uhr"
InfoText string `json:"infoText"`
// StatusText is human-readable status: "Geöffnet", "Geschlossen"
StatusText string `json:"statusText"`
} `json:"openingStatus"`
// OpeningInfo contains weekly opening hours
OpeningInfo []struct {
// Days is the day range: "Mo - Sa"
Days string `json:"days"`
// Hours is the time range: "07:00 - 22:00"
Hours string `json:"hours"`
} `json:"openingInfo"`
// Category contains market type classification
Category struct {
// Template is the layout template code: "RN", "RC"
Template string `json:"template"`
// MarketTypeDisplayName is the display name: "REWE Markt", "REWE Center"
MarketTypeDisplayName string `json:"marketTypeDisplayName"`
// IsWarehouse indicates if this is a warehouse store
IsWarehouse bool `json:"isWarehouse"`
// Type is the category type: "MARKET"
Type string `json:"type"`
} `json:"category"`
// Distance is the distance from search location in km (null when not searching by location)
Distance *float64 `json:"distance,omitempty"`
// ServiceFlags contains available services
ServiceFlags struct {
// HasPickup indicates if pickup service is available
HasPickup bool `json:"hasPickup"`
} `json:"serviceFlags"`
}
type MarketContent ¶
type MarketContent struct {
// Components contains UI components (usually null)
Components any `json:"components"`
// MarketData contains market-specific info
MarketData struct {
// MarketName is the branded name: "REWE Vuthaj"
MarketName string `json:"marketName"`
// MarketManager is the manager's name (often empty)
MarketManager string `json:"marketManager"`
// ImageMarket is the store image URL (often empty)
ImageMarket string `json:"imageMarket"`
// ImageManager is the manager's photo URL (often empty)
ImageManager string `json:"imageManager"`
// MarketLink is the web URL (often empty)
MarketLink string `json:"marketLink"`
} `json:"marketData"`
// Services contains available store services
Services struct {
// Fixed are standard services: Fleischtheke, Fischtheke, Parkplätze, etc.
Fixed []MarketService `json:"fixed"`
// Editable are custom services set by the store
Editable []MarketService `json:"editable"`
} `json:"services"`
}
MarketContent contains additional market details from the details endpoint
type MarketDetails ¶
type MarketDetails struct {
Market Market
Content MarketContent
}
func GetMarketDetails ¶
func GetMarketDetails(marketID string) (md MarketDetails, err error)
GetMarketDetails returns the details of the market with the given ID.
func (MarketDetails) String ¶
func (md MarketDetails) String() string
type MarketService ¶
type MarketService struct {
// Text is the service name: "Fleisch- und Wursttheke", "Parkplätze", "WLAN"
Text string `json:"text"`
// Icon is the icon identifier: "sausagemeat", "parking", "wlan", "default"
Icon string `json:"icon"`
// Tooltip is additional info: "Große Auswahl deutsche Weine"
Tooltip string `json:"tooltip"`
// Active indicates if this service is available at the store
Active bool `json:"active"`
// IconURL is the full icon image URL
IconURL string `json:"iconUrl"`
}
MarketService represents a service available at the market
type Markets ¶
type Markets []Market
func MarketSearch ¶
MarketSearch searches for markets based on the given query. Fuzzy search; accepts PLZ, city, marketname, street, etc.
type NutrientInfo ¶
type NutrientInfo struct {
// NutrientType is the nutrient name: "Energie", "Fett", "Kohlenhydrate", etc.
NutrientType string `json:"nutrientType"`
// MeasurementPrecision indicates accuracy: "ungefähr"
MeasurementPrecision string `json:"measurementPrecision"`
// QuantityContained has the value and unit
QuantityContained struct {
Value float64 `json:"value"`
UomShortText string `json:"uomShortText"`
UomLongText string `json:"uomLongText"`
} `json:"quantityContained"`
}
NutrientInfo is a single nutrient value
type NutritionFact ¶
type NutritionFact struct {
// PreparationState is: "Unzubereitet" or "Zubereitet"
PreparationState string `json:"preparationState"`
// NutrientInformation contains the individual nutrient values
NutrientInformation []NutrientInfo `json:"nutrientInformation"`
}
NutritionFact contains nutritional information for a preparation state
type PickupMarket ¶
type PickupMarket struct {
// WWIdent is the market ID: "831002"
WWIdent string `json:"wwIdent"`
// DisplayName is the market type: "REWE Markt"
DisplayName string `json:"displayName"`
// CompanyName is the operating company: "REWE Hüseyin Özdemir oHG"
CompanyName string `json:"companyName"`
// IsPickupStation indicates if this is a pickup station (vs full store)
IsPickupStation bool `json:"isPickupStation"`
// SignedMapsUrl is the map URL path: "/api/markets/831002/map"
SignedMapsUrl string `json:"signedMapsUrl"`
// Latitude is the GPS coordinate: "49.45762"
Latitude string `json:"latitude"`
// Longitude is the GPS coordinate: "8.43085"
Longitude string `json:"longitude"`
// ZipCode is the market's zip code: "67065"
ZipCode string `json:"zipCode"`
// StreetWithHouseNumber is the address: "Wegelnburgstr. 33"
StreetWithHouseNumber string `json:"streetWithHouseNumber"`
// City is the city name: "Ludwigshafen / Mundenheim"
City string `json:"city"`
// PickupType is the pickup service type: "PICKUP_SERVICE"
PickupType string `json:"pickupType"`
}
PickupMarket is a market offering pickup service
type PopularSearchTerm ¶
type PopularSearchTerm struct {
// ID is the search term identifier
ID string `json:"id"`
// Title is the display text: "Lachs", "Low Carb", "Kürbis", ...
Title string `json:"title"`
}
PopularSearchTerm is a suggested search term Endpoint: GET /api/v3/recipe-popular-search-terms
type PopularSearchTerms ¶
type PopularSearchTerms []PopularSearchTerm
func GetRecipePopularTerms ¶
func GetRecipePopularTerms() (terms PopularSearchTerms, err error)
GetRecipePopularTerms returns popular recipe search terms. Endpoint: GET /api/v3/recipe-popular-search-terms
func (PopularSearchTerms) String ¶
func (p PopularSearchTerms) String() string
type Product ¶
type Product struct {
ProductID string `json:"productId"`
Title string `json:"title"`
DepositLabel *string `json:"depositLabel"`
ImageURL string `json:"imageURL"`
Attributes struct {
IsBulkyGood bool `json:"isBulkyGood"`
IsOrganic bool `json:"isOrganic"`
IsVegan bool `json:"isVegan"`
IsVegetarian bool `json:"isVegetarian"`
IsDairyFree bool `json:"isDairyFree"`
IsGlutenFree bool `json:"isGlutenFree"`
IsBiocide bool `json:"isBiocide"`
IsAgeRestricted *bool `json:"isAgeRestricted"`
IsRegional bool `json:"isRegional"`
IsNew bool `json:"isNew"`
IsLowestPrice bool `json:"isLowestPrice"`
} `json:"attributes"`
OrderLimit int `json:"orderLimit"`
Categories []string `json:"categories"`
DetailsViewRequired bool `json:"detailsViewRequired"`
ArticleID string `json:"articleId"`
Listing struct {
ListingID string `json:"listingId"`
ListingVersion int `json:"listingVersion"`
CurrentRetailPrice int `json:"currentRetailPrice"`
TotalRefundPrice *int `json:"totalRefundPrice"`
Grammage string `json:"grammage"`
Discount any `json:"discount"`
LoyaltyBonus any `json:"loyaltyBonus"`
} `json:"listing"`
Advertisement any `json:"advertisement"`
}
func GetProductRecommendations ¶
GetProductRecommendations returns related product recommendations. Endpoint: GET /api/products/recommendations?listingIds={listingId}
type ProductAttributes ¶
type ProductAttributes struct {
IsBulkyGood bool `json:"isBulkyGood"`
IsOrganic bool `json:"isOrganic"`
IsVegan bool `json:"isVegan"`
IsVegetarian bool `json:"isVegetarian"`
IsDairyFree bool `json:"isDairyFree"`
IsGlutenFree bool `json:"isGlutenFree"`
IsAgeRestricted bool `json:"isAgeRestricted"`
IsRegional bool `json:"isRegional"`
IsNew bool `json:"isNew"`
}
ProductAttributes contains product flags
type ProductDetail ¶
type ProductDetail struct {
Product
// RegulatedProductName is the legal product name: "Mandel-Cashew-Edamame-Mix geröstet, mit Chili-Würzung."
RegulatedProductName string `json:"regulatedProductName"`
// AdditionalImageURLs contains extra product images
AdditionalImageURLs []string `json:"additionalImageURLs"`
// Description is the product description
Description string `json:"description"`
// FeatureBenefit contains marketing benefits
FeatureBenefit string `json:"featureBenefit"`
// TradeItemMarketingMessage contains marketing text
TradeItemMarketingMessage string `json:"tradeItemMarketingMessage"`
// QSCertificationMark indicates QS certification
QSCertificationMark bool `json:"qsCertificationMark"`
// Brand is the manufacturer/brand name: "Bonduelle", "REWE Bio", "Hipp"
Brand string `json:"brand"`
// NutritionFacts contains nutritional information
NutritionFacts []NutritionFact `json:"nutritionFacts"`
}
ProductDetail is the full product information from single-product lookup Endpoint: GET /api/products/{productId}
func GetProductByID ¶
func GetProductByID(marketID, productID string) (ProductDetail, error)
GetProductByID returns full product details by product ID. Endpoint: GET /api/products/{productId}
func (ProductDetail) String ¶
func (pd ProductDetail) String() string
type ProductFilter ¶
type ProductFilter string
ProductFilter is a filter type for product search. Use with ProductOpts.Filters to narrow down search results.
const ( FilterNew ProductFilter = "attribute=new" // Recently added products FilterOrganic ProductFilter = "attribute=organic" // Organic/Bio products FilterVegan ProductFilter = "attribute=vegan" // Vegan products FilterVegetarian ProductFilter = "attribute=vegetarian" // Vegetarian products FilterRegional ProductFilter = "attribute=regional" // Regional/local products )
Product filters for search queries. Not exhaustive.
type ProductOpts ¶
type ProductOpts struct {
Page int
ObjectsPerPage int
// ServiceType must match market capabilities (PICKUP or DELIVERY).
// Check market details hasPickup field. Returns HTTP 400 if mismatched.
ServiceType ServiceType
Filters []ProductFilter
}
ProductOpts configures product search requests.
type ProductResults ¶
type ProductResults struct {
Products []Product
Pagination struct {
ObjectsPerPage int
CurrentPage int
PageCount int
ObjectCount int
}
SearchTerm struct {
Original string
Corrected *string // non-nil if API corrected a typo
}
}
ProductResults is the flattened result from product search endpoints. Endpoint: GET /api/products
func GetCategoryProducts ¶
func GetCategoryProducts(marketID, categorySlug string, opts *ProductOpts) (ProductResults, error)
GetCategoryProducts returns products in a specific category. Endpoint: GET /api/products?categorySlug={slug} ServiceType in opts must match market capabilities - use GetMarketDetails to check hasPickup. Returns HTTP 400 "Invalid market selection" if service type doesn't match.
func GetProducts ¶
func GetProducts(marketID, search string, opts *ProductOpts) (ProductResults, error)
GetProducts searches for products by query string. Endpoint: GET /api/products?query={search} ServiceType in opts must match market capabilities - use GetMarketDetails to check hasPickup. Returns HTTP 400 "Invalid market selection" if service type doesn't match.
func (ProductResults) String ¶
func (pr ProductResults) String() string
type ProductSuggestion ¶
type ProductSuggestion struct {
// Title is the product name: "Hof Alpermühle Bio Eier 6 Stück"
Title string `json:"title"`
// ImageURL is a small product image (150x150)
ImageURL string `json:"imageURL"`
// RawValues contains product identifiers
RawValues struct {
// CategoryID is the category: "3523"
CategoryID string `json:"categoryId"`
// ProductID is the product ID: "7828199"
ProductID string `json:"productId"`
// ArticleID is the article ID: "T4KNENOV"
ArticleID string `json:"articleId"`
// Nan is the article number (German: Artikelnummer)
Nan string `json:"nan"`
} `json:"rawValues"`
}
ProductSuggestion is a search autocomplete suggestion Endpoint: GET /products/suggestion-search
type ProductSuggestions ¶
type ProductSuggestions []ProductSuggestion
func GetProductSuggestions ¶
func GetProductSuggestions(query string, opts *ProductOpts) (ProductSuggestions, error)
GetProductSuggestions returns search autocomplete suggestions. Endpoint: GET /products/suggestion-search (note: no /api prefix)
func (ProductSuggestions) String ¶
func (ps ProductSuggestions) String() string
type RawDiscounts ¶
type RawDiscounts struct {
Data struct {
Offers struct {
// DefaultWeek indicates which week to show by default: "current" or "next"
DefaultWeek string `json:"defaultWeek"`
// NextWeekAvailableFrom indicates when next week's offers become visible: "saturday"
NextWeekAvailableFrom string `json:"nextWeekAvailableFrom"`
// Current contains this week's offers
Current RawOffersWeek `json:"current"`
// Next contains next week's offers (if available)
Next RawOffersWeek `json:"next"`
} `json:"offers"`
} `json:"data"`
}
RawDiscounts is the struct that holds the raw discount data from the rewe API. Endpoint: GET /api/stationary-offers/{marketId}
func GetDiscountsRaw ¶
func GetDiscountsRaw(marketID string) (rd RawDiscounts, err error)
GetDiscountsRaw returns the raw data from the API in a RawDiscounts struct. It contains links to the handout (Prospekt) as well as discount categories, which in turn contain the actual discounts.
type RawOffer ¶
type RawOffer struct {
// CellType is the display type: "DEFAULT" for regular offers
CellType string `json:"cellType"`
// Overline is optional text above the title
Overline string `json:"overline"`
// Title is the product name: "Haribo Goldbären oder Color-Rado"
Title string `json:"title"`
// Subtitle contains weight/quantity info: "je 175-g-Btl. (1 kg = 4.40)"
Subtitle string `json:"subtitle"`
// Images contains product image URLs
Images []string `json:"images"`
// Biozid indicates if the product is a biocide
Biozid bool `json:"biozid"`
// PriceData contains pricing information
PriceData struct {
// Price is the discounted price: "0,77 €"
Price string `json:"price"`
// RegularPrice is the original price or a label like "Knaller"
RegularPrice string `json:"regularPrice"`
} `json:"priceData"`
// LoyaltyBonus contains bonus points info if applicable
LoyaltyBonus any `json:"loyaltyBonus"`
// Stock contains availability info
Stock any `json:"stock"`
// Detail contains additional product information
Detail struct {
Sensational any `json:"sensational"`
PitchIn string `json:"pitchIn"`
Tags []any `json:"tags"`
// Contents contains structured product details
Contents []struct {
// Header is the section name: "Produktdetails", "Hinweise"
Header string `json:"header"`
// Titles contains the detail lines: "Art.-Nr.: 7772669", "Hersteller: HARIBO"
Titles []string `json:"titles"`
} `json:"contents"`
Biocide bool `json:"biocide"`
// NutriScore is the nutrition score letter if available: "A", "B", etc.
NutriScore string `json:"nutriScore"`
} `json:"detail"`
// RawValues contains internal tracking data
RawValues struct {
// CategoryTitle is the product category slug: "suesses-und-salziges"
CategoryTitle string `json:"categoryTitle"`
PriceAverage float64 `json:"priceAverage"`
FlyerPage int `json:"flyerPage"`
// Nan is the article number (German: Artikelnummer): "7772669"
Nan string `json:"nan"`
} `json:"rawValues"`
}
RawOffer is a single discounted product
type RawOfferCategory ¶
type RawOfferCategory struct {
// ID is the category identifier: "markt-topangebote", "suesses-und-salziges"
ID string `json:"id"`
// Title is the display name: "Top-Angebote in deinem Markt"
Title string `json:"title"`
// MoodURL is an optional header image for the category
MoodURL any `json:"moodUrl"`
// Order is the display order (lower = earlier)
Order int `json:"order"`
// BackgroundColor is the hex color for the category header: "#EDF9FA"
BackgroundColor string `json:"backgroundColor"`
// ForegroundColor is the hex text color: "#2E7B85"
ForegroundColor string `json:"foregroundColor"`
// Offers contains the actual discounted products
Offers []RawOffer `json:"offers"`
}
RawOfferCategory is a grouping of offers as defined by REWE
type RawOffersWeek ¶
type RawOffersWeek struct {
// Available indicates if offers are available for this week
Available bool `json:"available"`
// FromDate is the start date in ISO format: "2026-01-05"
FromDate string `json:"fromDate"`
// UntilDate is the end date in ISO format: "2026-01-10"
UntilDate string `json:"untilDate"`
// HasOnlineOffers indicates if online ordering is available
HasOnlineOffers bool `json:"hasOnlineOffers"`
// Handout contains the printed flyer/prospekt images
Handout struct {
Images []struct {
// Original is the full-size image URL
Original string `json:"original"`
// Thumbnail is a smaller preview
Thumbnail string `json:"thumbnail"`
} `json:"images"`
} `json:"handout"`
// Categories contains grouped offers
Categories []RawOfferCategory `json:"categories"`
}
RawOffersWeek contains offers for a specific week
type Recall ¶
type Recall struct {
URL string `json:"url"`
SubjectProduct string `json:"subjectProduct"`
SubjectReason string `json:"subjectReason"`
}
Recall is the struct for a single recall
type Recalls ¶
type Recalls []Recall
Recalls is the struct for Rewe Product-Recalls
func GetRecalls ¶
GetRecalls returns all currently ongoing recalls from Rewe
type Recipe ¶
type Recipe struct {
ID string `json:"id"`
Title string `json:"title"`
DetailURL string `json:"detailUrl"`
ImageURL string `json:"imageUrl"`
Duration string `json:"duration"`
DifficultyLevel int `json:"difficultyLevel"`
DifficultyDescription string `json:"difficultyDescription"`
}
Recipe is the struct for a single recipe
type RecipeCollection ¶
type RecipeCollection string
RecipeCollection defines recipe collection filters
const (
CollectionVegetarisch RecipeCollection = "Vegetarisch"
)
type RecipeDetail ¶
type RecipeDetail struct {
// ID is the recipe UUID: "30ce3caf-4b3b-4c9e-8ea0-645fe75d1303"
ID string `json:"id"`
// Title is the recipe name: "Gnocchi-Pfanne mit Rosenkohl und getrockneten Tomaten"
Title string `json:"title"`
// DetailURL is the web page URL: "https://www.rewe.de/rezepte/..."
DetailURL string `json:"detailUrl"`
// ImageURL is the recipe image
ImageURL string `json:"imageUrl"`
// Duration is the cooking time: "50 min"
Duration string `json:"duration"`
// DifficultyLevel is numeric difficulty: 1=easy, 2=medium, 3=hard
DifficultyLevel int `json:"difficultyLevel"`
// DifficultyDescription is human-readable: "Einfach", "Mittel", "Schwer"
DifficultyDescription string `json:"difficultyDescription"`
// Ingredients contains the ingredient list with portions
Ingredients RecipeIngredients `json:"ingredients"`
// Steps contains the cooking instructions
Steps []string `json:"steps"`
}
RecipeDetail is the full recipe with ingredients and cooking steps
func (RecipeDetail) StringFull ¶
func (r RecipeDetail) StringFull() string
type RecipeDetails ¶
type RecipeDetails struct {
Recipe RecipeDetail `json:"recipe"`
}
RecipeDetails contains full recipe information including ingredients and steps Endpoint: GET /api/v3/recipe-hub-details?recipeId={id}
func GetRecipeDetails ¶
func GetRecipeDetails(recipeID string) (details RecipeDetails, err error)
GetRecipeDetails returns the full recipe with ingredients and steps. Endpoint: GET /api/v3/recipe-hub-details?recipeId={id}
func (RecipeDetails) String ¶
func (rd RecipeDetails) String() string
type RecipeDifficulty ¶
type RecipeDifficulty string
RecipeDifficulty defines difficulty level filters
const ( DifficultyEasy RecipeDifficulty = "Gering" DifficultyMedium RecipeDifficulty = "Mittel" DifficultyHard RecipeDifficulty = "Hoch" )
type RecipeHub ¶
type RecipeHub struct {
RecipeOfTheDay Recipe `json:"recipeOfTheDay"`
PopularRecipes []Recipe `json:"popularRecipes"`
Categories []struct {
Type string `json:"type"`
Title string `json:"title"`
SearchQuery string `json:"searchQuery"`
} `json:"categories"`
}
RecipeHub is the struct for the Data returned by the Rewe Recipe-Page
func GetRecipeHub ¶
GetRecipeHub returns the Data from the RecipeHub
type RecipeIngredient ¶
type RecipeIngredient struct {
// Name is the ingredient name: "frischer Rosenkohl (ersatzweise TK)"
Name string `json:"name"`
// Quantity is the amount needed: 250, 1, 0 (for "to taste")
Quantity float64 `json:"quantity"`
// Unit is the measurement unit: "g", "EL", "Zehe(n)", "" (for count)
Unit string `json:"unit"`
}
RecipeIngredient is a single ingredient with quantity and unit
type RecipeIngredients ¶
type RecipeIngredients struct {
// Portions is the number of servings the recipe makes
Portions int `json:"portions"`
// Items contains the individual ingredients
Items []RecipeIngredient `json:"items"`
}
RecipeIngredients contains the ingredient list with portion info
type RecipeMetadata ¶
type RecipeMetadata struct {
// Collections are recipe categories: ["Vegetarisch"]
Collections []string `json:"collections"`
// Tags are recipe tags: ["Geringer Aufwand", "Abendessen", "schnell", "Vegan", ...]
Tags []string `json:"tags"`
// Difficulties are available difficulty levels: ["Gering", "Mittel", "Hoch"]
Difficulties []string `json:"difficulties"`
}
RecipeMetadata contains available filter options for recipe search
type RecipeSearchOpts ¶
type RecipeSearchOpts struct {
// SearchTerm is the text query to search for
SearchTerm string
// Collection filters by recipe collection
Collection RecipeCollection
// Difficulty filters by difficulty level
Difficulty RecipeDifficulty
// Sorting determines result order (default: SortRelevance)
Sorting RecipeSorting
// Page is the page number (1-indexed)
Page int
// ObjectsPerPage is the number of results per page (default 20)
ObjectsPerPage int
}
RecipeSearchOpts contains options for recipe search
type RecipeSearchResults ¶
type RecipeSearchResults struct {
// TotalCount is the total number of matching recipes
TotalCount int `json:"totalCount"`
// Recipes contains the recipe summaries for this page
Recipes []Recipe `json:"recipes"`
// Metadata contains available filter options
Metadata RecipeMetadata `json:"metadata"`
}
RecipeSearchResults contains paginated recipe search results Endpoint: GET /api/v3/recipe-search
func RecipeSearch ¶
func RecipeSearch(opts *RecipeSearchOpts) (results RecipeSearchResults, err error)
RecipeSearch searches for recipes with optional filters. Endpoint: GET /api/v3/recipe-search
func (RecipeSearchResults) String ¶
func (r RecipeSearchResults) String() string
type RecipeSorting ¶
type RecipeSorting string
RecipeSorting defines sorting options for recipe search
const (
SortRelevance RecipeSorting = "RELEVANCE_DESC"
)
type ServiceConfiguration ¶
type ServiceConfiguration struct {
// MinimumOrderAmount in cents, e.g. 5000 = 50.00 EUR for delivery
MinimumOrderAmount int `json:"minimumOrderAmount"`
}
ServiceConfiguration contains service-specific settings
type ServicePortfolio ¶
type ServicePortfolio struct {
// CustomerZipCode is the queried zip code: "68199"
CustomerZipCode string `json:"customerZipCode"`
// DeliveryMarket contains the market that delivers to this zip code
DeliveryMarket *struct {
WWIdent string `json:"wwIdent"`
} `json:"deliveryMarket"`
// PickupMarkets contains markets offering pickup service
PickupMarkets []PickupMarket `json:"pickupMarkets"`
}
ServicePortfolio contains available REWE services for a zip code Endpoint: GET /api/service-portfolio/{zipcode}
func GetServicePortfolio ¶
func GetServicePortfolio(zipcode string) (sp ServicePortfolio, err error)
GetServicePortfolio returns available REWE services for a zip code. Endpoint: GET /api/service-portfolio/{zipcode}
func (ServicePortfolio) String ¶
func (sp ServicePortfolio) String() string
type ServiceSelection ¶
type ServiceSelection struct {
// WWIdent is the market ID: "831002"
WWIdent string `json:"wwIdent"`
// ServiceType is "PICKUP" or "DELIVERY"
ServiceType string `json:"serviceType"`
// ZipCode is the customer's postal code: "67065"
ZipCode string `json:"zipCode"`
}
ServiceSelection contains the selected market and service type
type ServiceType ¶
type ServiceType string
ServiceType represents the delivery/pickup service type
const ( ServicePickup ServiceType = "PICKUP" ServiceDelivery ServiceType = "DELIVERY" )
type ShopCategory ¶
type ShopCategory struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
ProductCount int `json:"productCount"`
ImageURL string `json:"imageUrl"`
ChildCategories []ShopCategory `json:"childCategories"`
}
func (ShopCategory) String ¶
func (sc ShopCategory) String() string
func (ShopCategory) StringAll ¶
func (sc ShopCategory) StringAll() string
type ShopOverview ¶
type ShopOverview struct {
ProductRecalls Recalls `json:"productRecalls"`
ProductCategories []ShopCategory `json:"productCategories"`
}
func GetShopOverview ¶
func GetShopOverview(marketID string) (so ShopOverview, err error)
GetShopOverview retrieves the product categories for a market (PICKUP mode). For delivery mode, use GetShopOverviewWithOpts.
func GetShopOverviewWithOpts ¶
func GetShopOverviewWithOpts(marketID string, opts *ShopOverviewOpts) (so ShopOverview, err error)
GetShopOverviewWithOpts retrieves the product categories with configurable service type. For DELIVERY mode, opts.ZipCode is required.
func (ShopOverview) GetName ¶
func (so ShopOverview) GetName() string
func (ShopOverview) String ¶
func (so ShopOverview) String() string
func (ShopOverview) StringAll ¶
func (so ShopOverview) StringAll() string
type ShopOverviewOpts ¶
type ShopOverviewOpts struct {
// ServiceType is "PICKUP" or "DELIVERY" (default: PICKUP)
ServiceType ServiceType
// ZipCode is required for DELIVERY, optional for PICKUP
ZipCode string
}
ShopOverviewOpts configures the shop overview request
type Staggering ¶
type Staggering struct {
// ArticlePriceThreshold is the minimum order amount in cents
ArticlePriceThreshold int `json:"articlePriceThreshold"`
// RemainingArticlePrice in cents (how much more needed to reach minimum)
RemainingArticlePrice int `json:"remainingArticlePrice,omitempty"`
// DisplayText is the German description: "Mindestbestellwert: 40,00 €"
DisplayText string `json:"displayText"`
}
Staggering represents a minimum order amount threshold
type Staggerings ¶
type Staggerings struct {
ReachedStaggering *Staggering `json:"reachedStaggering,omitempty"`
NextStaggering *Staggering `json:"nextStaggering,omitempty"`
}
Staggerings contains pricing tier information
type TimeSlotInformation ¶
type TimeSlotInformation struct {
StartTime *string `json:"startTime,omitempty"`
EndTime *string `json:"endTime,omitempty"`
TimeSlotPrice *int `json:"timeSlotPrice,omitempty"`
TimeSlotText string `json:"timeSlotText"`
}
TimeSlotInformation contains delivery/pickup time slot info
type Violation ¶
type Violation struct {
// ID is the violation type: "minimum.delivery.not.reached"
ID string `json:"id"`
// Message is the user-facing text: "Mindestbestellwert 50 EUR nicht erreicht!"
Message string `json:"message"`
// DetailMessage provides additional context
DetailMessage *string `json:"detailMessage,omitempty"`
}
Violation represents an issue with the basket or line item