picnic

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 13 Imported by: 0

README

Picnic-API

workflow

This is an (unofficial) Go wrapper for working with the Picnic WebAPI.

Installation

To install the library:

go get github.com/simonmartyr/picnic-api

Getting started

To create a client & authenticate you and choose to provide a valid access token or credentials to manually authenticate with.

//authentication with a token
package main
import picnic "github.com/simonmartyr/picnic-api"

func main() {
    client := picnic.New(&http.Client{},
		picnic.WithToken("your accessToken"),
    )
}

or

//authentication using auth credentials
package main
import picnic "github.com/simonmartyr/picnic-api"

func main() {
    client := picnic.New(&http.Client{},
        picnic.WithUserName("user@emailaddress.com"),
        picnic.WithHashedPassword("hashedPassword"),
    )
	err := client.Authenticate()
	if err != nil {
		panic(err.Error())
    }
}

Demo Project

For a complete example of the API being used, checkout picnic-tui

References & Credits

Thanks to the efforts of MRVDH which documented the API.

Support

Static Badge

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddProductInput

type AddProductInput struct {
	ProductId string `json:"product_id"`
	Count     int    `json:"count"`
}

type Address

type Address struct {
	HouseNumber    int    `json:"house_number"`
	HouseNumberExt string `json:"house_number_ext"`
	Postcode       string `json:"postcode"`
	Street         string `json:"street"`
	City           string `json:"city"`
}

type ArticleDescription

type ArticleDescription struct {
	Main string `json:"main"`
}

type ArticleDetails

type ArticleDetails struct {
	Type             string             `json:"type"`
	Id               string             `json:"id"`
	Name             string             `json:"name"`
	PriceInfo        PriceInfo          `json:"price_info"`
	Images           []Image            `json:"images"`
	UnitQuantity     string             `json:"unit_quantity"`
	Labels           Label              `json:"labels"`
	MaxOrderQuantity int                `json:"max_order_quantity"`
	Decorators       []Decorator        `json:"decorators"`
	Description      ArticleDescription `json:"description"`
}

func (ArticleDetails) GetPromotion

func (a ArticleDetails) GetPromotion() string

type AvailablePaymentMethod

type AvailablePaymentMethod struct {
	PaymentMethod  string `json:"payment_method"`
	AvailableBanks []Bank `json:"available_banks"`
}

type Bank

type Bank struct {
	BankId string `json:"bank_id"`
	Name   string `json:"name"`
}

type BodyChild added in v1.2.0

type BodyChild struct {
	Children []ContentChild `json:"children"`
	Content  Content        `json:"content"`
}

type Category

type Category struct {
	Type                     string      `json:"type"`
	Id                       string      `json:"id"`
	Decorators               []Decorator `json:"decorators"`
	Links                    []Link      `json:"links"`
	Name                     string      `json:"name"`
	Items                    []Category  `json:"items"`
	Level                    int         `json:"level"`
	IsIncludedInCategoryTree bool        `json:"is_included_in_category_tree"`
	Hidden                   bool        `json:"hidden"`
}

type Checkout

type Checkout struct {
	OrderId           string             `json:"order_id"`
	Address           Address            `json:"address"`
	DeliverySlots     []DeliverySlot     `json:"delivery_slots"`
	TotalPrice        int                `json:"total_price"`
	TransactionExpiry string             `json:"transaction_expiry"`
	TotalCount        int                `json:"total_count"`
	TotalDeposit      int                `json:"total_deposit"`
	TotalSavings      int                `json:"total_savings"`
	DepositBreakdown  []DepositBreakdown `json:"deposit_breakdown"`
}

type CheckoutError

type CheckoutError struct {
	Code       string
	Title      string
	Message    string
	ResolveKey string
	Blocking   bool
	Err        error
}

func (*CheckoutError) Error

func (e *CheckoutError) Error() string

func (*CheckoutError) IsAgeVerificationCheck

func (p *CheckoutError) IsAgeVerificationCheck() bool

type CheckoutStart

type CheckoutStart struct {
	Mts           int    `json:"mts"`
	OosArticleIds any    `json:"oos_article_ids"`
	ResolveKey    string `json:"resolve_key,omitempty"`
}

