internal

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SpressoPriceOptimizationEvent = "spresso_price_optimization_request"
)

Variables

This section is empty.

Functions

func GetRestyClient added in v0.5.0

func GetRestyClient() *restyClient

func NewRestyClient

func NewRestyClient(defaultTimeout *time.Duration, defaultRetryCount *int) *restyClient

func NewSingleton added in v0.5.0

func NewSingleton[T any](initFunc func() (T, error)) *singleton[T]

func PrimeNumberHasher added in v0.5.0

func PrimeNumberHasher(stringVal string) *big.Int

s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]

Types

type ItemPriceSplit added in v0.5.0

type ItemPriceSplit struct {
	Price            float64 `json:"price" msgpack:"price"`
	AllocationTarget int     `json:"allocationTarget" msgpack:"allocationTarget"`
	IsHoldout        bool    `json:"isHoldout" msgpack:"isHoldout"`
}

type ItemPriceSplits added in v0.5.0

type ItemPriceSplits struct {
	Sku         string                      `json:"sku" msgpack:"sku"`
	PriceSplits []ItemPriceSplit            `json:"priceSplits" msgpack:"priceSplits"`
	ReportInfo  PriceOptimizationReportInfo `json:"reportInfo" msgpack:"reportInfo"`
	ExpiresAt   int64                       `json:"expiresAt" msgpack:"expiresAt"`
}

type PostPriceArmsResponse added in v0.5.0

type PostPriceArmsResponse struct {
	Data []*ItemPriceSplits `json:"data"`
}

type PostSpressoEventRequest added in v0.5.0

type PostSpressoEventRequest struct {
	Datas []SpressoEvent `json:"datas"`
}

type PriceOptimizationReport added in v0.5.0

type PriceOptimizationReport struct {
	Sku                        string  `json:"sku"`
	Price                      float64 `json:"price"`
	DefaultPrice               float64 `json:"defaultPrice"`
	OverrideToDefaultPrice     bool    `json:"overrideToDefaultPrice"`
	VariantId                  string  `json:"variantId"`
	StandardPrice              float64 `json:"standardPrice"`
	Cost                       float64 `json:"cost"`
	ProfitWeight               float64 `json:"profitWeight"`
	IsPriceOptimized           bool    `json:"isPriceOptimized"`
	IsHoldout                  bool    `json:"isHoldOut"`
	HasVariant                 bool    `json:"hasVariant"`
	HasPriceOptimizationConfig bool    `json:"hasPriceOptimizationConfig"`
	IsAutoGenerated            bool    `json:"isAutoGenerated"`
	CampaignId                 string  `json:"campaignId"`
}

type PriceOptimizationReportInfo added in v0.5.0

type PriceOptimizationReportInfo struct {
	VariantId                  string  `json:"variantId" msgpack:"variantId"`
	StandardPrice              float64 `json:"standardPrice" msgpack:"standardPrice"`
	Cost                       float64 `json:"cost" msgpack:"cost"`
	ProfitWeight               float64 `json:"profitWeight" msgpack:"profitWeight"`
	HasVariant                 bool    `json:"hasVariant" msgpack:"hasVariant"`
	HasPriceOptimizationConfig bool    `json:"hasPriceOptimizationConfig" msgpack:"hasPriceOptimizationConfig"`
	IsAutoGenerated            bool    `json:"isAutoGenerated" msgpack:"isAutoGenerated"`
	CampaignId                 string  `json:"campaignId" msgpack:"campaignId"`
}

type PriceOptimizationReportProperties added in v0.5.0

type PriceOptimizationReportProperties struct {
	DeviceId string                  `json:"deviceId"`
	UserId   *string                 `json:"userId"`
	Report   PriceOptimizationReport `json:"report"`
}

type RestyClient

type RestyClient interface {
	R(ctx context.Context, host string) RestyRequest
}

type RestyRequest

type RestyRequest interface {
	SetHeader(header, value string) RestyRequest
	SetHeaderMultiValues(headers map[string][]string) RestyRequest
	SetQueryParam(param, value string) RestyRequest
	SetQueryParams(params map[string]string) RestyRequest
	SetBody(body interface{}) RestyRequest
	SetResult(res interface{}) RestyRequest
	SetPathParam(params, value string) RestyRequest
	SetPathParams(params map[string]string) RestyRequest

	SetRetryCount(retryCount int) RestyRequest
	SetTimeout(timeout time.Duration) RestyRequest
	SetSuccessCode(successCode int) RestyRequest

	Get(endpoint string) (*resty.Response, error)
	Post(endpoint string) (*resty.Response, error)
	Put(endpoint string) (*resty.Response, error)
}

type Singleton added in v0.5.0

type Singleton[T any] interface {
	Load() (T, error)
	MustLoad() T
	Reset()
}

type SingletonInitFunc added in v0.5.0

type SingletonInitFunc[T any] func() (T, error)

type SpressoEvent added in v0.5.0

type SpressoEvent struct {
	Event          string                            `json:"event"`
	Uid            string                            `json:"uid"`
	UtcTimestampMs int64                             `json:"utcTimestampMs"`
	TimezoneOffset int                               `json:"timezoneOffset"`
	Properties     PriceOptimizationReportProperties `json:"properties"`
}

Jump to

Keyboard shortcuts

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