Documentation
¶
Overview ¶
Package eansearch is a Go module for EAN, GTIN and ISBN name lookup and validation
Index ¶
- Constants
- func BarcodeImage(ean string) ([]byte, error)
- func CreditsRemaining() (int, error)
- func FindAsinForEan(ean string) (string, error)
- func FindEanForAsin(asin string) (string, error)
- func FindEanForLccn(lccn string) (string, error)
- func FindLccnForEan(ean string) (string, error)
- func IssuingCountryLookup(ean string) (string, error)
- func SetToken(t string) error
- func VerifyChecksum(ean string) (bool, error)
- type AsinLookup
- type AsinOrError
- type Checksum
- type ChecksumOrError
- type ExtProduct
- type ExtProductOrError
- type Image
- type ImageOrError
- type LccnLookup
- type LccnOrError
- type Product
- func BarcodePrefixSearch(prefix string, page uint, lang uint) ([]Product, bool, error)
- func CategorySearch(category uint, name string, page uint, lang uint) ([]Product, bool, error)
- func ISBNLookup(isbn string) ([]Product, error)
- func ProductSearch(name string, page uint, lang uint) ([]Product, bool, error)
- func SimilarProductSearch(name string, page uint, lang uint) ([]Product, bool, error)
- type ProductOrError
Constants ¶
const AnyLanguage uint = 99
const Bulgarian uint = 20
const Croatian uint = 18
const Czech uint = 16
const Danish uint = 2
const Dutch uint = 10
const English uint = 1
Language codes for the preferred language of product names
const Finish uint = Finnish
Finish is the old, misspelled name of Finnish, kept for compatibility
const Finnish uint = 5
const French uint = 6
const German uint = 3
const Greek uint = 21
const Hungarian uint = 7
const Italian uint = 8
const Japanese uint = 9
const MaxApiTries uint = 3
MaxApiTries is the maximum number of requests per API call (retries on 429 responses)
const Norwegian uint = 11
const Polish uint = 12
const Portuguese uint = 13
const Romanian uint = 19
const Spanish uint = 4
const Swedish uint = 15
Variables ¶
This section is empty.
Functions ¶
func BarcodeImage ¶ added in v1.3.0
BarcodeImage returns a PNG image of the EAN barcode
func CreditsRemaining ¶ added in v1.6.0
CreditsRemaining returns the number of remaining API credits
func FindAsinForEan ¶ added in v1.6.0
FindAsinForEan finds the Amazon ASIN for an EAN or ISBN-13 barcode
func FindEanForAsin ¶ added in v1.6.0
FindEanForAsin finds the EAN barcode for an Amazon ASIN
func FindEanForLccn ¶ added in v1.6.0
FindEanForLccn finds the EAN barcode for a Library of Congress Control Number (LCCN) There can be multiple EANs for one LCCN, this returns the first one found.
func FindLccnForEan ¶ added in v1.6.0
FindLccnForEan finds the Library of Congress Control Number (LCCN) for an EAN or ISBN-13 barcode
func IssuingCountryLookup ¶ added in v1.3.0
IssuingCountryLookup returns the country where the EAN was issued
func SetToken ¶
SetToken initialises the API with the token, you can apply for at https://www.ean-search.org/ean-database-api.html
func VerifyChecksum ¶ added in v1.3.0
VerifyChecksum checks if the checksum of the EAN is valid
Types ¶
type AsinLookup ¶ added in v1.6.0
type AsinOrError ¶ added in v1.6.0
type AsinOrError struct {
AsinLookup
Error string
}
type ChecksumOrError ¶ added in v1.3.0
type ExtProduct ¶ added in v1.5.0
type ExtProduct struct {
Ean string
Name string
CategoryID uint `json:",string"`
CategoryName string
GoogleCategoryID uint `json:",string"`
IssuingCountry string
}
ExtProduct holds datasets returned by BarcodeLookup(), including the Google category
func BarcodeLookup ¶
func BarcodeLookup(ean string, lang uint) ([]ExtProduct, error)
BarcodeLookup searches for a single EAN code
type ExtProductOrError ¶ added in v1.5.0
type ExtProductOrError struct {
ExtProduct
Error string
}
type ImageOrError ¶ added in v1.3.0
type LccnLookup ¶ added in v1.6.0
type LccnOrError ¶ added in v1.6.0
type LccnOrError struct {
LccnLookup
Error string
}
type Product ¶
type Product struct {
Ean string
Name string
CategoryID uint `json:",string"`
CategoryName string
IssuingCountry string
}
Product holds datasets returned by the API
func BarcodePrefixSearch ¶
BarcodePrefixSearch finds all EANs starting with a certain prefix
func CategorySearch ¶ added in v1.3.0
CategorySearch searches for products by category and name
func ISBNLookup ¶ added in v1.3.0
ISBNLookup searches for a single ISBN-10 or ISBN-13 code
func ProductSearch ¶
ProductSearch searches for products by name (exact)