CheckoutStart the Mts value should match the same value as the order The OosArticleIds likely refers to 'out of stock article ids' ResolveKey in the event a checkout requires additional verification the key must be included For example, the purchase of alcohol requires the value 'age_verified' to be present

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client the picnic api client it is recommended to use the New method to create a new instance

func New

func New(client *http.Client, opts ...ClientOption) *Client

New Create a new instance of the picnic api client

func (*Client) AddToCart

func (c *Client) AddToCart(itemId string, count int) (*Order, error)

AddToCart mutation method to add a quantity of a particular article to cart. The resulting Order contains the new state of the cart.

Method requires client to be authenticated

func (*Client) Authenticate

func (c *Client) Authenticate() error

Authenticate using the configured username and secret the client will attempt ot authenticate Upon success the access token is stored in the Client.Token To leverage the token, calls to picnic endpoints expect the token to be added as a header named 'x-picnic-auth'

func (*Client) CancelCheckout

func (c *Client) CancelCheckout(transactionId string) error

CancelCheckout ends the transaction with the associated id

Method requires client to be authenticated

func (*Client) CheckoutWithResolveKey

func (c *Client) CheckoutWithResolveKey(mts int, resolveKey string) (*Checkout, *CheckoutError)

CheckoutWithResolveKey The same as StartCheckout but if an order is flagged with issues, leverage this method in order to set the required resolveKeys

Method requires client to be authenticated

func (*Client) ClearCart

func (c *Client) ClearCart() (*Order, error)

ClearCart mutation method to remove all articles from the cart. The resulting Order contains the new state of the cart.

Method requires client to be authenticated

func (*Client) GetArticleDetails

func (c *Client) GetArticleDetails(articleId string) (*ArticleDetails, error)

GetArticleDetails Retrieve a single article by its identifier. Article details provides additional information not found on the SingleArticle such as additional images and description.

Method requires client to be authenticated

func (*Client) GetArticleImage

func (c *Client) GetArticleImage(articleImageId string, size ImageSize) (*image.Image, error)

GetArticleImage retrieves and decodes the png image of a given article.

Open endpoint Authentication not required

func (*Client) GetArticleImageUrl

func (c *Client) GetArticleImageUrl(articleImageId string, size ImageSize) (string, error)

GetArticleImageUrl generates the static url for a given article image.

Open endpoint Authentication not required

func (*Client) GetCart

func (c *Client) GetCart() (*Order, error)

GetCart retrieve the current cart contents of the authenticated user

Method requires client to be authenticated

func (*Client) GetCheckoutStatus

func (c *Client) GetCheckoutStatus(transactionId string) (string, error)

GetCheckoutStatus Whilst a checkout process is ongoing, calls to this endpoint will report its current status This can be helpful to verify if the payment has been received

Method requires client to be authenticated

func (*Client) GetDeliveries

func (c *Client) GetDeliveries(filter []DeliveryStatus) (*[]Delivery, error)

GetDeliveries Query for all current or past deliveries. Optionally provide a filter of the list of DeliveryStatus to filter the deliveries by. The data returned is a summary, to get the complete data of a delivery use GetDelivery

Method requires client to be authenticated

func (*Client) GetDelivery

func (c *Client) GetDelivery(deliveryId string) (*Delivery, error)

GetDelivery Query for the complete details of a particular delivery.

Method requires client to be authenticated

func (*Client) GetDeliveryPosition

func (c *Client) GetDeliveryPosition(deliveryId string) (*DeliveryPosition, error)

GetDeliveryPosition Query the current delivery position and estimated time of arrival

Method requires client to be authenticated

func (*Client) GetDeliveryScenario

func (c *Client) GetDeliveryScenario(deliveryId string) (*DeliveryScenario, error)

GetDeliveryScenario Query the current delivery information regarding an active delivery

Method requires client to be authenticated

func (*Client) GetDeliverySlots

func (c *Client) GetDeliverySlots() (*DeliverySlots, error)

GetDeliverySlots Retrieves all slots for the next 7 days for the authenticated user A more direct alternative to using GetCart and accessing the data from the Order.

Method requires client to be authenticated

func (*Client) GetMyStore

func (c *Client) GetMyStore() (*MyStore, error)

GetMyStore query to retrieve the MyStore for the current authenticated user

Method requires client to be authenticated

func (*Client) GetPaymentProfile

func (c *Client) GetPaymentProfile() (*PaymentProfile, error)

GetPaymentProfile retrieves the payment options for the authenticated user

