shopee

package module
v0.0.0-...-fa489a9 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUrlNotMatch = errors.New("url doesn't match")
View Source
var ShopeeUrl, _ = url.Parse("https://mall.shopee.co.id")

Functions

func ParseProdURL

func ParseProdURL(urlstr string) (shopid, itemid int64, err error)

parse product url

func WithAndroid

func WithAndroid(c *resty.Client)

Types

type AccountInfo

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

func (AccountInfo) Init

func (a AccountInfo) Init(json jsoniter.Any) AccountInfo

func (AccountInfo) ShopID

func (a AccountInfo) ShopID() int64

func (AccountInfo) UserID

func (a AccountInfo) UserID() int64

func (AccountInfo) Username

func (a AccountInfo) Username() string

type AddressInfo

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

func (AddressInfo) Address

func (a AddressInfo) Address() string

func (AddressInfo) City

func (a AddressInfo) City() string

func (AddressInfo) Country

func (a AddressInfo) Country() string

func (AddressInfo) District

func (a AddressInfo) District() string

func (AddressInfo) GeoString

func (a AddressInfo) GeoString() string

func (AddressInfo) ID

func (a AddressInfo) ID() int64

func (AddressInfo) Init

func (a AddressInfo) Init(json jsoniter.Any, isDeliveryAddr bool) AddressInfo

func (AddressInfo) IsDeliveryAddress

func (a AddressInfo) IsDeliveryAddress() bool

func (AddressInfo) State

func (a AddressInfo) State() string

func (AddressInfo) Town

func (a AddressInfo) Town() string

func (AddressInfo) Zipcode

func (a AddressInfo) Zipcode() string

type Addresses

type Addresses []AddressInfo

func (Addresses) DeliveryAddress

func (a Addresses) DeliveryAddress() (int, AddressInfo)

returns index -1 if not found

type CheckoutParams

type CheckoutParams struct {
	Addr    AddressInfo
	Item    CheckoutableItem
	Payment PaymentChannel
	// PaymentChannelOption.OptionInfo
	PaymentOption string
	Logistic      LogisticChannelInfo
	// contains filtered or unexported fields
}

all exported fields are required

func (CheckoutParams) FSV

func (c CheckoutParams) FSV() (id uint64, code string)

func (CheckoutParams) Timestamp

func (c CheckoutParams) Timestamp() int64

func (CheckoutParams) WithFSV

func (c CheckoutParams) WithFSV(id uint64, code string) CheckoutParams

func (CheckoutParams) WithTimestamp

func (c CheckoutParams) WithTimestamp(ts int64) CheckoutParams

type CheckoutValidationError

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

func (CheckoutValidationError) Code

func (c CheckoutValidationError) Code() int

func (CheckoutValidationError) Error

func (c CheckoutValidationError) Error() string

func (CheckoutValidationError) Msg

func (CheckoutValidationError) ValidationCode

func (c CheckoutValidationError) ValidationCode() int

type CheckoutableItem

type CheckoutableItem struct {
	Item
	// contains filtered or unexported fields
}

func ChooseModel

func ChooseModel(item Item, modelId int64) CheckoutableItem

func ChooseModelByTierVar

func ChooseModelByTierVar(item Item, indexes []int) CheckoutableItem

indexes is tier variations index. indexes must be the same length as len(item.TierVariations())

func (CheckoutableItem) ChosenModel

func (c CheckoutableItem) ChosenModel() Model

type Client

type Client struct {
	Client *resty.Client
}

func New

func New(cookie http.CookieJar, opts ...Option) (Client, error)

func NewFromCookieString

func NewFromCookieString(cookie string, opts ...Option) (Client, error)

func (Client) CheckoutGetQuick

func (c Client) CheckoutGetQuick(params CheckoutParams) (CheckoutParams, error)

func (Client) FetchAccountInfo

func (c Client) FetchAccountInfo() (AccountInfo, error)

func (Client) FetchAddresses

func (c Client) FetchAddresses() (Addresses, error)

func (Client) FetchItem

func (c Client) FetchItem(shopid, itemid int64) (Item, error)

func (Client) FetchItemFromURL

func (c Client) FetchItemFromURL(urlstr string) (Item, error)

