octopusapi

package module
v0.0.0-...-2f009f2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: GPL-3.0 Imports: 9 Imported by: 1

README

Go Go Report Card

octopus-api

A small API to access data from cuddlyoctopus.com

Usage

For the usage please look into the unit-tests.

License

GPL-3.0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrURLParseFailed defines URL parse failed error.
	ErrURLParseFailed = errors.New("URL parse failed")
	// ErrProductDetailParseFailed defines product detail parse failed error.
	ErrProductDetailParseFailed = errors.New("product detail parse failed")
	// ErrProductDetailParseFailed defines image ID parse failed error.
	ErrImageIDParseFailed = errors.New("image ID parse failed")
)

Functions

This section is empty.

Types

type Images

type Images []struct {
	Attributes struct {
		AttributePaVariant string `json:"attribute_pa_variant"`
		AttributePaSize    string `json:"attribute_pa_size"`
	} `json:"attributes"`
	AvailabilityHTML  string `json:"availability_html"`
	BackordersAllowed bool   `json:"backorders_allowed"`
	Dimensions        struct {
		Length string `json:"length"`
		Width  string `json:"width"`
		Height string `json:"height"`
	} `json:"dimensions"`
	DimensionsHTML      string  `json:"dimensions_html"`
	DisplayPrice        float64 `json:"display_price"`
	DisplayRegularPrice float64 `json:"display_regular_price"`
	Image               struct {
		Title                string `json:"title"`
		Caption              string `json:"caption"`
		URL                  string `json:"url"`
		Alt                  string `json:"alt"`
		Src                  string `json:"src"`
		Srcset               bool   `json:"srcset"`
		Sizes                string `json:"sizes"`
		FullSrc              string `json:"full_src"`
		FullSrcW             int    `json:"full_src_w"`
		FullSrcH             int    `json:"full_src_h"`
		GalleryThumbnailSrc  string `json:"gallery_thumbnail_src"`
		GalleryThumbnailSrcW int    `json:"gallery_thumbnail_src_w"`
		GalleryThumbnailSrcH int    `json:"gallery_thumbnail_src_h"`
		ThumbSrc             string `json:"thumb_src"`
		ThumbSrcW            int    `json:"thumb_src_w"`
		ThumbSrcH            int    `json:"thumb_src_h"`
		SrcW                 int    `json:"src_w"`
		SrcH                 int    `json:"src_h"`
	} `json:"image"`
	ImageID              int    `json:"image_id"`
	IsDownloadable       bool   `json:"is_downloadable"`
	IsInStock            bool   `json:"is_in_stock"`
	IsPurchasable        bool   `json:"is_purchasable"`
	IsSoldIndividually   string `json:"is_sold_individually"`
	IsVirtual            bool   `json:"is_virtual"`
	MaxQty               string `json:"max_qty"`
	MinQty               int    `json:"min_qty"`
	PriceHTML            string `json:"price_html"`
	Sku                  string `json:"sku"`
	VariationDescription string `json:"variation_description"`
	VariationID          int    `json:"variation_id"`
	VariationIsActive    bool   `json:"variation_is_active"`
	VariationIsVisible   bool   `json:"variation_is_visible"`
	Weight               string `json:"weight"`
	WeightHTML           string `json:"weight_html"`
}

type Product

type Product struct {
	Context     string `json:"@context"`
	Type        string `json:"@type"`
	ID          string `json:"@id"`
	Name        string `json:"name"`
	URL         string `json:"url"`
	Description string `json:"description"`
	MainImage   string `json:"image"`
	Sku         int    `json:"sku"`
	Offers      []struct {
		Type               string `json:"@type"`
		Price              string `json:"price"`
		PriceValidUntil    string `json:"priceValidUntil"`
		PriceSpecification struct {
			Price                 string `json:"price"`
			PriceCurrency         string `json:"priceCurrency"`
			ValueAddedTaxIncluded string `json:"valueAddedTaxIncluded"`
		} `json:"priceSpecification"`
		PriceCurrency string `json:"priceCurrency"`
		Availability  string `json:"availability"`
		URL           string `json:"url"`
		Seller        struct {
			Type string `json:"@type"`
			Name string `json:"name"`
			URL  string `json:"url"`
		} `json:"seller"`
	} `json:"offers"`
	NSFWImage string
}

Product details

func GetProductByURL

func GetProductByURL(URL string) (*Product, error)

Jump to

Keyboard shortcuts

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