Method requires client to be authenticated

func (*Client) GetSearchSuggestions

func (c *Client) GetSearchSuggestions(query string) (*[]SearchSuggestion, error)

GetSearchSuggestions Queries for terms that could be used for Search For example the query Pepper could result in 'ChiliPepper'

Method requires client to be authenticated

func (*Client) GetUser

func (c *Client) GetUser() (*User, error)

GetUser Retrieves the details of currently authenticated user.

Method requires client to be authenticated

func (*Client) InitiatePayment

func (c *Client) InitiatePayment(orderId string) (*Payment, error)

InitiatePayment begin the process of paying for the order with a given orderId After payment is successfully started, GetCheckoutStatus can be used to monitor the status

Method requires client to be authenticated

func (*Client) IsAuthenticated

func (c *Client) IsAuthenticated() bool

IsAuthenticated convince method to verify the client has an auth token.

func (*Client) Logout

func (c *Client) Logout() error

Logout assuming there is a valid session this endpoint will request the termination of the session and clear the token from the client.

func (*Client) RemoveFromCart

func (c *Client) RemoveFromCart(itemId string, count int) (*Order, error)

RemoveFromCart mutation method to remove a quantity of a particular article from the cart. The resulting Order contains the new state of the cart.

Method requires client to be authenticated

func (*Client) Search deprecated

func (c *Client) Search(query string) (*[]SearchResult, error)

Deprecated: Endpoint exists but no longer returns search results, use SearchArticles instead.

Search Retrieves articles that relate to a given query. The results given are SingleArticle These have basic information about an article. To get more information about an article leverage GetArticleDetails.

Method requires client to be authenticated

func (*Client) SearchArticles added in v1.2.0

func (c *Client) SearchArticles(query string) ([]SingleArticle, error)

SearchArticles Retrieves articles that relate to a given query. The results given are SingleArticle These have basic information about an article. To get more information about an article leverage GetArticleDetails.

Method requires client to be authenticated

func (*Client) SetDeliverySlot

func (c *Client) SetDeliverySlot(slotId string) (*Order, error)

SetDeliverySlot mutation method to select a delivery slot. The resulting Order contains the new state of the cart.

Method requires client to be authenticated

func (*Client) StartCheckout

func (c *Client) StartCheckout(mts int) (*Checkout, *CheckoutError)

StartCheckout begin the process of payment for the current order. Upon success the Checkout result will contain an OrderId which can be used to initiate payment Using the method InitiatePayment. A CheckoutError occurs when articles or issues exist with the current order. In the example of orders which contain Alcohol, a call to CheckoutWithResolveKey is required, the resolveKey can be found within the CheckoutError

Method requires client to be authenticated

type ClientOption

type ClientOption func(client *Client)

func WithBaseUrl

func WithBaseUrl(url string) ClientOption

WithBaseUrl replaces the full url for API calls. Cannot be used in combination with WithCountry And WithVersion

func WithCountry

func WithCountry(countryCode string) ClientOption

WithCountry specify the particular country you wish to use. The default is set to nl

func WithHashedPassword

func WithHashedPassword(hashedPassword string) ClientOption

WithHashedPassword specify your md5 hashed password to be used for authentication.

func WithPassword

func WithPassword(password string) ClientOption

WithPassword specify your password to be used for authentication.

func WithToken

func WithToken(token string) ClientOption

WithToken Provide your own bearer token to be used as the authentication header if Authenticate or Logout is called this value with altered.

func WithUsername

func WithUsername(username string) ClientOption

WithUsername specify your username to be used for authentication.

func WithVersion

func WithVersion(version string) ClientOption

WithVersion specify the particular version of the picnic API you wish to use. The default is set to 17

type Component

type Component struct {
	Type       string `json:"type"`
	Source     Source `json:"source"`
	Width      int    `json:"width"`
	Height     int    `json:"height"`
	ResizeMode string `json:"resize_mode"`
}

type ConsentDecisions

