safeway

package
v0.0.0-...-2534b82 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROMOTIONS_GET_CLIP_DEALS_URL = "https://www.safeway.com/abs/pub/mobile/j4u/api/ecomgallery?storeId=%s&offerPgm=PD-CC&includeRedeemedBonusOffers=y"
	PROMOTIONS_CLIP_DEALS_URL     = "https://www.safeway.com/abs/pub/mobile/j4u/api/offers/clip?storeId=%s"
)
View Source
const (
	COUPON_TYPE_PERSONALIZED_DEAL couponType = "PD"
	COUPON_TYPE_COUPON_MF         couponType = "MF"
	COUPON_TYPE_COUPON_SC         couponType = "SC"
	COUPON_TYPE_COUPON_CC         couponType = "CC"
	COUPON_TYPE_GROCERY_REWARD    couponType = "GR"
	COUPON_TYPE_MONOPOLY_PRIZE    couponType = "TR"
	COUPON_TYPE_WEEKLY_AD         couponType = "WS"
)
View Source
const (
	FILTER_COUPON_TYPE_PERSONALIZED_DEAL filterCouponType = "PD"
	FILTER_COUPON_TYPE_COUPON_MF         filterCouponType = "MF"
	FILTER_COUPON_TYPE_COUPON_SC         filterCouponType = "SC"
	FILTER_COUPON_TYPE_COUPON_CC         filterCouponType = "CC"
	FILTER_COUPON_TYPE_COUPON_MC         filterCouponType = "manufacturerCoupons"
)
View Source
const (
	COUPON_ACTION_TYPE_CLIP                couponActionType = "CL"
	COUPON_ACTION_TYPE_CLIPPED             couponActionType = "CLD"
	COUPON_ACTION_TYPE_ADD                 couponActionType = "AC"
	COUPON_ACTION_TYPE_ADDED               couponActionType = "ADC"
	COUPON_ACTION_TYPE_CLIP_COUPON         couponActionType = "CLC"
	COUPON_ACTION_TYPE_CLIP_OFFER          couponActionType = "CLCUDC"
	COUPON_ACTION_TYPE_ACTIVATE            couponActionType = "SCC"
	COUPON_ACTION_TYPE_BONUS_PATH_COMPLETE couponActionType = "CC"
)
View Source
const (
	OFFER_TYPE_UNLIMITED_USE  offerType = "U"
	OFFER_TYPE_ONE_TIME_USE_O offerType = "O"
	OFFER_TYPE_ONE_TIME_USE_M offerType = "M"
)
View Source
const (
	CLIP_STATUS_TYPE_CLIPPED   clipStatusType = "C"
	CLIP_STATUS_TYPE_UNCLIPPED clipStatusType = "U"
)

Variables

This section is empty.

Functions

func NewAuthenticator

func NewAuthenticator(ctx context.Context, cfg *supermarket.Config) (*authenticatorService, error)

func NewPromotion

func NewPromotion(ctx context.Context, cfg *supermarket.Config, ts oauth2.TokenSource) (*promotionService, error)

Types

type ClipDeal

type ClipDeal struct {
	ClipType string `json:"clipType"`
	ItemID   string `json:"itemId"`
	ItemType string `json:"itemType"`
	Status   int    `json:"status,omitempty"`
	ClipID   string `json:"clipId,omitempty"`
	ClipTs   string `json:"clipTs,omitempty"`
	Checked  bool   `json:"checked,omitempty"`
}

type ClipDealRoot

type ClipDealRoot struct {
	Items []ClipDeal `json:"items"`
}

type EpochMillisTime

type EpochMillisTime time.Time

EpochMillisTime is a custom type to handle Unix milliseconds timestamps.

func (EpochMillisTime) String

func (emt EpochMillisTime) String() string

String returns the time in a human-readable format.

func (*EpochMillisTime) UnmarshalJSON

func (emt *EpochMillisTime) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface and parses a JSON string representing Unix time in milliseconds.

type GetClipDealsResponse

type GetClipDealsResponse struct {
	Coupons           []Promotion `json:"cc,omitempty"`
	PersonalizedDeals []Promotion `json:"pd,omitempty"`
}

GetClipDealsResponse is the top-level structure for the deals response.

type Promotion

type Promotion struct {
	AllocationID        string             `json:"allocationId,omitempty"` //
	Brand               string             `json:"brand"`                  // Maps to: Brand
	Category            string             `json:"category"`               // Maps to: Category
	ClipID              string             `json:"clipId"`                 // Maps to: ID
	Description         string             `json:"description"`            // Maps to: Description
	Disclaimer          string             `json:"disclaimer"`             // Maps to: Disclaimer
	EcomDescription     string             `json:"ecomDescription"`        // Maps to: Shorter description
	ExternalOfferID     string             `json:"extlOfferId"`            //
	ForUDescription     string             `json:"forUDescription"`        //
	Hierarchies         PromotionHierarchy `json:"hierarchies"`            // Maps to: Categories
	ImageID             string             `json:"imageId"`                // Maps to: ImageID
	Upcs                []string           `json:"upcs"`                   // Maps to: ApplicableItems
	MinPurchaseQuantity int                `json:"minPurchaseQty"`         // Maps to: MinPurchaseQuantity
	MaxPurchaseQuantity int                `json:"maxPurchaseQty"`         // Maps to: MaxPurchaseQuantity
	Price               float64            `json:"price"`                  // Maps to: Price
	RegularPrice        string             `json:"regularPrice,omitempty"` //
	OfferID             string             `json:"offerId"`                // Maps to: PromoCode
	OfferPgm            string             `json:"offerPgm"`               // Maps to: PromoType
	OfferProgramType    string             `json:"offerProgramType"`       // Maps to: ProgramType
	ProgramType         string             `json:"programType,omitempty"`  //
	OfferProtoType      string             `json:"offerProtoType"`         //
	OfferSubPgm         string             `json:"offerSubPgm,omitempty"`  //
	PurchaseIndex       string             `json:"purchaseInd"`            //
	PurchaseRank        string             `json:"purchaseRank"`           //
	Status              clipStatusType     `json:"status"`                 // Maps to: Status
	UsageType           string             `json:"usageType"`              // Maps to: UsageType
	StartDate           EpochMillisTime    `json:"startDate"`              // Maps to: StartDate
	EndDate             EpochMillisTime    `json:"endDate"`                // Maps to: EndDate
	OfferTimestamp      EpochMillisTime    `json:"offerTs"`                //
	ClippedAt           EpochMillisTime    `json:"clipTs"`                 // Maps to: ClippedAt
	IsDeleted           bool               `json:"deleted"`                // Maps to: IsDeleted
	IsClippable         bool               `json:"isClippable"`            // Maps to: IsClippable
	IsDisplayable       bool               `json:"isDisplayable"`          // Maps to: IsDisplayable
	VendorBannerCd      string             `json:"vndrBannerCd,omitempty"` //
}

Promotion represents an individual promotion item.

type PromotionHierarchy

type PromotionHierarchy struct {
	Categories []string `json:"categories"`
	Events     []string `json:"events"`
}

PromotionHierarchy represents the nested hierarchy data.

Jump to

Keyboard shortcuts

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