products

package
v0.0.0-...-f55e261 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InventoryQuantity

type InventoryQuantity struct {
	Lt  int `json:"lt"`
	Gt  int `json:"Gt"`
	Lte int `json:"Lte"`
	Gte int `json:"Gte"`
}

type ListProduct

type ListProduct struct {
	// Query used for searching products by title, description, variant's title, variant's sku, and collection's title
	Q string `json:"q,omitempty" url:"q,omitempty"`

	// product IDs to search for.
	Ids []string `json:"id,omitempty" url:"id,omitempty"`

	// Collection IDs to search for
	CollectionIds []string `json:"collection_id" url:"collection_id"`

	// Tag IDs to search for
	Tags []string `json:"tags,omitempty" url:"tags,omitempty"`

	// title to search for.
	Title string `json:"title,omitempty" url:"title,omitempty"`

	// description to search for
	Description string `json:"description,omitempty" url:"description,omitempty"`

	// handle to search for.
	Handle string `json:"handle,omitempty" url:"handle,omitempty"`

	// Search for giftcards using is_giftcard=true.
	IsGiftcard bool `json:"is_giftcard,omitempty" url:"is_giftcard,omitempty"`

	// type to search for.
	Type string `json:"type,omitempty" url:"type,omitempty"`

	// Date comparison for when resulting products were created.
	CreatedAt *common.DateComparison `json:"created_at,omitempty" url:"created_at,omitempty"`

	// Date comparison for when resulting products were updated.
	UpdatedAt *common.DateComparison `json:"updated_at,omitempty" url:"updated_at,omitempty"`

	// How many products to skip in the result.
	Offset int `json:"offset" url:"offset"`

	// Limit the number of products returned.
	Limit int `json:"limit" url:"limit"`

	// (Comma separated) Which fields should be expanded in each order of the result.)
	Expand string `json:"expand,omitempty" url:"expand,omitempty"`

	// (Comma separated) Which fields should be included in each order of the result.
	Fields string `json:"fields,omitempty" url:"fields,omitempty"`
}

func NewListProduct

func NewListProduct() *ListProduct

func (*ListProduct) List

func (c *ListProduct) List(config *medusa.Config) (*ListProductResponse, error)

Retrieve a list of Products.

func (*ListProduct) SetCollectionIds

func (p *ListProduct) SetCollectionIds(collectionIds []string) *ListProduct

func (*ListProduct) SetCreatedAt

func (p *ListProduct) SetCreatedAt(creatdAt *common.DateComparison) *ListProduct

func (*ListProduct) SetDescription

func (p *ListProduct) SetDescription(description string) *ListProduct

func (*ListProduct) SetExpand

func (p *ListProduct) SetExpand(expand string) *ListProduct

func (*ListProduct) SetFields

func (p *ListProduct) SetFields(fields string) *ListProduct

func (*ListProduct) SetHandle

func (p *ListProduct) SetHandle(handle string) *ListProduct

func (*ListProduct) SetIds

func (p *ListProduct) SetIds(ids []string) *ListProduct

func (*ListProduct) SetIsGiftcard

func (p *ListProduct) SetIsGiftcard(isGiftcard bool) *ListProduct

func (*ListProduct) SetLimit

func (p *ListProduct) SetLimit(limit int) *ListProduct

func (*ListProduct) SetOffset

func (p *ListProduct) SetOffset(offset int) *ListProduct

func (*ListProduct) SetQ

func (p *ListProduct) SetQ(q string) *ListProduct

func (*ListProduct) SetTags

func (p *ListProduct) SetTags(tags []string) *ListProduct

func (*ListProduct) SetTitle

func (p *ListProduct) SetTitle(title string) *ListProduct

func (*ListProduct) SetType

func (p *ListProduct) SetType(productType string) *ListProduct

func (*ListProduct) SetUpdatedAt

func (p *ListProduct) SetUpdatedAt(updatedAt *common.DateComparison) *ListProduct

type ListProductData