type ConsentDecisions struct {
	MiscCommercialAds          bool `json:"MISC_COMMERCIAL_ADS"`
	MiscCommercialEmails       bool `json:"MISC_COMMERCIAL_EMAILS"`
	MiscCommercialMessages     bool `json:"MISC_COMMERCIAL_MESSAGES"`
	MiscReadAdvertisingID      bool `json:"MISC_READ_ADVERTISING_ID"`
	MiscWhatsAppCommunication  bool `json:"MISC_WHATS_APP_COMMUNICATION"`
	NespressoDataSharing       bool `json:"NESPRESSO_DATA_SHARING"`
	PersonalizedRankingConsent bool `json:"PERSONALIZED_RANKING_CONSENT"`
	PurchasesCategoryConsent   bool `json:"PURCHASES_CATEGORY_CONSENT"`
	WeeklyCommercialEmails     bool `json:"WEEKLY_COMMERCIAL_EMAILS"`
}

type Content

type Content struct {
	Type            string           `json:"type"`
	Id              string           `json:"id"`
	DisplayPosition string           `json:"display_position"`
	Payload         TemplatedContent `json:"payload"`
}

type ContentChild added in v1.2.0

type ContentChild struct {
	Content SearchContent `json:"content"`
}

type Decorator

type Decorator struct {
	Type              string      `json:"type"`
	HeightPercentage  float64     `json:"height_percentage"`
	ImageIDs          []string    `json:"image_ids"`
	Banners           []SubBanner `json:"banners"`
	BasePriceText     string      `json:"base_price_text"`
	Period            string      `json:"period"`
	Label             string      `json:"label"`
	Link              Link        `json:"link"`
	Images            []string    `json:"images"`
	SellableItemCount int         `json:"sellable_item_count"`
	DisplayPrice      int         `json:"display_price"`
	Quantity          int         `json:"quantity"`
	Styles            []Style     `json:"styles"`
	UnitQuantityText  string      `json:"unit_quantity_text"`
	ValidUntil        string      `json:"valid_until"`
	Reason            string      `json:"reason"`
	Text              string      `json:"text"`
}

type DeeplinkReference

type DeeplinkReference struct {
	Type   string `json:"type"`
	Target string `json:"target"`
}

type Delivery

type Delivery struct {
	Type               string            `json:"type"`
	Id                 string            `json:"id"`
	DeliveryId         string            `json:"delivery_id"`
	CreationTime       string            `json:"creation_time"`
	Slot               DeliverySlot      `json:"slot"`
	Eta2               DeliveryTime      `json:"eta_2"`
	Status             DeliveryStatus    `json:"status"`
	DeliveryTime       DeliveryTime      `json:"delivery_time"`
	Orders             []Order           `json:"orders"`
	ReturnedContainers []ReturnContainer `json:"returned_containers"`
	Parcels            []string          `json:"parcels"`
}

type DeliveryPosition

type DeliveryPosition struct {
	Version            int       `json:"version"`
	ScenarioTs         int       `json:"scenario_ts"`
	Eta                int       `json:"eta"`
	EtaWindow          EtaWindow `json:"eta_window"`
	QueryInterval      int       `json:"query_interval"`
	ScenarioInProgress bool      `json:"scenario_in_progress"`
}

DeliveryPosition the current status of the delivery contains information regarding when the estimated time of arrival. ScenarioTs is a reference to the current geolocation within the DeliveryScenario.

type DeliveryScenario

type DeliveryScenario struct {
	Version     int         `json:"version"`
	Destination Destination `json:"destination"`
	Driver      Driver      `json:"driver"`
	Scenario    []Scenario  `json:"scenario"`
	Vehicle     Vehicle     `json:"vehicle"`
}

DeliveryScenario The Scenario content is a planned route for a delivery make use of DeliveryPosition to determine the current delivery location.

type DeliverySlot

type DeliverySlot struct {
	SlotId                  string `json:"slot_id"`
	HubId                   string `json:"hub_id"`
	FcId                    string `json:"fc_id"`
	WindowStart             string `json:"window_start"`
	WindowEnd               string `json:"window_end"`
	CutOffTime              string `json:"cut_off_time"`
	IsAvailable             bool   `json:"is_available"`
	Icon                    Icon   `json:"icon"`
	Selected                bool   `json:"selected"`
	Reserved                bool   `json:"reserved"`
	MinimumOrderValue       int    `json:"minimum_order_value"`
	UnavailabilityReason    string `json:"unavailability_reason"`
	WindowPresentationColor string `json:"window_presentation_color"`
}

type DeliverySlots

type DeliverySlots struct {
	DeliverySlots []DeliverySlot `json:"delivery_slots"`
	SelectedSlot  SelectedSlot   `json:"selected_slot"`
}

