internal

package
v0.0.0-...-ad6854a Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaldorHost   = "https://www.baldorfood.com"
	URLNewLogin  = "https://www.baldorfood.com/users/default/new-login"
	URLCart      = "https://www.baldorfood.com/cart"
	URLAddToCart = "https://www.baldorfood.com/ecommerce/shoppingcart/cart.addToCart"
)

Variables

This section is empty.

Functions

func BaldorCookie

func BaldorCookie(j http.CookieJar) (*http.Cookie, error)

func IndexDir

func IndexDir() string

func LoadItems

func LoadItems() (map[string][]*Item, error)

func ProductsDir

func ProductsDir() string

func ReadEmailAndPassword

func ReadEmailAndPassword() (string, string, error)

Types

type Colly

type Colly struct {
	Host    string
	Cookies []*http.Cookie
	// contains filtered or unexported fields
}

func NewColly

func NewColly(hostURL string, cookies []*http.Cookie) *Colly

func (*Colly) GetItemsOnPage

func (c *Colly) GetItemsOnPage(url string) []*Item

func (*Colly) IsLoggedIn

func (c *Colly) IsLoggedIn() bool

type Item

type Item struct {
	Brand      string
	Label      string
	Title      string
	Link       string
	Sku        string
	Price      string
	Unit       string
	Img        string
	ProductKey string
	Category   string
}

type Searcher

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

func NewIndex

func NewIndex(indexName string) (*Searcher, error)

func NewSearcher

func NewSearcher(items []*Item) (*Searcher, error)

func (*Searcher) DocCount

func (s *Searcher) DocCount() (uint64, error)

func (*Searcher) Index

func (s *Searcher) Index(item *Item)

func (*Searcher) Search

func (s *Searcher) Search(query string) ([]*Item, error)

type Shopper

type Shopper struct {
	http.Client
}

func NewShopperWithAuthentication

func NewShopperWithAuthentication(email, pass string) (*Shopper, error)

func NewShopperWithCookies

func NewShopperWithCookies(cookies []*http.Cookie) (*Shopper, error)

func (*Shopper) AddToCart

func (s *Shopper) AddToCart(productKey, unit string) (int, error)

Jump to

Keyboard shortcuts

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