func (Client) FetchShippingInfo

func (c Client) FetchShippingInfo(addr AddressInfo, item Item) ([]LogisticChannelInfo, error)

func (Client) PlaceOrder

func (c Client) PlaceOrder(params CheckoutParams) error

func (Client) ValidateCheckout

func (c Client) ValidateCheckout(item CheckoutableItem) error

type InvalidCookieError

type InvalidCookieError string

func (InvalidCookieError) Error

func (i InvalidCookieError) Error() string

type Item

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

shopee product item

func (Item) CatIDs

func (i Item) CatIDs() []int64

func (Item) CatNames

func (i Item) CatNames() []string

func (Item) HasUpcomingFsale

func (i Item) HasUpcomingFsale() bool

func (Item) Init

func (i Item) Init(json jsoniter.Any) Item

func (Item) IsFlashSale

func (i Item) IsFlashSale() bool

func (Item) ItemID

func (i Item) ItemID() int64

func (*Item) Models

func (i *Item) Models() []Model

func (Item) Name

func (i Item) Name() string

func (Item) Price

func (i Item) Price() int64

func (Item) PriceMax

func (i Item) PriceMax() int64

func (Item) PriceMin

func (i Item) PriceMin() int64

func (Item) ShopID

func (i Item) ShopID() int64

func (Item) Stock

func (i Item) Stock() int

func (Item) TierVariations

func (i Item) TierVariations() []TierVar

func (Item) UpcomingFsaleHiddenPrice

func (i Item) UpcomingFsaleHiddenPrice() string

v2 api

func (Item) UpcomingFsaleStartTime

func (i Item) UpcomingFsaleStartTime() int64

type LogisticChannelInfo

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

func (LogisticChannelInfo) ChannelID

func (c LogisticChannelInfo) ChannelID() int64

func (LogisticChannelInfo) HasWarning

func (c LogisticChannelInfo) HasWarning() bool

func (LogisticChannelInfo) Init

func (LogisticChannelInfo) MaxPrice

func (c LogisticChannelInfo) MaxPrice() int64

func (LogisticChannelInfo) MinPrice

func (c LogisticChannelInfo) MinPrice() int64

func (LogisticChannelInfo) Name

func (c LogisticChannelInfo) Name() string

func (LogisticChannelInfo) PriceBeforeDiscount

func (c LogisticChannelInfo) PriceBeforeDiscount() int64

func (LogisticChannelInfo) Warning

func (c LogisticChannelInfo) Warning() string

type Model

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

func (Model) HasUpcomingFsale

func (m Model) HasUpcomingFsale() bool

func (Model) Init

func (m Model) Init(json jsoniter.Any) Model

func (Model) ItemID

func (m Model) ItemID() int64

func (Model) ModelID

func (m Model) ModelID() int64

func (Model) Name

func (m Model) Name() string

func (Model) Price

func (m Model) Price() int64

func (Model) Stock

func (m Model) Stock() int

type Option

type Option func(c *resty.Client)

type PaymentChannel

type PaymentChannel int
const (
	ShopeePay PaymentChannel = iota
	COD
	TransferBank
	Alfamart
	Indomaret
)

func (PaymentChannel) BuyerTxnFee

func (p PaymentChannel) BuyerTxnFee(option string) int64

func (PaymentChannel) Data

func (p PaymentChannel) Data(option string) map[string]interface{}

func (PaymentChannel) Name

func (p PaymentChannel) Name() string

func (PaymentChannel) Options

func (p PaymentChannel) Options() []PaymentChannelOption

func (PaymentChannel) String

func (p PaymentChannel) String() string

type PaymentChannelOption

type PaymentChannelOption struct{ Name, OptionInfo string }

type PlaceOrderError

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

func (PlaceOrderError) Error

func (p PlaceOrderError) Error() string

func (PlaceOrderError) Msg

func (p PlaceOrderError) Msg() string

func (PlaceOrderError) Type

func (p PlaceOrderError) Type() string

type TierVar

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

func (TierVar) Init

func (t TierVar) Init(json jsoniter.Any) TierVar

func (TierVar) Name

func (t TierVar) Name() string

func (TierVar) Options

func (t TierVar) Options() []string

Jump to

Keyboard shortcuts

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