type DeliveryStatus

type DeliveryStatus string
const (
	CANCELLED DeliveryStatus = "CANCELLED"
	COMPLETED DeliveryStatus = "COMPLETED"
	CURRENT   DeliveryStatus = "CURRENT"
)

type DeliveryTime

type DeliveryTime struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type DepositBreakdown

type DepositBreakdown struct {
	Type  string `json:"type"`
	Value int    `json:"value"`
	Count int    `json:"count"`
}

type Destination

type Destination struct {
	HouseNumber    int    `json:"house_number"`
	HouseNumberExt string `json:"house_number_ext"`
	PostCode       string `json:"post_code"`
	Street         string `json:"street"`
	City           string `json:"city"`
}

type DisplayPositionContent

type DisplayPositionContent struct {
	Type            string    `json:"type"`
	Id              string    `json:"id"`
	Links           Link      `json:"links"`
	DisplayPosition string    `json:"display_position"`
	Items           []Content `json:"items"`
}

type Driver

type Driver struct {
	Name     string `json:"name"`
	PhotoUrl string `json:"photo_url"`
	Quote    string `json:"quote"`
}

type EtaWindow

type EtaWindow struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type Explanation

type Explanation struct {
	ShortExplanation string `json:"short_explanation"`
	LongExplanation  string `json:"long_explanation"`
}

type HouseholdDetails

type HouseholdDetails struct {
	Adults   int    `json:"adults"`
	Children int    `json:"children"`
	Cats     int    `json:"cats"`
	Dogs     int    `json:"dogs"`
	Author   string `json:"author"`
}

type Icon

type Icon struct {
	PmlVersion         string             `json:"pml_version"`
	Component          Component          `json:"component"`
	Images             Image              `json:"images"`
	TrackingAttributes TrackingAttributes `json:"tracking_attributes"`
}

type Image

type Image struct {
	ImageId string `json:"image_id"`
}

type ImageSize

type ImageSize int64
const (
	Tiny ImageSize = iota
	Small
	Medium
	Large
	ExtraLarge
)

func (ImageSize) String

func (s ImageSize) String() string

type InitiatePaymentRequest

type InitiatePaymentRequest struct {
	AppReturnUrl string `json:"app_return_url"`
	OrderId      string `json:"order_id"`
}

type Label

type Label struct {
	Promo Promo `json:"promo"`
}
type Link struct {
	Type string `json:"type"`
	Href string `json:"href"`
}

type LoginInput

type LoginInput struct {
	Key      string `json:"key"`
	Secret   string `json:"secret"`
	ClientId int    `json:"client_id"`
}

type LoginResult

type LoginResult struct {
	UserId                             string `json:"user_id"`
	SecondFactorAuthenticationRequired string `json:"second_factor_authentication_required"`
	AuthKey                            string `json:"auth_key"`
}

type MyStore

type MyStore struct {
	Type           string                   `json:"type"`
	Catalog        []Category               `json:"catalog"`
	Content        []DisplayPositionContent `json:"content"`
	User           User                     `json:"user"`
	FirstTimeUser  bool                     `json:"first_time_user"`
	LandingPageHit string                   `json:"landing_page_hit"`
	Id             string                   `json:"id"`
	Links          []Link                   `json:"links"`
}

type Order

type Order struct {
	Type               string         `json:"type"`
	Id                 string         `json:"id"`
	Items              []OrderLine    `json:"items"`
	DeliverySlots      []DeliverySlot `json:"delivery_slots"`
	SelectedSlot       SelectedSlot   `json:"selected_slot"`
	TotalCount         int            `json:"total_count"`
	TotalPrice         int            `json:"total_price"`
	CheckoutTotalPrice int            `json:"checkout_total_price"`
	Mts                int            `json:"mts"`
	TotalSavings       int            `json:"total_savings"`
	TotalDeposit       int            `json:"total_deposit"`
	Cancellable        bool           `json:"cancellable"`
	CreationTime       string         `json:"creation_time"`
	Status             string         `json:"status"`
}

type OrderArticle

type OrderArticle struct {
	Type             string      `json:"type"`
	Id               string      `json:"id"`
	Name             string      `json:"name"`
	DisplayPrice     int         `json:"display_price"`
	Price            int         `json:"price"`
	ImageId          string      `json:"image_id"`
	Images           []Image     `json:"images"`
	UnitQuantity     string      `json:"unit_quantity"`
	MaxOrderQuantity int         `json:"max_order_quantity"`
	Decorators       []Decorator `json:"decorators"`
}

