solarisapi

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

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

Go to latest
Published: Jun 2, 2022 License: GPL-3.0 Imports: 6 Imported by: 1

README

Go Go Report Card

solarisapi

Api for products at solarisjapan.com

Usage

For the usage please look into the unit-tests.

License

GPL-3.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseHandleFromURL

func ParseHandleFromURL(URL string) string

ParseHandleFromURL thats needed for the API request

Types

type ProductDetails

type ProductDetails struct {
	Product struct {
		ID                int64             `json:"id"`
		Title             string            `json:"title"`
		BodyHTML          string            `json:"body_html"`
		Vendor            string            `json:"vendor"`
		ProductType       string            `json:"product_type"`
		CreatedAt         time.Time         `json:"created_at"`
		Handle            string            `json:"handle"`
		UpdatedAt         time.Time         `json:"updated_at"`
		PublishedAt       time.Time         `json:"published_at"`
		TemplateSuffix    interface{}       `json:"template_suffix"`
		Status            string            `json:"status"`
		PublishedScope    string            `json:"published_scope"`
		Tags              string            `json:"tags"`
		AdminGraphqlAPIID string            `json:"admin_graphql_api_id"`
		Info              map[string]string `json:"info"`
		Variants          []struct {
			ID                   int64       `json:"id"`
			Title                string      `json:"title"`
			Price                string      `json:"price"`
			Sku                  string      `json:"sku"`
			Position             int         `json:"position"`
			InventoryPolicy      string      `json:"inventory_policy"`
			CompareAtPrice       interface{} `json:"compare_at_price"`
			FulfillmentService   string      `json:"fulfillment_service"`
			InventoryManagement  string      `json:"inventory_management"`
			Option1              string      `json:"option1"`
			Option2              interface{} `json:"option2"`
			Option3              interface{} `json:"option3"`
			CreatedAt            time.Time   `json:"created_at"`
			UpdatedAt            time.Time   `json:"updated_at"`
			Taxable              bool        `json:"taxable"`
			Barcode              string      `json:"barcode"`
			Grams                int         `json:"grams"`
			ImageID              interface{} `json:"image_id"`
			Weight               float64     `json:"weight"`
			WeightUnit           string      `json:"weight_unit"`
			InventoryItemID      int64       `json:"inventory_item_id"`
			InventoryQuantity    int         `json:"inventory_quantity"`
			OldInventoryQuantity int         `json:"old_inventory_quantity"`
			RequiresShipping     bool        `json:"requires_shipping"`
			AdminGraphqlAPIID    string      `json:"admin_graphql_api_id"`
		} `json:"variants"`
		Options []struct {
			ID        int64    `json:"id"`
			ProductID int64    `json:"product_id"`
			Name      string   `json:"name"`
			Position  int      `json:"position"`
			Values    []string `json:"values"`
		} `json:"options"`
		Images []struct {
			ID                int64         `json:"id"`
			Position          int           `json:"position"`
			CreatedAt         time.Time     `json:"created_at"`
			UpdatedAt         time.Time     `json:"updated_at"`
			Alt               interface{}   `json:"alt"`
			Width             int           `json:"width"`
			Height            int           `json:"height"`
			Src               string        `json:"src"`
			VariantIds        []interface{} `json:"variant_ids"`
			AdminGraphqlAPIID string        `json:"admin_graphql_api_id"`
		} `json:"images"`
		Image struct {
			ID                int64         `json:"id"`
			Position          int           `json:"position"`
			CreatedAt         time.Time     `json:"created_at"`
			UpdatedAt         time.Time     `json:"updated_at"`
			Alt               interface{}   `json:"alt"`
			Width             int           `json:"width"`
			Height            int           `json:"height"`
			Src               string        `json:"src"`
			VariantIds        []interface{} `json:"variant_ids"`
			AdminGraphqlAPIID string        `json:"admin_graphql_api_id"`
		} `json:"image"`
	} `json:"product"`
}

ProductDetails of solarisjapan.com product

func GetItemByHandle

func GetItemByHandle(handle string) (ProductDetails, error)

GetItemByHandle and return it's data as a struct

func GetItemByURL

func GetItemByURL(URL string) (ProductDetails, error)

GetItemByURL and return it's data as a struct

Jump to

Keyboard shortcuts

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