staticice

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

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

Go to latest
Published: Jul 31, 2019 License: Unlicense Imports: 11 Imported by: 1

README

staticice

Documentation

staticice is a package to conveniently make search queries to staticICE. Made for PCSocBot.

Usage

See the example and godoc.

License

Unlicensed (released into the public domain).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a client to access staticICE.

func NewClient

func NewClient(c *http.Client) *Client

NewClient returns a new Client using the provided http client.

func (*Client) Search

func (c *Client) Search(region Region,
	query *SearchQuery) ([]*ItemEntry, error)

Search performs a search query on the provided region. The first 100 results will be returned.

type ItemEntry

type ItemEntry struct {
	Description string
	Seller      string
	Link        string
	LastUpdated time.Time
	Price       float64
}

ItemEntry represents an entry from staticICE's search.

type Region

type Region string

Region represents a staticICE region.

const (
	RegionAU Region = "https://www.staticice.com.au"
	RegionNZ Region = "https://www.staticice.co.nz"
	RegionUK Region = "https://www.staticice.co.uk"
	RegionUS Region = "https://www.staticice.com"
)

Available staticICE regions.

type SearchQuery

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

SearchQuery represents a query to search with.

func NewSearchQuery

func NewSearchQuery() *SearchQuery

NewSearchQuery creates a new search query.

func (*SearchQuery) ExcludeWords

func (q *SearchQuery) ExcludeWords(words string) *SearchQuery

ExcludeWords sets a space seperated list of words that the listing must not include.

func (*SearchQuery) Manufacturer

func (q *SearchQuery) Manufacturer(manufacturer string) *SearchQuery

Manufacturer sets a comma seperated list of manufacturers to search for.

func (*SearchQuery) MaxPrice

func (q *SearchQuery) MaxPrice(max int) *SearchQuery

MaxPrice sets the maximum price for the search query in the local currency.

func (*SearchQuery) MinPrice

func (q *SearchQuery) MinPrice(min int) *SearchQuery

MinPrice sets the minimum price for the search query in the local currency.

func (*SearchQuery) Model

func (q *SearchQuery) Model(model string) *SearchQuery

Model sets a comma seperated list of model names/numbers to search for.

func (*SearchQuery) Phrase

func (q *SearchQuery) Phrase(phrase string) *SearchQuery

Phrase sets an exact phrase that the listing must contain.

func (*SearchQuery) Query

func (q *SearchQuery) Query(query string) *SearchQuery

Query sets the normal search query to use.

func (*SearchQuery) Site

func (q *SearchQuery) Site(site string) *SearchQuery

Site sets a comma seperated list of strings to specify what the domain name must contain.

func (*SearchQuery) Words

func (q *SearchQuery) Words(words string) *SearchQuery

Words sets a space seperated list of words that the listing must contain.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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