monitor

package
v0.0.0-...-efa996e Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"

	AmazonAcceptHeader = ""                                     /* 164-byte string literal not displayed */
	AmazonTokenUrl     = "https://www.amazon.com/dp/B0BZWRSRWV" // * One of many Amazon product pages that contains an embedded api token

	AmazonBaseUrl  = "https://data.amazon.com/api/marketplaces/ATVPDKIKX0DER/products/"
	BestbuyBaseUrl = "https://www.bestbuy.com/button-state/api/v5/button-state?context=pdp&source=buttonView&skus="
	NeweggBaseUrl  = "https://www.newegg.com/product/api/ProductRealtime?ItemNumber="
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MonitorClient

type MonitorClient struct {
	HttpClient   tls_client.HttpClient
	AlertChannel chan bool // * Alert channel for when the monitor finds stock
	// contains filtered or unexported fields
}

func NewMonitorClient

func NewMonitorClient(opts MonitorOpts) (*MonitorClient, error)

* NewMonitorClient intializes a new http client and returns a new monitor instance

func (*MonitorClient) AmazonTask

func (m *MonitorClient) AmazonTask(priceLimit float64) error

* AmazonTask continuously refreshes the api token and checks stock until the cancel channel is triggered

func (*MonitorClient) BestbuyTask

func (m *MonitorClient) BestbuyTask() error

* BestbuyTask continuously checks stock until the cancel channel is triggered

func (*MonitorClient) Cancel

func (m *MonitorClient) Cancel()

func (*MonitorClient) NeweggTask

func (m *MonitorClient) NeweggTask() error

* NeweggTask continuously checks stock until the cancel channel is triggered

type MonitorOpts

type MonitorOpts struct {
	Sku       string
	Delay     int
	Proxy     string
	UserAgent string
	Logging   bool
}

Jump to

Keyboard shortcuts

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