func (OrderArticle) IsAvailable

func (a OrderArticle) IsAvailable() bool

IsAvailable A convince method to find the decorator with type UNAVAILABLE denoting the product is not available. Full details can be found in the Decorator

func (OrderArticle) Quantity

func (a OrderArticle) Quantity() int

Quantity A convince method to find the decorator with type Quantity and return the total.

type OrderLine

type OrderLine struct {
	Type         string         `json:"type"`
	Id           string         `json:"id"`
	Items        []OrderArticle `json:"items"`
	DisplayPrice int            `json:"display_price"`
	Price        int            `json:"price"`
	Decorators   []Decorator    `json:"decorators"`
}

func (OrderLine) IsOnPromotion

func (s OrderLine) IsOnPromotion() bool

func (OrderLine) PriceIncludingPromotions

func (o OrderLine) PriceIncludingPromotions() int

type Payment

type Payment struct {
	PaymentId               string        `json:"payment_id"`
	TransactionId           string        `json:"transaction_id"`
	IssuerAuthenticationUrl string        `json:"issuer_authentication_url"`
	Action                  PaymentAction `json:"action"`
}

type PaymentAction

type PaymentAction struct {
	Type        string `json:"type"`
	RedirectUrl string `json:"redirect_url"`
}

type PaymentBrand

type PaymentBrand struct {
	Brand       string `json:"brand"`
	DisplayName string `json:"display_name"`
	IconUrl     string `json:"icon_url"`
}

type PaymentMethod

type PaymentMethod struct {
	PaymentMethod string         `json:"payment_method"`
	DisplayName   string         `json:"display_name"`
	IconUrl       string         `json:"icon_url"`
	Brands        []PaymentBrand `json:"brands"`
	Visibility    string         `json:"visibility"`
}

type PaymentProfile

type PaymentProfile struct {
	StoredPaymentOptions       []StoredPaymentOption    `json:"stored_payment_options"`
	AvailablePaymentMethods    []AvailablePaymentMethod `json:"available_payment_methods"`
	PaymentMethods             []PaymentMethod          `json:"payment_methods"`
	PreferredPaymentOptionId   string                   `json:"preferred_payment_option_id"`
	AvailablePaymentMethodItem string                   `json:"available_payment_method_item"`
}

type PicnicError

type PicnicError struct {
	Code    string             `json:"code"`
	Message string             `json:"message"`
	Details PicnicErrorDetails `json:"details"`
}

func (*PicnicError) CreateCheckoutError

func (p *PicnicError) CreateCheckoutError() *CheckoutError

func (*PicnicError) IsCartError

func (p *PicnicError) IsCartError() bool

type PicnicErrorDetails

type PicnicErrorDetails struct {
	Type                        string `json:"type"`
	LocalizedMessage            string `json:"localized_message"`
	Blocking                    bool   `json:"blocking"`
	ResolveKey                  string `json:"resolve_key"`
	LocalizedTitle              string `json:"localized_title"`
	LocalizedContinueButtonText string `json:"localized_continue_button_text"`
	LocalizedCancelButtonText   string `json:"localized_cancel_button_text"`
}

type Position

type Position struct {
	StartIndex int `json:"start_index"`
	Length     int `json:"length"`
}

type PriceInfo

type PriceInfo struct {
	Price         int    `json:"price"`
	PriceColor    string `json:"price_color"`
	OriginalPrice int    `json:"original_price"`
	Deposit       int    `json:"deposit"`
	BasePriceText string `json:"base_price_text"`
}

type Promo

type Promo struct {
	Text string `json:"text"`
}

type ReturnContainer

type ReturnContainer struct {
	Type          string `json:"type"`
	LocalizedName string `json:"localized_name"`
	Quantity      int    `json:"quantity"`
	Price         int    `json:"price"`
}

type Scenario

type Scenario struct {
	TimeStamp int     `json:"ts"`
	Lat       float64 `json:"lat"`
	Lng       float64 `json:"lng"`
}

Scenario Estimation of geolocation for a given time. Use the DeliveryPosition to find the current TimeStamp

type SearchContent added in v1.2.0