type ListProductData struct {
	// Array of product
	Products []*schema.Product `json:"products"`

	// The total number of items available
	Count uint `json:"count"`

	// The number of items skipped before these items
	Offset uint `json:"offset"`

	// The number of items per page
	Limit uint `json:"limit"`
}

type ListProductResponse

type ListProductResponse struct {
	// Success response
	Data *ListProductData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

type ListProductVariant

type ListProductVariant struct {
	// A comma separated list of Product Variant ids to filter by.
	Ids string `json:"ids" url:"ids"`

	// A comma separated list of Product Variant relations to load.
	Expand string `json:"expand" url:"expand"`

	// How many product variants to skip in the result.
	Offset string `json:"offset" url:"offset"`

	// Maximum number of Product Variants to return.
	Limit string `json:"limit" url:"limit"`

	// product variant title to search for.
	Title any `json:"title" url:"title"`

	// Filter by available inventory quantity
	InventoryQuantity any `json:"inventory_quantity" url:"inventory_quantity"`
}

func NewListProuductVariant

func NewListProuductVariant() *ListProductVariant

func (*ListProductVariant) List

Retrieves a list of Product Variants

func (*ListProductVariant) SetExpand

func (l *ListProductVariant) SetExpand(expand string) *ListProductVariant

func (*ListProductVariant) SetIds

func (*ListProductVariant) SetInventoryQuantity

func (l *ListProductVariant) SetInventoryQuantity(invQty any) *ListProductVariant

func (*ListProductVariant) SetLimit

func (l *ListProductVariant) SetLimit(limit string) *ListProductVariant

func (*ListProductVariant) SetOffset

func (l *ListProductVariant) SetOffset(offset string) *ListProductVariant

func (*ListProductVariant) SetTitle

func (l *ListProductVariant) SetTitle(title any) *ListProductVariant

type ListVariantData

type ListVariantData struct {
	Variants []*schema.ProductVariant `json:"variants"`
}

type ListVariantResponse

type ListVariantResponse struct {
	// Success response
	Data *ListVariantData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

type RetrieveProductData

type RetrieveProductData struct {
	Product []*schema.Product `json:"product"`
}

type RetrieveProductResponse

type RetrieveProductResponse struct {
	// Success response
	Data *RetrieveProductData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

func Retrieve

func Retrieve(id string, config *medusa.Config) (*RetrieveProductResponse, error)

Retrieves a Product.

type RetrieveVariantData

type RetrieveVariantData struct {
	// Product Variants Prices Fields that are only available in some requests.
	Variant []*schema.ProductVariant `json:"variant"`
}

type RetrieveVariantResponse

type RetrieveVariantResponse struct {
	// Success response
	Data *RetrieveVariantData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

func RetrieveVariant

func RetrieveVariant(variantId string, config *medusa.Config) (*RetrieveVariantResponse, error)

Retrieves a Product Variant by id

type SearchProduct

type SearchProduct struct {
	// The query to run the search with.
	Q string `json:"q,omitempty" url:"q,omitempty"`

	// How many products to skip in the result.
	Offset int `json:"offset,omitempty" url:"offset,omitempty"`

	// Limit the number of products returned.
	Limit int `json:"limit,omitempty" url:"limit,omitempty"`
}

func NewSearchProduct

func NewSearchProduct() *SearchProduct

func (*SearchProduct) Search

func (s *SearchProduct) Search(config *medusa.Config) (*SearchProductResponse, error)

Run a search query on products using the search engine installed on Medusa

func (*SearchProduct) SetLimit

func (s *SearchProduct) SetLimit(limit int) *SearchProduct

func (*SearchProduct) SetOffset

func (s *SearchProduct) SetOffset(offset int) *SearchProduct

func (*SearchProduct) SetQ

func (s *SearchProduct) SetQ(q string) *SearchProduct

type SearchProductData

type SearchProductData struct {
	// Array of results. The format of the items depends on the search engine installed on the server.
	Hits []any `json:"hits"`
}

type SearchProductResponse

type SearchProductResponse struct {
	// Success response
	Data *SearchProductData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

Jump to

Keyboard shortcuts

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