type SearchContent struct {
	Type        string        `json:"type"`
	SellingUnit SingleArticle `json:"selling_unit"`
}

type SearchPage added in v1.2.0

type SearchPage struct {
	Body SearchPageBody `json:"body"`
}

type SearchPageBody added in v1.2.0

type SearchPageBody struct {
	Children []BodyChild `json:"children"`
}

type SearchResult

type SearchResult struct {
	Type  string          `json:"type"`
	Id    string          `json:"id"`
	Links []Link          `json:"links"`
	Name  string          `json:"name"`
	Items []SingleArticle `json:"items"`
	Level int             `json:"level"`
}

type SearchSuggestion

type SearchSuggestion struct {
	Type       string `json:"type"`
	Id         string `json:"id"`
	Links      []Link `json:"links"`
	Suggestion string `json:"suggestion"`
}

type SelectedSlot

type SelectedSlot struct {
	SlotId string `json:"slot_id"`
	State  string `json:"state"`
}

type SetSlot

type SetSlot struct {
	SlotId string `json:"slot_id"`
}

type SingleArticle

type SingleArticle struct {
	Type         string      `json:"type"`
	Id           string      `json:"id"`
	Name         string      `json:"name"`
	DisplayPrice int         `json:"display_price"`
	Price        int         `json:"price"`
	ImageId      string      `json:"image_id"`
	UnitQuantity string      `json:"unit_quantity"`
	Decorators   []Decorator `json:"decorators"`
}

func (SingleArticle) IsOnPromotion

func (s SingleArticle) IsOnPromotion() bool

func (SingleArticle) PriceIncludingPromotions

func (o SingleArticle) PriceIncludingPromotions() int

type Source

type Source struct {
	Id string `json:"id"`
}

type StoredPaymentOption

type StoredPaymentOption struct {
	Id            string `json:"id"`
	PaymentMethod string `json:"payment_method"`
	Brand         string `json:"brand"`
	Account       string `json:"account"`
	DisplayName   string `json:"display_name"`
	IconUrl       string `json:"icon_url"`
}

type Style

type Style struct {
	Position Position `json:"position"`
	Color    string   `json:"color"`
	Style    string   `json:"style"`
}

type SubBanner

type SubBanner struct {
	BannerID    string            `json:"banner_id"`
	ImageID     string            `json:"image_id"`
	DisplayTime string            `json:"display_time"`
	Description string            `json:"description"`
	Reference   DeeplinkReference `json:"reference"`
	Position    string            `json:"position"`
}

type Subscription

type Subscription struct {
	ListId     string `json:"list_id"`
	Subscribed bool   `json:"subscribed"`
	Name       string `json:"name"`
}

type TemplatedContent

type TemplatedContent struct {
	Type        string   `json:"type"`
	TemplateId  string   `json:"template_id"`
	VersionId   string   `json:"version_id"`
	VersionName string   `json:"version_name"`
	Content     string   `json:"content"`
	Parameters  []string `json:"parameters"`
	Actions     []string `json:"actions"`
}

type TrackingAttributes

type TrackingAttributes struct {
	TemplateVariantId string   `json:"template_variant_id"`
	EntityIds         []string `json:"entity_ids"`
}

type User

type User struct {
	Id                  string           `json:"user_id"`
	Firstname           string           `json:"firstname"`
	Lastname            string           `json:"lastname"`
	Address             Address          `json:"address"`
	Phone               string           `json:"phone"`
	ContactEmail        string           `json:"contact_email"`
	FeatureToggles      []interface{}    `json:"feature_toggles"`
	PushSubscriptions   []Subscription   `json:"push_subscriptions"`
	Subscriptions       []Subscription   `json:"subscriptions"`
	CustomerType        string           `json:"customer_type"`
	HouseholdDetails    HouseholdDetails `json:"household_details"`
	CheckGeneralConsent bool             `json:"check_general_consent"`
	PlacedOrder         bool             `json:"placed_order"`
	ReceivedDelivery    bool             `json:"received_delivery"`
	TotalDeliveries     int              `json:"total_deliveries"`
	CompletedDeliveries int              `json:"completed_deliveries"`
	ConsentDecisions    ConsentDecisions `json:"consent_decisions"`
}

type Vehicle

type Vehicle struct {
	Name  string `json:"name"`
	Image string `json:"image"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL